Oracle PL program process example

Source: Internet
Author: User

The following article describes how to control the actual application code lines of Oracle PL/SQL program flows, and the conditional control and cyclic control structures supported by PL/SQL. The following describes the main content of the article. The following describes the specific content,

Syntax and usage

 
 
  1. IF..THEN 

Syntax:

 
 
  1. IF condition THEN  
  2. Statements 1;  
  3. Statements 2;  
  4. ....  
  5. END IF  

The IF statement determines whether the condition is TRUE. IF yes, the statement after THEN is executed. IF the condition is false or NULL, the statement between THEN and end if is skipped, execute the statement after end if.

 
 
  1. IF..THEN...ELSE 

Syntax:

 
 
  1. IF condition THEN  
  2. Statements 1;  
  3. Statements 2;  
  4. ....  
  5. ELSE  
  6. Statements 1;  
  7. Statements 2;  
  8. ....  
  9. END IF  

IF the condition is TRUE, the statement between THEN and ELSE is executed. Otherwise, the statement between ELSE and end if is executed.

IF can be nested, you can use IF or IF. ELSE statements in IF or IF. ELSE statements.

 
 
  1. if (a>b) and (a>c) then  
  2. g:=a;  
  3. else  
  4. g:=b;  
  5. if c>g then  
  6. g:=c;  
  7. end if  
  8. end if   
  9. IF..THEN..ELSIF  
  10.  

Syntax:

 
 
  1. IF condition1 THEN  
  2. statement1;  
  3. ELSIF condition2 THEN  
  4. statement2;  
  5. ELSIF condition3 THEN  
  6. statement3;  
  7. ELSE  
  8. statement4;  
  9. END IF;  
  10. statement5; 

If the condition condition1 is TRUE, execute statement1, and then execute statement5; otherwise, judge whether condition2 is TRUE; if it is TRUE, execute statement2, and then execute statement5. The Condition 3 is the same. If condition1, if neither condition2 nor condition3 is true, statement4 is executed and statement5 is executed. The above content is an introduction to some of the Oracle PL tutorials.

Article by: http://www.programbbs.com/doc/class10-3.htm

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.