Oracle--case, while, loop, for

Source: Internet
Author: User

1. Case Expressions in Oracle

(case condition when expression 1 then result 1 when expression 2 then result 2 [else result n]end) as Alias

2. Simple loop Loops

Loop to execute the statement;        Exit when< Condition >/* Condition satisfied, exit Loop statement */end Loop; actual example loop v_tmp: = v_tmp + 1; Exit when v_tmp = 10;end;

3. While loop

While < Boolean expression > loop statement to execute; end loop;            The actual example begin v_tmp: = 1;             While v_tmp <=10 loop v_tmp: =v_tmp+1; End Loop;end;

4. Digital Cycle

For loop variable in "reverse" lower limit: Upper loop to execute the statement; end Loop; Note: The loop variable is automatically added 1 per loop, and the loop variable is automatically reduced by 1 using the keyword reverse. The actual example of begin for v_tmp in 1..10 Loop--its own operating section end Loop;end;



Oracle--case, while, loop, for

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.