Difference between oracle call and execution in error context

I have some procedure written in Oracle. Unfortunately, I can not show its code. Somewhere inside it is selected where the execution crashed due to lack of required data. Looks like this

select value into l_value from config where code = upper(p_code); 

So, when I call this procedure as follows (in SqlDeveloper)

 execute some_package.some_procedure('CODE'); 

he throws

 Error report - ORA-01403: no data found ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111 ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111 ORA-06512: at line 1 01403. 00000 - "no data found" *Cause: No data was found from the objects. *Action: There was no data from the objects which may be due to end of fetch. 

But when I call it that

 call some_package.some_procedure('CODE'); 

it crashes in the same place (as I can assume from the result stored in the database), but it does not throw an exception.

 some_package.some_procedure('CODE') succeeded. 

What's happening? And why is there such a difference?

+6
source share
1 answer

NO_DATA_FOUND Special exception behavior. It is processed by default in the context of SQL, but not in PL / SQL. In SQL, no data is considered an error, all the time there is a lack of data that satisfy a certain condition.

CALL is an SQL command, while EXEC is a shortcut for BEGIN <code> END; which is PL / SQL.

+12
source

All Articles