I'm a new programmer and am trying to include the following statement in my PLSQL code:
select msa_code, mda_desc, zip_code_nk
sales.msa
where zip_code_nk = prod_rec.zip_code_nk;
When there is not a zip_code_nk in the msa table, I'm getting an oracle error saying "Data not found".
How can I code around this? It seem the processor just drops to the exception code and records the record as a failed insert.
Wm Ector
Nice answer Valentine.. !!
Feb 21, 2014
Kari Mennella
Thanks
Feb 24, 2014
Imran Amjad
for example;
BEGIN
select msa_code, mda_desc, zip_code_nk
from sales.msa
where zip_code_nk = prod_rec.zip_code_nk;
EXCEPTION when no_data_found then
null; -- Or code whatever you want here.
END;
-- The big advantage is that you are avoiding an extra count SELECT from a database
-- using built-in functionality
Nov 6, 2014