婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗瓚剿謗跺淕杅曹講腔湮苤﹝ 硒俴賦彆?褉?9.16垀尨﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=90;
number2 integer:=60;
begin
if number1>=number2 then
dbms_output.put_line(number1湮衾脹衾number2);
end if;
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
▽饜杶最唗弇离▼ㄩ菴9梒\ conditioncontrol1.sql﹝
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗瓚剿謗跺淕杅曹講腔湮苤ㄛ怀堤祥肮腔賦彆﹝硒俴賦彆?褉?9.18垀尨﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
begin
if number1>=number2 then
dbms_output.put_line(number1湮衾脹衾number2);
else
dbms_output.put_line(number1苤衾number2);
end if;
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
▽饜杶最唗弇离▼ㄩ菴9梒\ conditioncontrol2.sql﹝
3. ifИ杶沭璃諷秶
粒蚚ifИ杶沭璃諷秶腔逄楊賦凳?褉?9.19垀尨﹝
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗瓚剿謗跺淕杅曹講腔湮苤ㄛ怀堤祥肮腔賦彆﹝
硒俴賦彆?褉?9.20垀尨﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
begin
if number1<=number2 then
if number1=number2 then
dbms_output.put_line(number1脹衾number2);
else
dbms_output.put_line(number1苤衾number2);
end if;
else
dbms_output.put_line(number1湮衾number2);
end if;
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
▽饜杶最唗弇离▼ㄩ菴9梒\ conditioncontrol3.sql﹝
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗蔚number1曹講藩棒樓1ㄛ珨眻善脹衾number2峈砦ㄛ苀數怀堤悜遠棒杅﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
i integer:=0;
begin
loop
number1:=number1+1;
if number1=number2 then
exit;
else
i:=i+1;
end if;
end loop;
dbms_output.put_line(僕悜遠棒杅:||to_char(i));
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
硒俴賦彆?褉?9.22垀尨﹝
▽饜杶最唗弇离▼ㄩ菴9梒\loopcontrol1.sql﹝
2. loop..exit..when..end loop悜遠諷秶
粒蚚loop..exit..when..end loop悜遠諷秶腔逄楊賦凳迵芞9.21垀尨賦凳濬侔﹝
exit when妗暱奻憩眈絞衾
if 沭璃 then
exit;
end if;
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗蔚number1曹講藩棒樓1ㄛ珨眻善脹衾number2峈砦ㄛ苀數怀堤悜遠棒杅﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
i integer:=0;
begin
loop
number1:=number1+1;
i:=i+1;
exit when number1=number2;
end loop;
dbms_output.put_line(僕悜遠棒杅:||to_char(i));
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
硒俴賦彆?褉?9.23垀尨﹝
▽饜杶最唗弇离▼ㄩ菴9梒\loopcontrol2.sql﹝
when悜遠諷秶賦旰沭璃掀粒蚚if腔沭璃諷秶賦旰悜遠棒杅嗣1棒﹝
3. while..loop..end loop悜遠諷秶
粒蚚loop..exit..when..end loop悜遠諷秶腔逄楊?覤癒?
while 沭璃 loop
硒俴逄曆僇;
end loop;
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗蔚number1曹講藩棒樓1ㄛ珨眻善脹衾number2峈砦ㄛ苀數怀堤悜遠棒杅﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
i integer:=0;
begin
while number1<number2 loop
number1:=number1+1;
i:=i+1;
end loop;
dbms_output.put_line(僕悜遠棒杅:||to_char(i));
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
硒俴賦彆?褉?9.24垀尨﹝
▽饜杶最唗弇离▼ㄩ菴9梒\whilecontrol.sql﹝
4. for..in..loop..end悜遠諷秶
粒蚚for..in..loop..end悜遠諷秶腔逄楊?覤癒?
for 悜遠曹講 in [reverse] 悜遠狟賜..悜遠奻賜 loop
悜遠揭燴逄曆僇;
end loop;
婓▽SQLPlus Worksheet▼笢硒俴狟蹈PL/SQL最唗ㄛ蜆最唗籵徹悜遠曹講I懂諷秶number1崝樓棒杅ㄛ怀堤賦彆﹝硒俴賦彆?褉?9.25垀尨﹝
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
set serveroutput on
declare
number1 integer:=80;
number2 integer:=90;
i integer:=0;
begin
for i in 1..10 loop
number1:=number1+1;
end loop;
dbms_output.put_line(number1腔硉:||to_char(number1));
end;
求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求
▽饜杶最唗弇离▼ㄩ菴9梒\forcontrol.sql﹝