Oracle Condition Statement/loop statement

Source: Internet
Author: User
1 If... then
If condition then
Statements 1;
Statements 2;
....
End if;

2. If... then... else
If condition then
Statements 1;
Statements 2;
....
Else
Statements 1;
Statements 2;
....
End if;

3. If... then... elsif
If condition1 then
Statement1;
Elsif condition2 then
Statement2;
Elsif condition3 then
Statement3;
Else
Statement4;
End if;

Four Loop
The statements between loop and end loop are executed infinitely.
Loop
Statements;
End loop;
This is obviously not feasible. You must use the exit statement to force the loop to end.
Two Methods: first,
X: = 100;
Loop
X: = x + 10;
If X> 1000 then
Exit;
End if
End loop;
Y: = X;
Second,
X: = 100;
Loop
X: = x + 10;
Exit when x> 1000;
X: = x + 10;
End loop;
Y: = X;

5 while... loop
X: = 100;
While x <= 1000 Loop
X: = x + 10;
End loop;
Y = X;

6. For... loop
For counter in [reverse] start_range... end_range Loop
Statements;
End loop;
Here, count is an implicitly declared variable, and the initial value is start_range.

7goto
When the GOTO statement is executed, the tag-marked statement is immediately transferred.

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.