-
光標(biāo)共有4個(gè)屬性 1.%found 2.%notfound 光標(biāo)的屬性以%開(kāi)頭 cursor c1 is select col from a open c1; fetch c1 into pename; close c1; 光標(biāo)屬性 %found %notfound --example set server output on declare cursor cemp is select name.sal from emp; 為光標(biāo)定義對(duì)應(yīng)的變量 pename emp.ename%type; psal emp.sal%type; begin open camp; loop fetch cemp into pename,pal; --when exit? fetch 不一定能取到記錄 exit when camp%notfound --光標(biāo)取不到值時(shí)退出循環(huán) dbms_output.put_line(pename||'的薪水是‘||psal'); end loop; close camp end查看全部
-
從光標(biāo)中去取值 1.打開(kāi)光標(biāo) Open C1;---打開(kāi)光標(biāo)執(zhí)行查詢 2.關(guān)閉光標(biāo) Close C1;---關(guān)閉光標(biāo)釋放資源查看全部
-
cursor is a result set查看全部
-
cursor的語(yǔ)法查看全部
-
循環(huán)范例查看全部
-
-------loop 循環(huán)------ while 循環(huán)條件 loop 循環(huán)體 end loop; loop enit when (條件) -- 滿足條件時(shí)推出 end loop; ------for 循環(huán)------ for i in 1..3 loop --必須是連續(xù)的 語(yǔ)句序列; end loop;查看全部
-
set serveroutput on --接收一個(gè)鍵盤輸入 --num:地址值,含義是:在該地址上保存了輸入的值 accept num prompt '請(qǐng)輸入一個(gè)數(shù)字'; declare --定義變量保存用戶從鍵盤輸入的數(shù)字 pnum number:= # begin if pnum = 0 then dbms_output.put_line('您輸入數(shù)字是0'); elsif pnum=1 then dbms_output.put_line('您輸入的是1'); elsif pnum=2 then dbms_output.put_line('您輸入的是2'); else dbms_output.put_line('其他數(shù)字'); end if; end; /查看全部
-
--接受一個(gè)鍵盤輸入 --一般鍵盤輸入的字母都是字符串,這里一定要輸入數(shù)字,不然會(huì)報(bào)字符轉(zhuǎn)換錯(cuò)誤 accept num prompt'請(qǐng)輸入一個(gè)數(shù)字' --接收鍵盤輸入地址num的值,prompt提示語(yǔ)句 delcare pnum number :=# --&地址符,pnum賦值給num地址的值查看全部
-
IF語(yǔ)句 if 條件 then 語(yǔ)句 ; elsif 語(yǔ)句 then 語(yǔ)句; else 語(yǔ)句 ; end if;查看全部
-
記錄型變量可以理解為數(shù)組,代表的是一行查看全部
-
賦值的兩種方式 1.用“:=”,my_name :=‘xxx’ 2.用into select name into my_name from tableName where No='1'查看全部
-
引用型變量:myname emp.ename%type; 記錄型變量:emp_rec emp%rowtype; 記錄型變量的引用:emp_rec.ename := 'ADAMS';查看全部
-
變量名在前面。類型在后面。查看全部
-
PL/SQL的程序結(jié)構(gòu)查看全部
-
不同數(shù)據(jù)庫(kù)下SQL擴(kuò)展查看全部
舉報(bào)
0/150
提交
取消