Oracle PL / SQL查询无法编译

时间:2015-02-05 12:52:41

标签: oracle plsql

谁能告诉我为什么这不会编译?我得到了一个“失踪的表情”#39;错误:

execute immediate  'select CASE WHEN EXISTS ( SELECT 1 from samples where samplecode = :samplecode  and auditflag = 0 and ' || varFilterString || ') then 1 else 0 end  from DUAL'
into varResult
using varSampleCode;

假设所有变量都已正确声明。

TIA

1 个答案:

答案 0 :(得分:2)

execute immediate  'select  count(1) from DUAL
                      where EXISTS
                       ( SELECT 1 from samples
                        where samplecode = :sample code
                          and auditflag = 0 
                          and ' || varFilterString || ')'
into varResult
using varSampleCode;