oracle-databasedb2ora-00936

"ORA-00936: missing expression" on DATE


at work we're undergoing a migration from DB2 for iSeries SQL to Oracle SQL and are experiencing some pains. I'd still consider myself a beginner with SQL and can't figure out what Oracle SQL doesn't like about this clause.

  CASE 
        WHEN YYCOL IS NULL THEN NULL 
        ELSE max ( DATE ( MMCOL || '/' || DDCOL || '/' || YYCOL ) ) 
  END AS COLUMN007 

When querying with the above clause:

ORA-00936: missing expression
            ELSE max ( DATE ( MMCOL || '/' || DDCOL || '/' || YYCOL ) ) 
                       ^

If possible, is there some easy to digest documentation for moving from DB2 for iSeries SQL to Oracle SQL? Any help is appreciated!


Solution

  • You have to use -

    CASE 
            WHEN YYCOL IS NULL THEN NULL 
            ELSE max ( TO_DATE ( MMCOL || '/' || DDCOL || '/' || YYCOL, 'MM/DD/YY' ) ) 
      END AS COLUMN007