Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Explain the two type of Cursors ?

Answer Posted / sachin fulari

Brief about Cursors
-------------------
Every SQL statement executed by Oracle has a Private SQL
area that contains info about SQL statement and the set of
data returned.
In PL/SQL, a cursor is a name assigned to a specific
private SQL area of a specific SQL Statement.
There can be either, Static Cursor whose SQL statements is
determined at compile time, or Dynamic Cursor, whose SQL
statement is determined at runtime.

Note: Dynamic Cursors are implemented using Oracle built in
package DBMS_SQL.

Implicit Cursors:
----------------
Any SQL statement that is executed directly or in an PL/SQL
block i.e. execution section or in exception section,
during which it is associated with a work area in memory of
oracle (SGA). This is done using implicit cursor by Oracle.
We do not need to declare implicit cursor hence not be
opened, fetched and closed.

Explicit Cursors:
-----------------

They are the SELECT statement that is declared explicitly
in the declaration section of current block or in a package
specification.
Further we can use open, fetch and close in execution
section or exception section of the block or program to
utilize declared cursor.

To use an explicit cursor we need to declare it in
declaration section of block or package specification.

There are three sub types of explicit cursors:

* Simple Cursor (without parameter)

CURSOR emp_cur IS
SELECT emp_id
FROM emp;

* Parameterized Cursor - That accepts arguments

CURSOR emp_cur (dept_in [IN] NUMBER) IS
SELECT emp_id
FROM emp
WHERE dept = dept_in ;
* Returning Cursor - A cursor header that contains
a return clause

CURSOR emp_cur (dept_in [IN] NUMBER) IS
RETURN emp%ROWTYPE
SELECT *
FROM emp;


Hope so, above paragraphs explain cursors very well and in
details.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are character functions in sql?

891


column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.

7134


What is normalisation and its types?

954


Is there any restriction on the use of union in embedded sql?

1099


how to convert dates to character strings? : Sql dba

1070


What is latest version of sql?

982


What is the use of & in pl sql?

985


What are all the common sql functions?

969


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

2200


Explain what is dbms?

985


Does sql*plus have a pl/sql engine?

995


Where is all the data on the internet stored?

947


What are different types of functions in sql?

954


what is “go” in t-sql? : Transact sql

1039


Can you have more than one key in a database?

890