oracle的脚本语言是什么意思,Oracle中的sql脚本语言中的循环语句介绍
--sql腳本語(yǔ)言的循環(huán)介紹:
--1.goto循環(huán)點(diǎn)。
declare
x number;
begin
x:=0;--變量初始化;
<>--設(shè)置循環(huán)點(diǎn)。
x:=x+1;
dbms_output.put_line(x);--循環(huán)體
if x<9 then??????????? --進(jìn)入循環(huán)的條件。
goto repeat_loop;?? --用goto關(guān)鍵字引導(dǎo)進(jìn)入循環(huán)。
end if;
end;
--2.for循環(huán)。
declare
x number;
begin
x:=1;
--reverse 是指從大到小取值。
for x in? reverse 1 .. 10 loop?? --設(shè)定x變量取值范圍在1到10之間。for關(guān)鍵字提供進(jìn)入循環(huán)的條件,loop關(guān)鍵字開(kāi)始循環(huán)。
dbms_output.put_line('x='||x);
end loop;
dbms_output.put_line('end loop x='||x);
end;
--3.while循環(huán)。
declare
x number;
begin
x:=0;
while x<9 loop?? --while關(guān)鍵字提供循環(huán)的條件。loop關(guān)鍵字開(kāi)始循環(huán)。
x:=x+1;
dbms_output.put_line('x='||x);
end loop;
dbms_output.put_line('end loop x='||x);
end;
--4.loop循環(huán)。
declare
x number;
begin
x:=0;
loop
x:=x+1;
exit when x>9;? --終止循環(huán)的條件。
dbms_output.put_line('x='||x);
end loop;
dbms_output.put_line(' end loop x='||x);
end;
總結(jié)
以上是生活随笔為你收集整理的oracle的脚本语言是什么意思,Oracle中的sql脚本语言中的循环语句介绍的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 下代IPC性能追上Zen3 国产CPU龙
- 下一篇: 2.Building Models fr