Question

Asked:
Asked By:
Aug 7 2008   3:34 AM GMT
Saritha5   5 pts.

what is the diff between cursor and plsql table


PL/SQL Table, Cursor Table

what is the diff between cursor and plsql table

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Cursor expressions (sometimes known as cursor subqueries) are an element of the SQL language (earlier) and now of the PL/SQL too. A cursor expression can be used as an actual parameter to a PL/SQL procedure or function, which has great significance in connection with table. It can also be used functions in the SELECT statement used to open a PL/SQL cursor, and manipulated appropriately as per the requirement. Cursor expressions allow encapsulation of logic for re-use in compatible query situations, giving increased developer productivity and application reliability. A table function with a ref cursor input parameter can be invoked with another table function as the data source. Thus table functions can be daisy-chained allowing modular program design and hence increased ease of programming, re-use and application robustness. Both cursor and PL/SQL table can be used to store temporary data for manipulation. You don't "store" data in a cursor, the data comes from a table or global temporary table. you store data in a table. Global Temporary Tables are ideal for this. A correct name for a PL/SQL table would be PL/SQL array (earlier it was used as table). A cursor variable (i.e. a variable of type ref cursor) points to an actual cursor, and may be used as a formal parameter to a PL/SQL procedure or function or array. So in nutshell a Cursor is not a data type to store some data; it is either declared with the FOR clause that will bind it to a SELECT statement or it will act as an alias for another cursor, with the SET statement. A Table data type is an alternative way to create a temporary table. The variable declaration requires the column definition for the table and it creates a temporary table in tempdb.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Oracle and Database.

Looking for relevant Oracle Whitepapers? Visit the SearchOracle.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register