如果是相同的语句执行时间不一样 那就是有其他的会话抢占资源 如果 and t2.num_answer in (1,2,3)and t2.question_type=1299 输入的值不一样应该和数据量的大小及资源争用有关系
可以用如下方式绑定变量 and t2.num_answer in (&par1) and t2.question_type=&par2
SQL> select * from tt where id=1;ID NAME ---------- ---------------------------------------- 1 testSQL> select * from tt where id=2;ID NAME ---------- ---------------------------------------- 2 testSQL> variable i number; SQL> exec :i :=1;PL/SQL 过程已成功完成。SQL> select *from tt where id=:i;ID NAME ---------- ---------------------------------------- 1 testSQL> exec :i :=2;PL/SQL 过程已成功完成。SQL> select *from tt where id=:i;ID NAME ---------- ---------------------------------------- 2 testSQL> print i;I ---------- 2SQL> select sql_text,parse_calls from v$sql where sql_text like 'select * from t t where id=%';SQL_TEXT PARSE_CALLS ------------------------------------------------------------ ----------- select * from tt where id=2 1 select * from tt where id=1 1 select * from tt where id=:i 2 SQL>
如果
and t2.num_answer in (1,2,3)and t2.question_type=1299
输入的值不一样应该和数据量的大小及资源争用有关系
and t2.num_answer in (&par1)
and t2.question_type=&par2
---------- ----------------------------------------
1 testSQL> select * from tt where id=2;ID NAME
---------- ----------------------------------------
2 testSQL> variable i number;
SQL> exec :i :=1;PL/SQL 过程已成功完成。SQL> select *from tt where id=:i;ID NAME
---------- ----------------------------------------
1 testSQL> exec :i :=2;PL/SQL 过程已成功完成。SQL> select *from tt where id=:i;ID NAME
---------- ----------------------------------------
2 testSQL> print i;I
----------
2SQL> select sql_text,parse_calls from v$sql where sql_text like 'select * from t
t where id=%';SQL_TEXT PARSE_CALLS
------------------------------------------------------------ -----------
select * from tt where id=2 1
select * from tt where id=1 1
select * from tt where id=:i 2
SQL>
这有一篇文章 你看看
你可以百度一下