动态SQL select into语句报错

oracle动态SQL里不能直接写:

dynamicCSRQSQL:='  SELECT count(1) CSRQISNULL into CSRQ_NULL FROM WJW_POPULATION_'||table_suffix||' t 

 WHERE NVL(csrq,TO_DATE("1000/1/1","YYYY/MM/DD"))=TO_DATE("1000/1/1","YYYY/MM/DD")';
Execute immediate  dynamicCSRQSQL;

正确的写法是:

dynamicCSRQSQL:='  SELECT count(1) CSRQISNULL  FROM WJW_POPULATION_'||table_suffix||' t 

 WHERE NVL(csrq,TO_DATE("1000/1/1","YYYY/MM/DD"))=TO_DATE("1000/1/1","YYYY/MM/DD")';

 Execute immediate  dynamicCSRQSQL into CSRQ_NULL;

 

你可能感兴趣的:(select into)