sql 绑定变量问题

来源:互联网 发布:小刀网源码 编辑:程序博客网 时间:2024/04/28 03:16
SQL> create table T_BUSINESS_DATA(user_id number(16),status varchar2(2),oper_date date);select * from T_BUSINESS_DATA t where 1=1 and t.APP_USER_ID=:userId and t.STATUS <> 1 order by t.operDate descSQL> variable userId number; SQL> exec :userId := 1;PL/SQL procedure successfully completed.select *  from T_BUSINESS_DATA t where 1 = 1   and t.user_id = :userId   and t.STATUS <> 1  order by t.oper_date descSQL> select distinct user_id from T_BUSINESS_DATA;   USER_ID---------- 1      2222       999 310select *  from T_BUSINESS_DATA t where 1 = 1   and t.user_id = :userId   and t.STATUS <> 2  order by t.oper_date desc;  select *  from T_BUSINESS_DATA t where 1 = 1   and t.user_id = :userId   and t.STATUS <> 3  order by t.oper_date desc;   select *  from T_BUSINESS_DATA t where 1 = 1   and t.user_id = :userId   and t.STATUS <> 4 order by t.oper_date desc; select *  from T_BUSINESS_DATA t where 1 = 1   and t.user_id = :userId   and t.STATUS <> 5 order by t.oper_date desc;   SQL_TEXTSQL_IDEXECUTIONS1  select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 4  order by t.oper_date desc2kykjpbwrbmxr12 select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 3  order by t.oper_date desc8wqactbjt4vr513 select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 5  order by t.oper_date desc9x1nbtnky71hd24select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 1  order by t.oper_date desc03cr9uphjkkct15select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 2  order by t.oper_date desc86y3ddg9wzhg116select *   from T_BUSINESS_DATA t  where 1 = 1    and t.user_id = :userId    and t.STATUS <> 4  order by t.oper_date desca2f1chc53b5nq17select sql_text, sql_id, a.executions   from v$sql a  where a.parsing_schema_name = 'TEST'  and sql_text like '%oper_date%'  order by 1,last_active_time desc 1dwfvvkxmqn955有5种状态,就会在内存里存在5条sql cursor,这里不需要使用绑定变量。

原创粉丝点击