Sqlcode of the cursor query in oracle

83 views Asked by At

I have a oracle cursor with query

CURSOR cursor IS SELECT column1 FROM table_name WHERE column1 = 48200;
DBMS_OUTPUT.PUT_LINE(SQLCODE);

I need the SQLCODE of the query in the cursor. I wrote without cursor then i can get the SQLCODE but i need the SQLCODE with the CURSOR.

SELECT column1 FROM table_name WHERE column1 = 48200;
DBMS_OUTPUT.PUT_LINE(SQLCODE);

here I can able to get the SQLCODE as 0 for 'data found' and 100 for 'no data found'

1

There are 1 answers

0
Littlefoot On BEST ANSWER

That won't work for a cursor. You should use cursor_name%FOUND or cursor_name%NOTFOUND instead.