Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: saving username and sysdate on insert/update

Re: saving username and sysdate on insert/update

From: Jurij Modic <jmodic_at_src.si>
Date: Mon, 19 Apr 1999 18:36:14 GMT
Message-ID: <371b5f85.817861@news.siol.net>


On Mon, 19 Apr 1999 12:40:50 GMT, ToneCzar_at_erols.com (Chris Hamilton) wrote:

>On insert, you don't need the trigger at all. Just set the DEFAULT
>value of the column to the value:
>
>alter table X modify (adddte default sysdate, addusr default
>rtrim(user));
>
>Note you should use rtrim(user) instead of simply the pseudo-column
>"user", since this column is blank-padded out to 30 characters.

On which release is this true? I've been using the "DEFAULT user" without any RTRIM on several different releases and haven't noticed the behaviour you described. I got a bit worried, so I just performed a test on Personal Oracle 7.3.2:

SCOTT_at_PO73> select length(user), user from dual;

LENGTH(USER) USER

------------ ------------------------------
           5 SCOTT


SCOTT_at_PO73> create table t1 (c1 number, c2 varchar2(30) default user);

Table created.

SCOTT_at_PO73> insert into t1(c1) values(1);

1 row created.

SCOTT_at_PO73> select c1, c2, length(c2) from t1;

        C1 C2                             LENGTH(C2)
---------- ------------------------------ ----------
         1 SCOTT                                   5


>Chris
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Christopher Hamilton
>Oracle DBA -- Wall Street Sports
>chris_at_wallstreetsports.com
>http://www.wallstreetsports.com/

Regards,

Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Mon Apr 19 1999 - 13:36:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US