Link to home
Start Free TrialLog in
Avatar of mossmis
mossmis

asked on

Converting Oracle Decode to SQL equivalent

I have a decode statement from an Oracle Report I am trying to translate into SQL server.

Here is the statement:

DECODE(RECEIPT_DATE, NULL, DECODE(DISP_DATE,NULL,DATE_SERIALIZED,DISP_DATE),RECEIPT_DATE) transfer_date  

From what I researched, SQL's equivalent would be a case statement. This is what I got so far but is erroring out: "incorrent sytax near word case"

case
  when RECEIPT_DATE is null then (
    case when DISP_DATE is null then date_serialized
    else DISP_DATE end)
  else receipt_date end as transfer_date


Did I miss something?
ASKER CERTIFIED SOLUTION
Avatar of David Todd
David Todd
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mossmis
mossmis

ASKER

The error was not in the case statement, I was missing a comma in the previous sections and Toad was erroring out at this location. Everything OK now. Thanks!