Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: insert user and data login in a table
Guido Konsolke wrote:
>"Daniel Morgan" wrote...
>
>
>>Maurizio wrote:
>>
>>
>>>>I desired know like i can insert in automatic the [user] and the
>>>>
>>>>
>[date] of
>
>
>>>>login of a consumer in a table.
>>>>Thank you in advance
>>>>Maurizio
>>>>
>>>>
>>>>
>>>>
>>>>
>>Don't be so fast to thank them. There is a far far easier way:
>>
>>CREATE TABLE test (
>>somefield VARCHAR2(10),
>>username VARCHAR2(30) DEFAULT USER,
>>insertdate DATE DEFAULT SYSDATE);
>>
>>INSERT INTO test (somefield) VALUES ('ABC');
>>COMMIT;
>>
>>SELECT * FROM test;
>>
>>You did, after all, say "automatic".
>>
>>--
>>Daniel Morgan
>>http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
>>http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
>>damorgan_at_x.washington.edu
>>(replace 'x' with a 'u' to reply)
>>
>>
>>
>Hi Daniel,
>
>since the OP wants to insert the "login time"
>I don't see how your DEFAULT SYSDATE reflects that
>(unless you use this in a logon trigger).
>I am still uncertain what the OP wants to do.
>Just logging the logins or identify who entered
>specific records in a table?
>
>Greetings,
>Guido
>
>
>
My mistake then. I didn't realize the OP said login time. In that case
I'd use a logon trigger to load it into a variable defined in a package
header. The default would still work for the user, but not for the
date-time.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Thu Sep 11 2003 - 09:16:46 CDT