婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > oracle下巧用bulk collect實現(xiàn)cursor批量fetch的sql語句

oracle下巧用bulk collect實現(xiàn)cursor批量fetch的sql語句

熱門標(biāo)簽:百變地圖標(biāo)注 廣州市400電話辦理 南通防封外呼系統(tǒng)運營商 語音電話機器人營銷方案 宜賓外呼系統(tǒng)廠家 地圖標(biāo)注原件 語音電話機器人缺點 淮安自動外呼系統(tǒng)開發(fā) 修改高德地圖標(biāo)注
在一般的情況下,使用批量fetch的幾率并不是很多,但是Oracle提供了這個功能我們最好能熟悉一下,說不定什么時候會用上它。 


復(fù)制代碼 代碼如下:

declare 
cursor c1 is select * from t_depart; 
v_depart t_depart%rowtype ; 
type v_code_type is table of t_depart.depart_code%type ; 
v_code v_code_type ; 
type v_name_type is table of t_depart.depart_name%type ; 
v_name v_name_type ; 
begin 
open c1; 
fetch c1 bulk collect into v_code , v_name ; 
for i in 1..v_code.count loop 
dbms_output.put_line(v_code(i)||' '||v_name(i)); 
end loop;  
close c1;  
end; 

通過上面的這個列子大家可以發(fā)現(xiàn)如果列很多的話,為每一列定義一個集合似乎有些繁瑣,可以把集合和%rowtype結(jié)合起來一起使用簡化程序! 
復(fù)制代碼 代碼如下:

declare 
cursor c1 is select * from t_depart; 
type v_depart_type is table of t_depart%rowtype ; 
v_depart v_depart_type ; 
begin 
open c1; 
fetch c1 bulk collect into v_depart ; 
for i in 1..v_depart.count loop 
dbms_output.put_line(v_depart(i).depart_code||' '|| 
v_depart(i).depart_name); 
end loop;  
close c1;  
end; 

在輸出結(jié)果時既可以使用集合的count屬性和可以使用first和last,在引用%rowtype類型的內(nèi)容時還有一個需要注意的地方是v_depart(i).depart_code,而不是v_depart.depart_code(i),當(dāng)然沒有這樣的寫法,即使有意義也并不一樣。  
復(fù)制代碼 代碼如下:

declare 
cursor c1 is select * from t_depart; 
type v_depart_type is table of t_depart%rowtype ; 
v_depart v_depart_type ; 
begin 
open c1; 
fetch c1 bulk collect into v_depart ; 
for i in v_depart.first..v_depart.last loop 
dbms_output.put_line(v_depart(i).depart_code||' '|| 
v_depart(i).depart_name); 
end loop;  
close c1;  
end; 
 
您可能感興趣的文章:
  • Oracle BULK COLLECT批量取數(shù)據(jù)解決方法
  • Oracle數(shù)據(jù)庫中的級聯(lián)查詢、級聯(lián)刪除、級聯(lián)更新操作教程
  • Oracle批量查詢、刪除、更新使用BULK COLLECT提高效率

標(biāo)簽:嘉峪關(guān) 池州 通化 襄陽 股票投資 聊城 南平 南平

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《oracle下巧用bulk collect實現(xiàn)cursor批量fetch的sql語句》,本文關(guān)鍵詞  oracle,下,巧用,bulk,collect,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《oracle下巧用bulk collect實現(xiàn)cursor批量fetch的sql語句》相關(guān)的同類信息!
  • 本頁收集關(guān)于oracle下巧用bulk collect實現(xiàn)cursor批量fetch的sql語句的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 松溪县| 库尔勒市| 类乌齐县| 孟州市| 安仁县| 隆德县| 济宁市| 江油市| 安吉县| 馆陶县| 宽城| 安阳县| 醴陵市| 祥云县| 应用必备| 大洼县| 葫芦岛市| 绍兴市| 新兴县| 内乡县| 库尔勒市| 景宁| 大竹县| 金山区| 泰宁县| 常德市| 桃源县| 西充县| 兴隆县| 乌海市| 鄂托克前旗| 黑河市| 达孜县| 萝北县| 台南县| 邓州市| 江华| 保定市| 都江堰市| 修文县| 兰州市|