我想使用运算符比较值(VARCHAR2
与列表中的值之一)IN
。例如,值是 A,列表值是 B 和 C。值是
有效的简单静态代码:
IF 'A' NOT IN ('B', 'C') THEN
DBMS_OUTPUT.PUT_LINE('Not');
ELSE
DBMS_OUTPUT.PUT_LINE('In');
END IF;
非工作动态代码:
IF 'A' NOT IN ( SELECT COLUMN_VALUE FROM APEX_STRING.SPLIT('B:C', ':') ) THEN
DBMS_OUTPUT.PUT_LINE('Not');
ELSE
DBMS_OUTPUT.PUT_LINE('In');
END IF;
出现错误:
Error at line 39/48: ORA-06550: line 20, column 67:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
. ) , @ with <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus partition start subpartition union where connect sample
The symbol "having" was substituted for "(" to continue.
无法理解哪里出错了。在 SQL 查询中,类似的带有IN
运算符的代码可以工作。