Oracle BULK COLLECT批量取資料解決方案

來源:互聯網
上載者:User

複製代碼 代碼如下:-- Created on 2010/11/04 by WANGNAN
declare
-- Local variables here
i integer;
TYPE t_table IS TABLE OF VARCHAR2(10 ) INDEX BY VARCHAR2 (2);
v_t_table t_table;

TYPE t_pg3 IS TABLE OF asis.PG3_AGENTCD_CONVERSION% ROWTYPE;
v_pg3_table t_pg3;

c_pg3_vendor com.cRef;
v_str VARCHAR2( 250);
begin
-- Test statements here
OPEN c_pg3_vendor FOR SELECT * FROM asis.PG3_AGENTCD_CONVERSION;

FETCH c_pg3_vendor BULK COLLECT INTO v_pg3_table;
FOR i IN 1 .. v_pg3_table.count LOOP
v_t_table(v_pg3_table(i).ASIS_AGENT_CD) := v_pg3_table(i).TOBE_VENDOR_CD;
END LOOP;

v_str := v_t_table.first;
WHILE v_str is NOT NULL LOOP
dbms_output.put_line(v_str || ' : ' ||v_t_table(v_str));
v_str := v_t_table.next(v_str);
END LOOP;

EXCEPTION WHEN OTHERS THEN
dbms_output.put_line( sqlerrm);
END;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.