Oracle ==> Postgres View

Sam Stearns <sam.stearns@dat.com>

From: Sam Stearns <sam.stearns@dat.com>
To: pgsql-sql@lists.postgresql.org
Date: 2024-10-15T21:30:55Z
Lists: pgsql-sql

Attachments

Howdy,

I have 2 views attached.  An Oracle view written with NVL.  The same view
was converted to Postgres using COALESCE.  Postgres is throwing an error:

ERROR:  syntax error at or near ","
LINE 12: ...esce(CASE WHEN impact_category='BULK_RATE_REQUEST', 1, -- To...

The problem block of code:

    coalesce(CASE WHEN impact_category='BULK_RATE_REQUEST', 1, -- To handle
Portal's category for the old RIP
       'CONTRACT_BULK_RATE', 1,
       'SPOT_BULK_RATE', 2,
       'CONTRACT_HISTORY', 3,
       'SPOT_HISTORY', 4,
       'RATE_SUBMISSION', 5,
       'SPOT_BACKHAUL' THEN  6 END , 0),

Would anyone be able to advise how to correct this for Postgres, please?

Thanks,

Sam

                                           ^

-- 

*Samuel Stearns*
Lead Database Administrator
*c:* 971 762 6879 | *o:* 503 672 5115 | DAT.com
[image: DAT]
<https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>