Home » SQL & PL/SQL » SQL & PL/SQL » Cursors in Oracle 8i
Cursors in Oracle 8i [message #1723] Fri, 24 May 2002 04:27 Go to next message
Praveen Edem
Messages: 3
Registered: January 2002
Junior Member
hi,

Is there any way I can get to know the count returned by
a cursor without actually fetching the cursor.

If this is not possible then is there a way I can get back the whole cursor after I fetch it.
In our case, we are using the output of the cursor in our java code.
If I fetch the cursor even once, I lose that row of data fetched in the Java code.

rgds,

Praveen
Re: Cursors in Oracle 8i [message #1731 is a reply to message #1723] Fri, 24 May 2002 07:44 Go to previous messageGo to next message
Paul
Messages: 164
Registered: April 1999
Senior Member
Well you could declare a numeric variable, then

SELECT COUNT (*)
INTO your_variable
FROM your_tables
WHERE your_where_clause

using the same table(s) and WHERE clause as the cursor will use before the cursor is fetched (or even before it is opened if you like).
Re: Cursors in Oracle 8i [message #1753 is a reply to message #1731] Sun, 26 May 2002 19:19 Go to previous message
Praveen Edem
Messages: 3
Registered: January 2002
Junior Member
hi,
Well we are presently using the above approach of getting the count first and then opening the cursor.
But my Where clause is very big and has multiple table joins causing the performance to be very slow.
Is there any other way to do it in a single statement.

rgds,
Praveen
Previous Topic: loops&cursors
Next Topic: Error
Goto Forum:
  


Current Time: Fri Apr 26 19:46:48 CDT 2024