国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

關(guān)于游標(biāo)的一點發(fā)現(xiàn)

2024-07-21 02:40:15
字體:
供稿:網(wǎng)友

昨天在寫存儲過程的時候發(fā)現(xiàn)了一個以前忽視了的地方,不知道對大家有沒有用。
創(chuàng)建顯性游標(biāo):
create or replace PRocedure test 
is 
cursor test1 is select name from devp;
test2 devp.name%type;
begin
open test1;
loop
fetch test1 into test2;
dbms_output.put_line(test2); --注重,此處用的是test2變量
exit when test1%notfound;
end loop; 
close test1;
end;
/

create or replace procedure test 
is 
cursor test1 is select name from devp;
test2 test1%rowtype;
begin
open test1;
loop
fetch test1 into test2;
dbms_output.put_line(test2.name); --注重,此處用的是test2.name
exit when test1%notfound;
end loop;
close test1;
end;
/


下面用隱性游標(biāo)試一下:
create or replace procedure test 
is 
cursor test1 is select name from devp;
test2 devp.name%type;
begin
for test2 in test1 loop
dbms_output.put_line(test2.name); --注重,此處用的是test2.name
end loop;
end;
/

create or replace procedure test 
is 
cursor test1 is select name from devp;
test2 test1%rowtype;
begin
for test2 in test1 loop
dbms_output.put_line(test2.name); --注重,此處用的是test2.name
end loop;
end;
/

由于使用的游標(biāo)的不同,我們最終在使用變量的時候還是有一些小區(qū)別的。希望大家以后在調(diào)代碼的時候少走彎路。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 策勒县| 家居| 巩义市| 中牟县| 牙克石市| 开江县| 冷水江市| 丰宁| 三河市| 邹平县| 客服| 崇仁县| 永修县| 庆元县| 怀远县| 黔江区| 和政县| 丹凤县| 宽甸| 海城市| 安仁县| 铜山县| 兴安县| 无锡市| 定边县| 抚顺市| 鄂托克前旗| 石城县| 从江县| 清涧县| 和田市| 连山| 黄大仙区| 军事| 邯郸县| 五家渠市| 汝州市| 澄迈县| 汉阴县| 巨鹿县| 玉门市|