10 Replies Latest reply on Jan 27, 2012 12:07 PM by Sudheendra-Oracle

    Pro*C case statement compiling error


      When I try to compile this statement in my pro*c program:

                     EXEC SQL
                          SELECT CASE WHEN (SELECT COUNT(*) FROM COBROS_RECIBO)=1 THEN sysdate END
                          INTO :gc_cbcc0910_Fech_Cobro_VErr
                          FROM DUAL;

      the error below is submitted:

           Pro*C/C++: Release - Production on Wed Jan 11 18:59:31 2012

           Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

           System default option values taken from: /opt/oracle9.2/precomp/admin/pcscfg.cfg

           Syntax error at line 2196, column 30, file /soflib00/user/ocob00/fuentes/batch/cobros/src/CBCC0910.pc:
           Error at line 2196, column 30 in file /soflib00/user/ocob00/fuentes/batch/cobros
                                                   SELECT CASE WHEN (SELECT COUNT(*) FROM DUAL)=1 T
           HEN sysdate END
           PCC-S-02201, Encountered the symbol "COUNT" when expecting one of the following:

           , = ( ) * < > + - / . @ ^= | != <= >= <> at, not, between,
           in, is, like, day, hour, minute, month, second, year,
           The symbol "," was substituted for "COUNT" to continue.

      However I can run this statement in sqlplus fine:

                          SELECT CASE WHEN (SELECT COUNT(*) FROM DUAL)=1 THEN sysdate END
                          FROM DUAL;

      Why does the precompiler error occurs?

      Thanks in advance,
      Jose Luis