Highlighted
Super Contributor.
Super Contributor.
984 views

Select Case

Jump to solution

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

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Select Case

Jump to solution

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.

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Select Case

Jump to solution

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.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.