Cursor variables in pl sql, PL-SQL Programming

Assignment Help:

Cursor Variables:

 To execute the multi-row query, the Oracle opens an unnamed work region that stores the processing information. You can use an explicit cursor that names the work region, to access the information. Or, you can use the cursor variable that points to the work region. While a cursor always refers to similar query work region, a cursor variable can refer to various work regions. To create the cursor variables, you can define a REF CURSOR type, and then declare the cursor variables of that type.

The Cursor variables are such as C or Pascal pointers that hold the memory location (address) of a little item rather of the item itself. Therefore, declaring a cursor variable build a pointer, not an item.

1597_constant variable.png

Keyword and Parameter Description:

type_name:

This is a user-defined type specifier that is used in the subsequent declarations of the PL/SQL cursor variables.

REF CURSOR:

In PL/SQL, the pointers have datatype REF X, where REF is short form of REFERENCE and

X stands for the class of objects. And hence, the cursor variables have datatype REF CURSOR.

RETURN:

This keyword introduces the RETURN clause that specifies the datatype of the cursor variable result value. You can use the %ROWTYPE attribute in the RETURN clause to give a record type which presents a row in a database table or a row returned by a cursor or strongly typed cursor variable. You can also use the %TYPE attribute to give the datatype of a earlier declared record.

cursor_name:

These identify an explicit cursor earlier declared within the present scope.

cursor_variable_name:

These identify a PL/SQL cursor variable formerly declared within the present scope.

record_name:

These identify a user-defined record formerly declared within the present scope.

record_type_name:

These identify a RECORD type formerly defined within the present scope.

db_table_name:

These identify a database table (or view) that shuld be accessible when the declaration is elaborated.

%ROWTYPE:

These attributes provides a record type that presents a row in the database table or a row fetched from the cursor or strongly typed cursor variable. The Fields in the record and equivalent columns in the row have similar names and datatypes.

%TYPE:

These attributes provides the datatype of a formerly declared user-defined record.

 


Related Discussions:- Cursor variables in pl sql

Using cursor attributes - bulk bind performance improvement, Using Cursor A...

Using Cursor Attributes To process the SQL data manipulation statements, the SQL engine must opens an implicit cursor named SQL. This cursor's attributes (%FOUND, %NOTFOUND, %

Package utl file in pl/sql, UTL_FILE: The Package UTL_FILE permits you...

UTL_FILE: The Package UTL_FILE permits your PL/SQL programs to read & write operating system (OS) text files. It gives a restricted version of the standard OS stream file I/O,

Compare sql and pl/sql, Question 1 . Compare SQL and PL/SQL Question 2 ...

Question 1 . Compare SQL and PL/SQL Question 2 . Write a database trigger to implement the following check condition                          Given the following table

Origin of earth - big bang hypothesis, ORIGIN OF EARTH - BIG-BAN G HY...

ORIGIN OF EARTH - BIG-BAN G HYPOTHESIS - Origin of life is linked to origin of earth. Cosmos, the Universe originated 10-20 billion years ago by Big Bang (thermonu

Implicit cursor attributes, Implicit Cursor Attributes The Implicit cur...

Implicit Cursor Attributes The Implicit cursor attributes returns the information about the execution of an INSERT, DELETE, UPDATE, or SELECT INTO statement. The cursor attribu

Sqls counterpart of the key words, SQLs counterpart of the key words: ...

SQLs counterpart of the key words: The text from the opening parenthesis to the end of the fourth line specifies the declared type of the table, meaning that every table ever

Relational schema, query to Find the account numbers of all customers whose...

query to Find the account numbers of all customers whose balance is more than 10,000 $

%isopen - implicit cursor attributes, %ISOPEN The Oracle closes the SQ...

%ISOPEN The Oracle closes the SQL cursor automatically after executing its related SQL statement. As a result, the %ISOPEN forever yields FALSE.

Parameter aliasing, Parameter Aliasing   To optimize the subprogram ca...

Parameter Aliasing   To optimize the subprogram call, the PL/SQL compiler can decide between the two techniques of the parameter passing. With the by-value techniques, the v

Difference between ttitle and btitle, TTITLE and BTITLE are commands in Pl-...

TTITLE and BTITLE are commands in Pl-SQL to control report headings and footers. This Ttitle & Btitle are mainly used on creating SQL*PLUS report. Ttitle is used for toptitle headi

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd