Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regarding "select into" query and "no data found" exception

750952Mar 11 2010 — edited Mar 11 2010
So i have included the following into my procedure:
select div_cd into c_div_cd
from division_tab d, emp_tab y
where d.div_name=y.div_text and y.emp_code=d.emp_code;

and also an exception
exception
when no data found
-- print something

The above select query results into "no data found" and the control passes directly to the exception and prints something.

How do I do the following?

select div_cd into c_div_cd
from division_tab d, emp_tab y
where d.div_name=y.div_text and y.emp_code=d.emp_code;
if c_div_cd is null then
--enter this employee into some other table without raising an exception

No need to write a code for an answer. Please just guide me with something I can incorporate or do.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2010
Added on Mar 11 2010
4 comments
1,131 views