Hi, I need to have 2 procedures in a package. One procedure with select into statement which causes error and raises it, and second procedure to handle all the errors and place them into errors table.
What I have done:
create or replace package paketas as
procedure error_log;
procedure ins;
end;
/
create or replace package body paketas as
procedure ins as
l_num pls_integer;
begin
select 0
into l_num
from dual
where 1 = 0;
raise;
end ins;
procedure error_log as
n_code number;
n_massage varchar2(100);
begin
exception -----------<<<<<<<<<<<<This place causes error
when others then
n_code := SQLCODE;
n_massage := SUBSTR(SQLERRM, 1, 100);
INSERT INTO errors (e_id, code, message, e_time)
VALUES (er_id.nextval, n_code, n_massage, sysdate);
end error_log;
end paketas;
/
And in package body I get error:
"PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
( begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
"
Could you help me to solve this situation?