Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

who updated the data

Status
Not open for further replies.

knitwit

Technical User
Apr 14, 2003
55
US
Hi,
I'm checking on a question for my dba. She's new to Oracle (coming from SQL server). Is there a system field that saves the user that last updated a row of data? We found the sysdate to get the date and time. But what about who did the update/creation of the row?

Thanks
 
Knitwit,

To document WHO made WHAT changes to WHICH rows WHEN, you need a trigger that writes all this information to an change-audit table. To see all the code involved, you can click on thread759-804734, "Script to See the Before and After Update". (I just bumped it to near the top of this forum for easier location.)

Let us know if this is what you wanted.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
FYI - The reserved word that identifies the user is USERID.

Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
Barb said:
The reserved word that identifies the user is USERID.
Barb, I'm not quite sure what you mean. The only Oracle key word to identify the current user (of which I am aware) is user:
Code:
SQL> select userid from dual;
select userid from dual
       *
ERROR at line 1:
ORA-00904: "USERID": invalid identifier

SQL> select user from dual;

USER
------------------------------
DHUNT

SQL>
Let me know if this differs from your experience.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
You are of course correct - not enough coffee makes for bad posts. My apologies.

When I read the original post, I interpreted it that the fledgling DBA had identified SYSDATE as the reserved word to obtain the "when", but did not know the reserved word to identify the "who". It is, of course, USER.

Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top