欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解Oracle數(shù)據(jù)庫(kù)各類(lèi)控制語(yǔ)句的使用

 更新時(shí)間:2015年09月02日 11:47:24   投稿:lijiao  
本文我們主要介紹了Oracle數(shù)據(jù)庫(kù)中各種控制語(yǔ)句的使用,包括邏輯控制語(yǔ)句、Case when的使用、While的使用以及For的使用等,希望本次的介紹能夠?qū)δ兴斋@!

Oracle數(shù)據(jù)庫(kù)各類(lèi)控制語(yǔ)句的使用是本文我們主要要介紹的內(nèi)容,包括一些邏輯控制語(yǔ)句、Case when的使用、While的使用以及For的使用等等,接下來(lái)我們就開(kāi)始一一介紹這部分內(nèi)容,希望能夠?qū)δ兴鶐椭?/p>

Oracle 中邏輯控制語(yǔ)句 

If elsif else end if  
set serverout on;  
declare per_dep_count number;  
begin  
select count(*) into per_dep_count from emp;  
if per_dep_count>0 then  
dbms_output.put_line('Big Than 0');  
elsif per_dep_count>5 then <span style="font-size:24px;color:#ff0000;"><strong>--elsif not elseif!!!!   
</strong></span>        dbms_output.put_line('Big Than 5');  
else  
dbms_output.put_line('En?');  
end if;  
end; 

 Case when 的使用的兩種方式  :

第一種使用方式

declare per_dep_count number;  
begin  
select count(*) into per_dep_count from emp;  
case per_dep_count  
when 1 then  
dbms_output.put_line('1');  
when 2 then  
dbms_output.put_line('2');  
else  
dbms_output.put_line('else');  
end case;  
end;  

第二種使用方式

declare per_dep_count number;  
begin  
select count(*) into per_dep_count from emp;  
case   
when per_dep_count=1 then  
dbms_output.put_line('1');  
when per_dep_count=2 then  
dbms_output.put_line('2');  
else  
dbms_output.put_line('else');  
end case;  
end;  

While 的使用 

declare v_id number:=0;  
begin  
while v_id<5 loop  
v_idv_id:=v_id+1;  
dbms_output.put_line(v_id);  
end loop;  
end;  

For的使用 

declare v_id number:=0;  
begin  
for v_id in 1..5 loop  
dbms_output.put_line(v_id);  
end loop;  
end; 

關(guān)于Oracle數(shù)據(jù)庫(kù)各類(lèi)控制語(yǔ)句的使用就介紹到這里了,希望本次的介紹能夠?qū)δ兴斋@!

相關(guān)文章

最新評(píng)論