Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> trigger Problem
Hello People,
I am writing a trigger on a table that is a security table for a vendor
supplied package, the table looks like this:
desc SEC_TABLE
Column Name Null? Type ------------------------------ -------- ---- USERID NOT NULL VARCHAR2(8) VERSION NOT NULL NUMBER(38)
and after deleting a user from the application it inserts the userid that was just deleted. At this point (after insert) I want to lock the account of the userid that was just deleted from the app. So I wrote the following trigger, making sure that the user doing the insert (lets call it BOB) was the owner of the trigger and explicitly (not through a role had ALTER USER. Here is BOB's trigger:
CREATE OR REPLACE TRIGGER LOCKER
AFTER INSERT ON BOB.SEC_TABLE
FOR EACH ROW
DECLARE
cnum INTEGER;
BEGIN
cnum := SYS.DBMS_SQL.OPEN_CURSOR;
SYS.DBMS_SQL.PARSE(cnum,'ALTER USER '||:NEW.USERID||' ACCOUNT
LOCK',SYS.DBMS_SQL.NATIVE);
SYS.DBMS_SQL.CLOSE_CURSOR(cnum);
EXCEPTION
WHEN OTHERS THEN SYS.DBMS_SQL.CLOSE_CURSOR(cnum);
PS what does HTH stand for?
--
|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
Glen Upreti
Senior Oracle DBA
Northern Arizona University
Phone (520)523-8393 Fax(520)523-7407
Glen.Upreti_at_NOSPAMnau.edu
Received on Thu Jul 08 1999 - 10:03:00 CDT