Hi everyone,
I'm trying to write a trigger that will, on login perform some SQL and based on this possibly raise an exception. I.e. when the user logs in they may get:
ORA 20001, My error Text here
The problem is I can't get SQL Plus to display the error message on Login, It is however hitting the exception. My code is below
The package call in the exception handler is to a autonamous transaction that logs the error in a table and then does a raise application error, this is a standard package so I know it works (I've also tried it by just calling it from within a begin end;
The call to the package is also working as the error is getting logged in the audit table.
CREATE OR REPLACE TRIGGER mike_test
AFTER LOGON
ON brftest.schema
DECLARE
bad_user EXCEPTION;
BEGIN
if upper(user) = 'BRFTEST' then
raise bad_user;
end if;
insert into mike values ('Logged in at ' || to_char(sysdate,'HH24:MI:SS'));
EXCEPTION
WHEN bad_user THEN
omx_oam_cmn_01.gv_ora_err := 'Get Lost';
omx_oam_cmn_01.report_event(0,
'SECURITY',
'Login',
user);
RAISE;
RAISE;
WHEN OTHERS THEN
omx_oam_cmn_01.gv_ora_err := sqlerrm;
omx_oam_cmn_01.report_event(0,
'Security',
'LOGIN',
user);
END;
/
BTW, This is on an 8.1.6 Database...
Thanks in advance,
Mike.
I'm trying to write a trigger that will, on login perform some SQL and based on this possibly raise an exception. I.e. when the user logs in they may get:
ORA 20001, My error Text here
The problem is I can't get SQL Plus to display the error message on Login, It is however hitting the exception. My code is below
The package call in the exception handler is to a autonamous transaction that logs the error in a table and then does a raise application error, this is a standard package so I know it works (I've also tried it by just calling it from within a begin end;
The call to the package is also working as the error is getting logged in the audit table.
CREATE OR REPLACE TRIGGER mike_test
AFTER LOGON
ON brftest.schema
DECLARE
bad_user EXCEPTION;
BEGIN
if upper(user) = 'BRFTEST' then
raise bad_user;
end if;
insert into mike values ('Logged in at ' || to_char(sysdate,'HH24:MI:SS'));
EXCEPTION
WHEN bad_user THEN
omx_oam_cmn_01.gv_ora_err := 'Get Lost';
omx_oam_cmn_01.report_event(0,
'SECURITY',
'Login',
user);
RAISE;
RAISE;
WHEN OTHERS THEN
omx_oam_cmn_01.gv_ora_err := sqlerrm;
omx_oam_cmn_01.report_event(0,
'Security',
'LOGIN',
user);
END;
/
BTW, This is on an 8.1.6 Database...
Thanks in advance,
Mike.