ORACLE PL/SQL Instance refinement fourth conditional control: if statement

Source: Internet
Author: User
Tags reserved

4.1 IF Statement

IF statement two forms; If-then if-then-else using If-then, you can specify a set of actions that need to be performed. If-then-else statement specifies two sets of actions

1. If-then true to execute a statement sequence

Structure:

IF CONDITION Then

STATEMENT 1;

.......

STATEMENT N;

END IF;

2. If-then-else statements

If-then specifies that a sequence of statements is required when the current condition evaluates to True. When the condition evaluates to False, no special activity is taken, just to continue the execution of the program, using the If-then-else statement to specify two sets of statements. The condition evaluates to true, executing a set when the condition is false and another set of

Structure:

IF CONDITION Then

STATEMENT 1;

ELSE

STATEMENT 2;

END IF;

STATEMENT 3;

3. Null condition: In some cases, the only condition evaluated in the IF statement may be NULL instead of true or false. For the if-then structure, the specified statement is not executed if the related condition evaluates to NULL. Executes the first executable statement after the end if, for the If-then-else statement, the statement formulated by the reserved word else is executed when the related condition evaluates to NULL.

4. ElseIf statements

ElseIf structure

IF Conditiono 1 Then

STATEMENT 1;

ELSEIF CONDITION 2 Then

STATEMENT2;

ELSEIF CONDITION 3THEN

STATEMENT3;

....

ELSE

STATEMENT N;

END IF;

The reserved word if identifies the ElseIf structure to begin with. Condidtion 1 to Condidtion N is a series of conditions in which the structure evaluates to TRUE or false, and these conditions are mutually exclusive. In other words, if Condidtion 1 evaluates to TRUE, statement 1 is executed, and the execution control goes to the first executable statement after the reserved word end If. The rest of the ElseIf structure is ignored. When the result of Condidtion 1 is false, the execution goes back to the ElseIf section. ElseIf statements can contain any number of elseif clauses

4.3 Nested IF statements

ORACLE PL/SQL Instance refinement fourth conditional control: if statement

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.