【问题标题】:Oracle PL/SQL query does not compileOracle PL/SQL 查询无法编译
【发布时间】:2015-02-05 12:52:40
【问题描述】:

谁能告诉我为什么这不会编译?我收到“缺少表达式”错误:

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

【问题讨论】:

  • 检查您的 varFilterString ,它可能格式错误。具体来说,它可能是 Null。
  • Oracle query won't compile 的可能重复项

标签: oracle plsql


【解决方案1】:
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;

【讨论】:

  • 谢谢,编译成功了。
猜你喜欢
  • 1970-01-01
  • 2012-10-26
  • 1970-01-01
  • 2012-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-12
  • 1970-01-01
相关资源
最近更新 更多