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!

After Logon on Database triggers does not fire!

81852Nov 7 2002
Hi Friends,

Could you tellme as to why the following trigger fired when I logong to a database (the user4s database).
This code should try to capture the logon entries in v$session view and then if there is any logon entry, then the the exception is raised.

-----------
create or replace trigger logcheck after logon on database
declare

cursor user_cur is select username, program from v$session
where to_char(logon_time, 'DD-MON-YY') = to_char(sysdate, 'DD-MON-YY');
begin
for user_rec in user_cur loop
begin
if user_rec.username='SAM' and upper(user_rec.program)='SQLPLUSW.EXE' then
insert into nc_login values (sysdate, user_rec.username, user_rec.program);
commit;
raise_application_error(-20201, 'No login allowed');
end if;
END;
end loop;
end;
----

1)Can you tellme what is wrong in this code and when I login to the database as SAM, this trigger is not fired!
2) I know that there may be other ways of doing the same task.. Please assume that the table is NC_LOGIN is existiing, used to store all those attempts to logon to the database.

I appreciate your early feed back on this!

Thanks in advance,
Sam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2002
Added on Nov 7 2002
7 comments
2,713 views