備注:此兩種方案,都因為oracle內部字符函數的參數長度4000限制。
另外,個人測試,性能不如”將數據插入物理表再JOIN查詢“或”每1000次ID做一次IN查詢“的總的運行速度。
create or replace procedure p_getData_byMultiValue ( v_id_list in varchar2, v_cursor out sys_refcursor ) is begin open v_cursor select * from THE ( select cast( in_list(v_id_list) as -- select cast( in_list('abc, xyz, 012') as mytableType ) from dual ) a; open v_cursor select * from T1 ( select cast( in_list(v_id_list) as -- select cast( in_list('abc, xyz, 012') as mytableType ) from dual ) t2 where t1.ID = t2.COLUMN_VALUE ); end p_getData_byMultiValue; http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425