Oracle-如果变量可以为空,可以将绑定变量放入In()子句中 [英] Oracle - Can A Bind Variable Be Put In In() Clause If The Variable Can Be Empty
本文介绍了Oracle-如果变量可以为空,可以将绑定变量放入In()子句中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Oracle
中,如果绑定变量可以为空,可以将其放在IN()
子句中吗?问,因为在SQL中Oracle是否看到IN()
中没有任何数据,它显示错误
In Oracle
, can a bind variable be put in IN()
clause if it can be empty? Asking because in the SQL if Oracle see IN()
without any data in it, it shows error
ORA-00936: missing expression.
未能提及无法使用PL/SQL ...
Failed to mention that no PL/SQL can be used...
Edit2:还没有提到该变量的格式为1,2,3或为空字符串.空字符串不能替换为NULL.
Also failed to mention that the variable is either in format 1,2,3 or empty string. The empty string cannot be replaced with NULL.
推荐答案
似乎正在起作用:
declare
l_statement varchar2(32767);
begin
l_statement := 'select * from user_tables where table_name in (:a)';
execute immediate l_statement
using '';
end;
这篇关于Oracle-如果变量可以为空,可以将绑定变量放入In()子句中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文