Overview of Oracle Cursors

Source: Internet
Author: User

Cursor Concept: A cursor is a PL/SQL control structure that enables the display control of the processing of the statement, making it easier to process the row data of the table. Cursors are not database objects, but are persisted in memory.

Procedure: Defining Cursors Cursor cursor_name is selete_statment

The cursor declaration section is the only step that can appear in the Module declaration section, and the other three steps are in the execution and exception handling sections

The cursor name is a table identifier, so there are scopes and must be explained before use

Any SELECT statement is legal, but select ... INTO statement is illegal

Declaring a cursor at the end of a declaration section

Opens the cursor open cursor_name

Open cursor: Executes the SELECT statement corresponding to the cursor, puts its query results in the workspace, and the pointer points to the header of the workspace, identifies the cursor result collection

PL/SQL program cannot open a cursor repeatedly with an open statement

Remove the cursor FETCH cursor_name into {variable_list};

At this point, the result is a row of data, the data rows in the result collection are retrieved, and placed in the specified output variable.

Close the cursor close cursor_name

When the cursor result collection data is extracted and processed, the cursor should be closed in a timely manner to release the system resources used by the cursor and render the cursor's workspace invalid, and the FETCH statement can no longer fetch the data. The closed cursor can be reopened using the Open statement.

Cursor Properties:

    

Overview of Oracle Cursors

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.