Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is the use of cursors ... i've

Status
Not open for further replies.

jass1220

Programmer
May 20, 2003
88
0
0
AE
what is the use of cursors ... i've done one for deleteing specific records from the current table and inserting them in the history table ,, i need more ideas about where to use it also ..


 
well basically Cursors are used where your query is returning more than one record in PL block
 
There are a lot of good uses for cursors:
1. You can define a cursor and use it to define
a PLSQL table of records. Then you open the
cursor, fetch from the cursor and store it
in the PLSQL table. You can use data from
the fetched record to fetch inforamtio from
another cursor.

2. I use cursors to break down large multi table
joins into smaller pieces. This generally
improves performance, and gives you more control
over the query.

3. For many complex queries, cursors is the only
solution. The use of PLSQL, which is a mature
programming languare, and cursors provides a
a very powerfull set of tools for solving
complex database problems

I would suggest you get one of the Oracle Press
or O'Reilly books on PLSQL programming and look at
the many code examples.

Hope this helps!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top