Pl/SQL stored procedure loop dead loop

Source: Internet
Author: User
Tags sql using
This morning, a stored procedure has been written for many times. It can be easily written, reported for various errors, various confusions, and searched on the Internet, the ending answer given on the Forum,

This morning, a stored procedure has been written for many times. It can be easily written, reported for various errors, various confusions, and searched on the Internet, the ending answer given on the Forum,

This morning, a stored procedure has been written for many times. It can be easily written, reported for various errors, various confusions, and searched on the Internet, I did not mention the ending answer provided on the Forum. Let's take a look at the original program. I commented out some of my missing jump-Out Loop statements.

Declare
Type cur_type is ref cursor;
Cur_emp cur_type;
R_emp emp % rowtype;
V_ SQL varchar2 (500 );
Begin
V_ SQL: = 'select * from emp where sal>: sal ';
Open cur_emp for v_ SQL using & enter the salary :;
Loop
Fetch cur_emp into r_emp;
-- Exit when cur_emp % notfound;
Dbms_output.put_line (r_emp.ename | '-' | r_emp.sal );
End loop;
Close cur_emp;
End;

Oracle error:

Suddenly, I found this step out of the loop. The error is very simple. The key is that the error is reported. set serveroutput size 100000000 on the Internet, or set serveroutput to a larger value, or set serveroutput on size unlimited has been tried. No. Serveroutput is the dbms_output service in pl/SQL. When this service is enabled, the service can print the output content on the console. Obviously, this error refers to buffer overflow, which is easily caused by an error such as an endless loop. Unfortunately, I didn't think of it for a moment. Now, Let's sum up and remember it!

,

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.