DBMS_OUTPUT.PUT_LINE('工资低于10000');ELSEIF10000<= v_salaryANDv_salary <20000THEN DBMS_OUTPUT.PUT_LINE('工资在10000到20000之间');ELSEDBMS_OUTPUT.PUT_LINE('工资高于20000'); ENDIF; ENDIF; END; 2、CASE语句 CASE语句语法: CASE variable_name WHEN case1 THEN statement1; WHEN case2 THEN sta...
今天,写存储过程时写成了:if...then...else if...else...end if.能编译通过,但是有问题,后来实在是找不到问题怀疑写错了这个语句,后来在网上查了一下,结果不是else if 而是elsif.改过来后就正常了。 Oracle/PLSQL: IF-THEN-ELSE Statement There are three different syntaxes for these types of stateme...
ELSE {...statements...} END IF; Syntax #3: IF-THEN-ELSIF IF condition THEN {...statements...} ELSIF condition THEN {...statements...} ELSE {...statements...} END IF; Here is an example of a function that uses the IF-THEN-ELSE statement: CREATE OR REPLACE Function IncomeLevel (...
CASEvariableWHENvalue1THENstatements1;WHENvalue2THENstatements2; ……WHENvaluenTHENstatementsn;[ELSE else_statements;]ENDCASE; 例子: declarev_scorenumber:=&成绩;begincasev_scorewhen1thendbms_output.put_line('星期一');when2thendbms_output.put_line('星期二');when3thendbms_output.put_line('星期...
在IF-THEN 语句序列之后可以是 ELSE 语句的可选序列,它们在条件为 FALSE 时执行。 IF-THEN-ELSE - 语法 语法for the IF-THEN-ELSE statement is - IF condition THEN S1; ELSE S2; END IF; 1. 2. 3. 4. 5. 其中, S1 和 S2 是不同的语句序列。在 IF-THEN-ELSE语句中,当测试条件为TRUE时,执行...
在PL/SQL 上下文中,可以使用 IF 语句来根据特定条件执行 SQL 语句。 IF 语句的四种格式是: IF...THEN...END IF IF...THEN...ELSE...END IF IF...THEN...ELSE IF...END IF IF...THEN...ELSIF...THEN...ELSE...END IF IF...THEN...END IF ...
控制结构在程序中就是一种程序运行的逻辑,一般情况下有顺序结构,选择结构,循环结构。PL/SQL控制结构也是由上述的3种逻辑结构组成,往往由以下几个语句来实现。 1、IF条件语句 IF语句的语法: 代码语言:javascript 复制 IFcondition1THENstatement1;ELSIFcondition2THENstatement2;ELSEstatement3;ENDIF; ...
8 shell if elif else 2019-12-19 18:59 −if 语句的判断条件,从本质上讲,判断的就是命令的退出状态。 语句语句格式同一行书写注意点用例1用例2 if 语句 if conditionthen statement(s)fi if condition; then statement(s... 声声慢43 0 587
Use the IF statement within PL/SQL contexts to execute SQL statements on the basis of certain criteria. The four forms of the IF statement are: IF...THEN...END IF IF...THEN...ELSE...END IF IF...THEN...ELSE IF...END IF
2) PL/pgSQL if-then-else statement The if...then...else statement executes the statements in the if branch if the condition evaluates to true; otherwise, it executes the statements in the else branch. Here’s the syntax of the if...then...else statement: if condition then statements;...