Oracle Conditional statement/Loop statement ____oracle

Source: Internet
Author: User
An IF.. THEN
IF condition THEN
Statements 1;
Statements 2;
....
End IF;

Two IF.. THEN ... ELSE
IF condition THEN
Statements 1;
Statements 2;
....
ELSE
Statements 1;
Statements 2;
....
End IF;

Three IF.. THEN.. elsif
IF Condition1 THEN
Statement1;
elsif Condition2 THEN
Statement2;
elsif Condition3 THEN
Statement3;
ELSE
STATEMENT4;
End IF;

Four LOOP
The statements between the loop and end loop are executed infinitely.
LOOP
statements;
End LOOP;
This is obviously not going to work, you must use the Exit statement to force the loop to end.
Two ways, 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;

Five while. LOOP
x:=100;
While x<=1000 loop
x:=x+10;
End LOOP;
Y=x;

Six for ... LOOP
For counter in [REVERSE] Start_range....end_range LOOP
statements;
End LOOP;
Where count is an implicitly-declared variable, the initial value is Start_range

Seven GOTO
When you execute a goto statement, you immediately go to the statement labeled by the label.

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.