ORA- Error :
DECLARE
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 13
Cause:
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.
Solution:
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.
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.
declare
cursor c_data IS
select key_value
from ...
where .... ;
begin
for c_val IN c_data
loop
update ..
set ..
where key_data = c_val.key_value ;
end loop;
exception
when NO_DATA_FOUND then
-- exception handling code
return null;
end;
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