熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Oracle BULK COLLECT批量取數據解決方法

2022-06-13   來源: Oracle 

  復制代碼 代碼如下:

   Created on // by WANGNAN
declare
Local variables here
i integer;
TYPE t_table IS TABLE OF VARCHAR( ) INDEX BY VARCHAR ();
v_t_table t_table;

TYPE t_pg IS TABLE OF asisPG_AGENTCD_CONVERSION% ROWTYPE;
v_pg_table t_pg;

c_pg_vendor comcRef;
v_str VARCHAR( );
begin
Test statements here
OPEN c_pg_vendor FOR SELECT * FROM asisPG_AGENTCD_CONVERSION;

FETCH c_pg_vendor BULK COLLECT INTO v_pg_table;
FOR i IN unt LOOP
v_t_table(v_pg_table(i)ASIS_AGENT_CD) := v_pg_table(i)TOBE_VENDOR_CD;
END LOOP;

v_str := v_t_tablefirst;
WHILE v_str is NOT NULL LOOP
dbms_outputput_line(v_str || : ||v_t_table(v_str));
v_str := v_t_tablenext(v_str);
END LOOP;

EXCEPTION WHEN OTHERS THEN
dbms_outputput_line( sqlerrm);
END;


From:http://tw.wingwit.com/Article/program/Oracle/201404/30547.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.