Can anyone please let me know what mistake I m making here? Can we have a predefined exception with raise_application_error?
declare
s1 emp.sal %type;
begin
select sal into s1 from emp where ename='SOMDUTT';
if no_data_found then
raise_application_error(20001, 'somdutt is not there');
end if;
if(s1 > 10000) then
raise_application_error(20002, 'somdutt is earing a lot');
end if;
update emp set sal=sal+500 where ename='SOMDUTT';
end;
/
if no_data_found then
*
ERROR at line 5:
ORA-06550: line 5, column 4:
PLS-00382: expression is of the wrong type
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
no_data_foundis an exception, not a variable that you can test withif.