|
-
Trigger Help
Hi all,
I have a Table A
Columns are
ID F_name Lname Oracleaccount Updated_by Updated_date
--- ----- -------- -------------- ----------- ------------
1 Scott Tiger scott
2 Kim Tylor Ktylor
So what i need to do is
Suppose User "Scott" Loogs into oracle and updated record
ID F_name Lname Oracleaccount Updated_by Updated_date
--- ----- -------- -------------- ----------- ------------
1 Scott Tiger scott
2 Kim roger Kroger 1 05-MAY-2003
I need the User's id number in Table A to be placed automatically when he updates
record in table and Sysdate into updated_date
I created a Procedure and Trigger on table A
Procedure
CREATE OR REPLACE PROCEDURE updateby(
CUDATE out DATE,
CUBY out NUMBER)
IS
BEGIN
SELECT SYSDATE, CTUT_ID
INTO CUDATE,CUBY
from A
where oracleaccount = USER;
EXCEPTION WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20001,'User Does not Exist');
END PR_TDBX_CUDATEBY;
Trigger
CREATE OR REPLACE TRIGGER TU_A
BEFORE INSERT ON A
FOR EACH ROW
BEGIN
updateby(:NEW.UPDATED_DATE,
:NEW.UPDATED_BY);
END;
I am getting a mutating error.I checkd so many doucments it didnt help me
I am poor in procedures and triggers
any code is helpful
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|