Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL
Bernd, to add to what Jim said technically every SQL statement results
in a cursor. But what you are obviously asking about are known as
explicit cursors, that is, a cursors explicitly defined in code. You
use an explicit cursor when you need access to individual rows in the
cursor such as when you need to insert a set of rows into a target
destination but some of the rows will error off and rather than treat
the entire operation as single all or nothing transaction you want the
valid rows to still be inserted while recording information about the
failed rows.
With versions 9 and 10 you can use bulk load operations to perform the operation for the valid rows while capturing the errors for the bad or non-qualifying rows. Prior to 9 you did not have this ability so you used a cursor.
Explict cursors are useful where you need to perform conditional processing on the rows treating rows differently based on complex rules that you cannot easily or efficiently code into the SQL statement.
Never use an explicit curosr to do what you can do in a single SQL statement.
HTH -- Mark D Powell -- Received on Sun May 21 2006 - 11:43:06 CDT
![]() |
![]() |