Avatar of PortletPaul
PortletPaul
Flag for Australia asked on

Oracle to Postgres Select Query differences

Looking for learnings/advice of Oracle to Postgres conversion (SELECT queries in particular).

I'm aware of a few key differences (e.g. no "dual", no "sysdate", no "connect by ...") but I'm hoping someone has, or knows of, a good fact sheet of differences.

If it helps: Oracle 11 to "recent Postgres" (not sure of version as yet)
PostgreSQLOracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
slightwv (䄆 Netminder)

Want me to blow your mind?  If you disable the autocommit, which is default, DDL can be rolled back!


I've been working towards an Oracle 12.2 to Postgres 11 (likely 12 by the time we get real serious) migration for a few months now.  Yes, getting used to the differences has been interesting.

I've not found a nice cheat sheet but I've also not really had the need to look.  When I need to do something, Google is pretty quick to offer advice.

I also prefer the Postgres documentation over Oracle's.  I find it MUCH easier to find what I'm looking for in their docs.

Haven't started with any PL/SQL/stored code migrations yet.  From the few pg/sql code blocks with simple loops that I'm copied, it should be interesting.  Had to drop ALL tables in a schema.  Code is similar to PL/SQL but different enough.

>>"dual"

I don't miss it.  If you do, easy enough to create it.

>>"sysdate"

But both have current_date and current_timestamp (not sure about Oracle 11 and I'm too lazy to pull up the 11g docs).

>>"connect by ..."

Pretty sure you can do the same with with recursive CTEs which both have.  Not tried them out yet!
PortletPaul

ASKER
I was hoping for some tips so I could some initial scanning of code

aware of the dual workaround

yep. cte instead of connect by (don't think I have any left anyway)

Will try current_date ... good idea.

no common function changes?

I guess decode is also a no go - easy enough to replace

any comments on performance?
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy