For loops in Oracle

Source: Internet
Author: User

DECLARE   Str Varchar(Ten);--define a string variable strBEGIN    forIinch 1..10000000Loop-- INSERT into Fw_test (NAME) VALUES (' BBB ' + i);D ecode (' 1 ', ', ', ', ' DECODE ', ' 2 ', ', ', ', ' DECODE ', ' 3 ', ', ', ' 2 ' | | ' 3 '))) NVL2 (' 1 ', NVL2 (' 2 ', NVL2 (' 3 ', ' 2 ' | | 3 ', '), ')      SELECTDECODE ('1',"',"', DECODE ('2',"',"', DECODE ('3',"',"','2'||'3'))) as Str  into Str  fromDual--assign the value of the query to STRSys.dbms_output.put_line (Str ||i);--Print the string   EndLoop; Commit;END;/

Because there are too many loops, the SQL statement needs to be executed first on the command line:

Set   Serveroutput on      size   10000000

For loops in Oracle

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.