------解决方案--------------------
再补充下, 直接在窗口中执行sql和你的动态sql执行,很长的sql, 执行计划10有8,9是不一样的,因为他们解析本来就是不同的,尤其是一些写法更可能会导致动态sql执行很慢, 比如拼接字符串之类的,in("......")等等
------解决方案-------------------- 1. before you set the v_sqlcmd, insert the data of sa_num stringarray into a middle table: mid_num(num varchar2(20)); i think the data volume is very small, so you don't need to create index on the middle table.
2. modify your v_sqlcmd like: v_sqlcmd := 'select a.* from voice a, mid_num a where a.begintime between :1 and :2 and a.num = b.num';