Home » SQL & PL/SQL » SQL & PL/SQL » trigger
trigger [message #1803] Fri, 31 May 2002 01:02 Go to next message
SwOrC
Messages: 2
Registered: May 2002
Junior Member
Hey can someone please help me with this trigger, im not sure how to do it, or if i have started it off right.
/*Trigger b, psuedo code
trigger name: bfr_up_people_row_tgr
event: update on people
timing and type: before row
action:
if the user issuing the update does not have username "ADMIN' or the (lower-case) username
identified in the existing (old) username field of the row being changed
raise error -20030 ('User not permitted to perform action')
end if
if the update will change the username coloumn,
reise error -20040 ('Column username cannot be updated')
end if
if there is no change_log row for the current (new) people id, then
create such a change_log row with all counts zero
end if
increment the ucount of the relevant change_log row
HINT: Instead of ADMIN use your username when testing but do not forget to turn it back.
*/
create or replace trigger bfr_up_people_row_tgr
before update on people
for each row
declare
username string;
begin
if(username != 'ADMIN' or 'admin') then
raise_application_error(-20030, 'User not permitted to perform action');
end if;
/*and i dont know how to do the rest*/
end;
/
Re: trigger [message #1808 is a reply to message #1803] Fri, 31 May 2002 10:30 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
http://www.orafaq.net/msgboard/plsql/messages/8774.htm
Previous Topic: Please, Help with Dynamic sql with BULK INTO
Next Topic: High water mark
Goto Forum:
  


Current Time: Fri Mar 29 03:14:27 CDT 2024