hi,
you can use your code using pragma exception_init like the code below to track specific error no.

DECLARE
ALERT NUMBER;
exp1 exception; -- define exception
exp2 exception; -- define exception
pragma exception_init (exp1, -1917); -- initialize with error no.
pragma exception_init (exp2, -942 ); -- initialize with error no.
begin
if :chkselect = 1 then
forms_ddl('grant select on ' || :table_name || 'to '|| :role);
end if;

if :chkinsert = 1 then
forms_ddl('grant insert on ' || :table_name || ' to ' || :role);
end if;

if :chkupdate = 1 then
forms_ddl('grant update on ' || :table_name || ' to ' || :role);
end if;

if :chkdelete = 1 then
forms_ddl('grant delete on ' || :table_name || ' to ' || :role);
end if;

exception
when exp1 then -- use them as usual exceptions
ALERT := SHOW_ALERT('ERROR');
when exp2 then
ALERT := SHOW_ALERT('ERROR');
end;

hope this will solve your problem
cheers