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!

Custom Exception message is not displaying

Pritam DasNov 10 2021 — edited Nov 10 2021

Hi Expert,
I am trying to print custom exception message for the below code but it is not printing .
declare
module_name varchar(50);
obj_name varchar(50);
exp1 exception;
exp2 exception;
begin
select object_name into obj_name from KPA_OBJECTS where object_id=5757;
RAISE exp1;
select mod_name into module_name from module where mod_id=4779;
RAISE exp2;
insert into KPA_VALIDATION_LISTS (validation_rule,enabled_flag,module_id,module_name,object_id,object_name)
values
('test1','Y',6777,module_name,6788,obj_name);
commit;
Exception
WHEN exp1 THEN
raise_application_error (-20002,'please select objectname');
when exp2 then
raise_application_error(-20002,'Please select moduleName');
end;

This post has been answered by BEDE on Nov 10 2021
Jump to Answer
Comments
Post Details
Added on Nov 10 2021
7 comments
371 views