Defining ref cursor types, PL-SQL Programming

Defining REF CURSOR Types

To make cursor variables, you take 2 steps. At first, you define a REF CURSOR type, and then declare the cursor variables of that type. You can define the REF CURSOR types in any PL/SQL subprogram, block, or package using the syntax as shown:

TYPE ref_type_name IS REF CURSOR RETURN return_type;

Where ref_type_name is a type specifier used in the subsequent declarations of the cursor variables and return_type should present a record or a row in a database table. In the illustration below, you specify a return type that presents a row in the database table dept:

DECLARE

TYPE DeptCurTyp IS REF CURSOR RETURN dept%ROWTYPE;

REF CURSOR types can be weak (nonrestrictive) or strong (restrictive). 

Posted Date: 10/4/2012 4:00:23 AM | Location : United States







Related Discussions:- Defining ref cursor types, Assignment Help, Ask Question on Defining ref cursor types, Get Answer, Expert's Help, Defining ref cursor types Discussions

Write discussion on Defining ref cursor types
Your posts are moderated
Related Questions
In Packages The Forward declarations also group logically related subprograms in the package. The subprogram specifications go in the package specification, & the subprogram b

JOIN and AND in SQL In this Section is all about one operator, JOIN. SQL's closest counterpart, NATURAL JOIN, has already been covered. Here we look at several other "join" op

Manipulating Local Collections Within PL/SQL, to manipulate the local collection, by using the  TABLE and CAST operators . The operands of CAST are a collection declared locally

Parameter and Keyword Description: cursor_variable_name: This identifies a cursor variable or the parameter formerly declared within the present scope. host_cursor_va

Example of EXCEPT Operator - SQL Example, like its counterpart in the theory book, illustrates the convenience of allowing any table expression to be the source for an INSERT

1- You can check attribute names from each table in DBF11 by running for example:  desc dbf11.Member;  desc dbf11.Agent;  desc dbf11.Producer; Because some attribute names in

Table Literals - SQL One might expect SQL to support table literals in the manner illustrated in Example 2.2, but in fact that is not a legal SQL expression. Example: Not a

Components of an Object Type: An object type encapsulates the operations and data. Therefore, you can declare the methods and attributes in an object type specification, but no

Example of Check Constraints Example: Workaround for when subqueries not permitted in CHECK constraints CREATE FUNCTION NO_MORE_THAN_20000_ENROLMENTS ( ) RETURNS BOOLEAN

Example of UNWRAP Operator - SQL Example here shows how unwrapping can be done in longhand in SQL. Example: Unwrapping in SQL Letting CONTACT_INFO_WRAPPED denote the res