Introduction to oracle Dynamic Cursor

Source: Internet
Author: User

Oracle Dynamic cursor example program code block: SQL code www.2cto.com create or replace procedure PROC_QZCSQKTJ is -- defines the cursor type cursor_type is ref cursor; c_qzcs cursor_type; -- defines the record type record_type is record (ywlx records % type, qzcslb records % type); r_qzcs record_type; -- defines and initializes the Cursor Cur_User_Table IS select. * from test_a; Rec_User_Table Cur_User_Table % Rowtype; begin -- cyclically access the initialized cursor www.2cto.com for Rec_User_Table in Cur_User_Table loop... -- query the business table based on the value in the Rec_User_Table record, assign a value to the c_qzcs cursor, and open the cursor. open c_qzcs for select B. * from test_ B where col_a = Rec_User_Table.col_a; -- records are retrieved from the cursor cyclically. If no data is available, exit loop fetch c_qzcs into r_qzcs; exit when c_qzcs % notfound ;... end loop; close c_qzcs; -- close the cursor... end Loop; end PROC_QZCSQKTJ;/* Note: When you call a cursor in a for Loop, the cursor is automatically opened, extracted, and closed by default. */used in work and recorded for backup.

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.