您好,登錄后才能下訂單哦!
最近初步接觸了達(dá)夢數(shù)據(jù)庫(DM7),
SQL的語法和oracle極為類似。
--if語句:if elsif else and if
Declare
p_int int;
Begin
p_int := 1;
If p_int= 1 then
Print ('AA');
Elsif p_int= 2 then
Print ('BB');
Else
Print ('CC');
End if;
Exception when others then
Null;
End;
/
--循環(huán)寫法1: for循環(huán)
declare
Begin
For i in 1 .. 10 loop
Print(i);
End loop;
End;
/
--循環(huán)寫法2: while loop循環(huán)
declare
pn number;
begin
pn := 10 ;
while pn >0 loop
pn := pn - 1;
if pn = 5 then
return;
else
dbms_output.put_line('pn:'||pn);
end if;
end loop;
end;
/
--循環(huán)寫法3:loop and loop循環(huán)
declare
pn number;
begin
pn :=0;
loop
pn := pn +1;
exit when pn >10 ;
end loop;
dbms_output.put_line('pn:'||pn);
end;
/
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。