ORA-06512 ORA-01403

ORA- Error :

ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 13


Variable declared inside a PL/SQL block or a cursor returned no value ; caused ORA-01403 : no data found and lead to generic ORA-06512 error at line 13 of the code.


In example pl/sql block , c_data cursor variable fetches key_value column value and stores in memory ; however no value retrieved from select query within the cursor.

c_data further used in for loop to fetch values into c_val to update the table returned error due to null value at initial cursor declaration.
    cursor c_data IS
select key_value
from ...
where .... ;
     for c_val IN c_data
    update ..
set ..
where key_data = c_val.key_value ;
     end loop;   
         when NO_DATA_FOUND then
-- exception handling code
return null;

To solve the error , execute cursor select query with filter where clause as a standalone command to verify if it returns result or use exception handling as per example pl/sql code.


No comments:

Post a Comment