Category Archives: Oracle

Oracle in general.

How to Pass an Array of Object Type
To Static Function of That Type

Solution shorter than the title

Array of an Object Type Argument in a Function of That Object Type

Interesting question regarding Object Types was asked not a long ago on StackOverflow:

How to Pass a Nested Table of Object Type to a Function of That Object Type?

What author was trying to accomplish was to declare a static function in an object type which would take as a parameter an array of objects of the object type in which it was declared.

Is that even possible? (dramatic pause) Continue reading

Top-N Queries & The New Row Limiting Clause
11g & 12c

Sponsored by 'c'. Letter 'c'.

Getting the Top-N Records From an Ordered Set &
The New Row Limiting Clause – 11g & 12c

and a cup of tea if you’re lucky

I bet my cup of raspberry-juiced black tea that, somewhere along your journey with Oracle, you had to write a query which was supposed to return only the top-n rows from an ordered set. Unlike some of the other databases, MySQL, for instance, Oracle does not provide a dedicated solution to this problem.

At least, not before the 12c hit the stage.

Before I introduce you to the nice Row Limiting Clause, let me show you why the first solution that comes to mind to solve the problem at hand, in Oracle’s versions prior to 12c, is not the right one, and what voodoo tricks one has to perform to achieve the expected result. Continue reading

Connecting to Oracle Database
Using TNSNAMES.ORA in Java

Knock knock

Utilizing TNSNAMES.ORA in Java

- You have to use TNSNAMES.ORA.
- TNS-what?
- TNSNAMES.
- What-names?
- T N S N A M E S!
- What-what?

In the following thread on StackOverflow:

how-to-connect-jdbc-to-tns-oracle

a question concerning usage of net service names, stored in the TNSNAMES.ORA file, was asked. Let me briefly explain how to connect to Oracle using this approach. Continue reading

Three-valued Boolean Logic

The Three-eyed Raven likes it

Shortly about chickens and roads…

Why did the chicken cross the road?
Because 1 > NULL AND cross_the_road()

I bet you have heard about the chicken and you know at least a dozen reasons why it had crossed the road. I wouldn’t bet, though, that you have heard about the three-valued logic. And this one is interesting, it even makes the chicken cross the road. The answer to the above question could also be given as: Because it (the chicken) didn’t short-circuit evaluate. What does it all mean? Continue reading