A little idea of a for loop in Oracle ____oracle

Source: Internet
Author: User
Today, when you execute the following anonymous block, I forced the execution off because it was too long, but when I checked the Src.test table, it was strange to see that there was some data in the table, but think about it, my understanding is as follows:
in fact, execution is an INSERT statement that forces an anonymous block to stop, Instead of simply stopping the INSERT statement, the statement after the INSERT statement is not ignored, but continues to execute the--commit,
so the Src.test table has the data. That is, forcing the stop, not stopping the execution of the anonymous block, but stopping the execution of the statement in the anonymous block.

begin
  for I in 1.1000000 loop
    inserts into src.test values (i, I | | ' Test ', i);
    commit;
  End Loop;
End;

So what about stored procedures.
Create or Replace procedure test as
begin for
i-1.100000 loop
insert into src.test values (I, I | |    ' Test ', i);
commit;
End Loop;
End;

Found the result to be the same.

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.