Oracle - Can A Bind Variable Be Put In In() Clause If The Variable Can Be Empty

随声附和 提交于 2019-12-02 03:58:09

Seems to be working:

declare

   l_statement varchar2(32767);

begin
   l_statement := 'select * from user_tables where table_name in (:a)';

   execute immediate l_statement
      using '';

end;

You can do it, it will be syntactically correct. I hope you are aware that NULL is not equal to anything even to NULL (so NULL=NULL is not TRUE but NULL), it can cause unexpected results in your query, so consider using NVL function if it doesn't affect performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!