Oracle:PL/SQL--流程控制(一)——條件結構:if-then、if-then-else、if-then-elsif

—–流程控制(一)

—–條件結構
—–1、 if-then 語句

語法
if condition then
Statements
end if;

/*

if 條件 then
語句(條件成立執行該語句!)
end if;

*/

—–2、 if-then-else語句

語法
if condition then
Statements1
else
Statements2
end if;

/*

if 條件 then
語句1(條件成立執行語句1!)
else
語句2(否則,即條件不成立執行語句2!)
end if;

*/

—–3、 if-then-elsif語句

if condition1 then
Statements1
elsif condition2 then –注意是elsif而不是elseif
Statements2
else
Statements3
end if;

/*

if 條件1 then
語句1(條件1成立,執行語句1!)
elsif condition2 then
語句2(條件2,成立執行語句,2!)
else
語句3(否則,即條件不成立執行語句3!)
end if;

*/

/*

整體與if····else·······比較相似,不過具體細節地方需注意:
1、then
2、elsif
3、end if;

*/

發佈了57 篇原創文章 · 獲贊 67 · 訪問量 43萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章