DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: simple table query

  1. #1
    Join Date
    Jun 2008
    Posts
    38

    simple table query

    i have created a table called std_detail:

    create table std_detail (ENAME VARCHAR2(30), ROLL_NO VARCHAR2(5), time date);

    ENAME ROLL_NO TIME

    ---------------------------------------------------------------------

    i want that whenever i insert into the table ,the time field should get updated according to the system date like( select sysdate from dual).

    for e.g.

    insert into std_detail (ename,roll_no) values( 'jeevan',09987)

    then the table should look like:

    ENAME ROLL_NO TIME

    jeevan 09987 6/25/2008 3:17:36 PM
    -----------------------------------------------------------------------

    can anyone help me in this

  2. #2
    Join Date
    Feb 2004
    Location
    UK
    Posts
    56
    You either need to change your insert to
    insert into std_detail (ename, roll_no, time) values ('jeevan',09987, sysdate)

    or alter table st_detail modify time default sysdate

  3. #3
    Join Date
    Aug 2007
    Location
    Cyberjaya,kuala lumpur
    Posts
    340
    insert into std_detail (ename,roll_no,time) values( 'jeevan',09987,sysdate);

  4. #4
    Join Date
    Jun 2008
    Posts
    38
    thanks a lot but i got this solution:

    create table std_detail (ENAME VARCHAR2(30), ROLL_NO VARCHAR2(5), time date default(sysdate));

  5. #5
    Join Date
    Aug 2007
    Location
    Cyberjaya,kuala lumpur
    Posts
    340
    Gud

  6. #6
    Join Date
    Feb 2004
    Location
    UK
    Posts
    56
    Which was my second suggestion above

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width