代码: 
sprintf(strSql,"SELECT  count(*) FROM a_table where a_table.a1='%s','1'); 
EXEC SQL PREPARE s_pre FROM :strSql; 
EXEC SQL EXECUTE s_pre INTO :lCount; EXEC SQL DEALLOCATE PREPARE s_pre; 这行报错: PCC-S-02201, Encountered the symbol "PREPARE" when expecting one of the followin 
g:  descriptor, 
去掉报错行  编译可以过 但是没有释放资源,怕有问题!!!! 
急需高手解决。 因为类似的代码很多,所以写动态sql的时候,没用游标那种方法(闲打开关闭游标麻烦,,偷懒~~~)

解决方案 »

  1.   

    楼主语法不对。
    DEALLOCATE DESCRIPTOR
    PurposeUse this statement to deallocate a SQL descriptor area that has been previously allocated, to free memory. This statement is only used for the ANSI dynamic SQL.
    SyntaxEXEC SQL DEALLOCATE DESCRIPTOR [GLOBAL | LOCAL] {:desc_nam | string_literal} ;而且使用前要allocate descriptor参照:
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a97269/pc_14ady.htm
      

  2.   

    下面这句好像有问题:
    sprintf(strSql,"SELECT  count(*) FROM a_table where a_table.a1='%s','1');