Skip Headers
Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)

Part Number E17126-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Cursor Variable Declaration

A cursor variable is like an explicit cursor that is not limited to one query.

To create a cursor variable, either declare a variable of the predefined type SYS_REFCURSOR or define a REF CURSOR type and then declare a variable of that type.

Topics:

Syntax

ref_cursor_type_definition ::=

ref_cursor_type_definition
Description of the illustration ref_cursor_type_definition.gif

cursor_variable_declaration ::=

cursor_variable_declaration
Description of the illustration ref_cursor_var_decl.gif

Semantics

ref_cursor_type_definition

type_name

The name of the REF CURSOR type that you are defining.

RETURN

Specifies the data type of the value that the cursor variable returns.

Specify RETURN to define a strong REF CURSOR type. Omit RETURN to define a weak REF CURSOR type. For information about strong and weak REF CURSOR types, see "Creating Cursor Variables".

db_table_name

The name of a database table or view, which must be accessible when the declaration is elaborated.

cursor_name

The name of a previously declared explicit cursor.

cursor_variable_name

The name of a previously declared cursor variable.

record_name

The name of a user-defined record.

record_type_name

The name of a user-defined type that was defined with the data type specifier RECORD.

ref_cursor_type_name

The name of a user-defined type that was defined with the data type specifier REF CURSOR.

cursor_variable_declaration

Cursor variables are subject to the restrictions in "Cursor Variable Restrictions".

cursor_variable_name

The name of the cursor variable that you are declaring.

type_name

The type of the cursor variable that you are declaring—either SYS_REFCURSOR or the name of the REF CURSOR type that you defined previously.

SYS_REFCURSOR is a weak type. For information about strong and weak REF CURSOR types, see "Creating Cursor Variables".

Examples

Related Topics

In this chapter:

In other chapters: