【发布时间】:2014-06-24 08:57:31
【问题描述】:
如何在 PL/SQL 中查询类似的内容?
declare
l_batch_type number := 1;
select
*
from table t
where
case
when l_batch_type = 1 then ('A', 'B')
when l_batch_type = 2 then ('C', 'D')
when l_batch_type = 3 then ('E', 'F')
when l_batch_type is null then null end in t.batch_type;
我收到 SQL 错误:ORA-00907:缺少右括号 ('X','Y') 值和运算符显然有问题, 但我不知道如何匹配正确的语法。
谢谢!
【问题讨论】:
-
您实际上想用
('A', 'B')实现什么?检查 batch_type 是否是其中之一?