BibleGateway.com Verse Of The Day

Monday, September 18, 2006

Outer Joins: Sybase versus Oracle

I've never had the 'pleasure' of dealing with Sybase. I've created databases in Sybase and MS SQL Server (based on Sybase code at one point), but never had to interact with them directly (they were just meta databases for Silverstream servers).

So on a current project I have to convert a bunch of queries in Java code from Sybase to Oracle, as the database has been migrated.

To oversimplify, a right outer join in Sybase might look like this....

SELECT *
FROM table1, table2
WHERE table1.col3 =* table2.col3

And in Oracle it would look more like this...

SELECT *
FROM table1, table2
WHERE table1.col3(+) = table2.col3

For a left outer join, Sybase...

SELECT *
FROM table1, table2
WHERE table1.col3 *= table2.col3

And Oracle...

SELECT *
FROM table1, table2
WHERE table1.col3 = table2.col3(+)

As a side note, when you see something like "SELECT getDate(), ...", the getDate() function is basically the Sybase equivalent of SYSDATE.

No comments: