A)
select decode(count(*), 0, \'N\', \'Y\') rec_exists
from (select \'X\'
from dual
where exists (select \'X\'
from sales
Simply get a count of the record(s) you're looking for. If count > 0 then record(s) exist.
DECLARE rec_count NUMBER := 0; BEGIN select count(*) into rec_count from EMPLOYEETABLE WHERE employee_id = inEMPLOYEE_ID AND department_nbr = inDEPARTMENT_NBR; if rec_count > 0 then {UPDATE EMPLOYEETABLE} else {INSERT INTO EMPLOYEETABLE} end if; END;