Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> trigger help
Hi,
I don't know too much about triggers but here's my trigger:
create or replace trigger license_usage
BEFORE DELETE or UPDATE on admuser.usession
FOR EACH ROW
BEGIN
INSERT INTO admuser.licenseaccess (user_id, session_id, login_time,
last_active_time)
select user_id, session_id, login_time, last_active_time
from admuser.usession;
UPDATE admuser.licenseaccess
set user_name = (select user_name from admuser.users where
licenseaccess.user_id = users.user_id);
END; This works but it's giving me duplicate output in my table. What I want it to do is, when the usession table changes I want it to update my licenseaccess table if the session_id already exist but add it if it doesn't. What should I add or change to make it work that way. I don't understand :new or :old. I've tried reading up on it but the books I have aren't clear.
thanks. Received on Tue Jan 06 2004 - 14:25:51 CST
![]() |
![]() |