Skip to main content

This works in Oraedit, but now I'm trying to add it to cobol (as embedded) and can't even get it to compile...  


    EXEC SQL
        SELECT case   
            when TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =  
                 TO_CHAR(SYSDATE,'MM-DD-YYYY')
              and C.STARTTIME <= to_char(sysdate,'HH24:MI')     
                 and C.STOPTIME  >= to_char(sysdate,'HH24:MI')
               then  'TRUE'
               ELSE 'FALSE'
      END HOLIDAY
           from dual a, HOLIDAY C  
                where TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =
                      TO_CHAR(SYSDATE,'MM-DD-YYYY')
     END-EXEC.   
    
2 cobch0803 000400 encountered the symbol "then" when expecting one of the following:

1 cobch0149 no sql directives have been set


#SQLSELECTCASE

This works in Oraedit, but now I'm trying to add it to cobol (as embedded) and can't even get it to compile...  


    EXEC SQL
        SELECT case   
            when TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =  
                 TO_CHAR(SYSDATE,'MM-DD-YYYY')
              and C.STARTTIME <= to_char(sysdate,'HH24:MI')     
                 and C.STOPTIME  >= to_char(sysdate,'HH24:MI')
               then  'TRUE'
               ELSE 'FALSE'
      END HOLIDAY
           from dual a, HOLIDAY C  
                where TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =
                      TO_CHAR(SYSDATE,'MM-DD-YYYY')
     END-EXEC.   
    
2 cobch0803 000400 encountered the symbol "then" when expecting one of the following:

1 cobch0149 no sql directives have been set


#SQLSELECTCASE

What SQL precompiler are you using, OpenESQL or Pro*COBOL? This code is Oracle PL/SQL code and will not be recognized by OpenESQL as being valid. I am not sure if it is supported by Pro*COBOL but it isn't clear to me what this statement would be returning to your program as there are no host variables included in the statement.