Skip to Content
avatar image
Former Member

Inserting Current Date with time stamp in oracle database

Hi Experts,

I want to insert the current Date and time stamp in a field in the Oracle Database Table.

I am able to insert date but i am not able to insert the date with time stamp. Any Suggestions??

Thanks

Naveen

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 12, 2008 at 08:09 AM

    Naveen,

    Do you want to get current date (from sysdate) with a specific format or transform a value containing a date/time value to insert it in ORACLE ?

    Usually, you insert current datetimestamp in a date field using this :

    TO_DATE(sysdate,'dd/mm/yyyy hh:mi:ss')

    you may have to tweak the format pattern ('dd/mm....') according to your needs

    if you want to transform a date, use something like this:

    TO_DATE(your_date,your_format)

    but make sure your format is compliant with your date, ie

    TO_DATE('31/12/2008','MM/DD/YYYY') could raise error (litteral does not match) cuz ORACLE can't recognize 31 as a month pattern

    Chris

    Add comment
    10|10000 characters needed characters exceeded

  • May 12, 2008 at 04:34 AM

    Does ur database table support the length and type of the field with timestamp? What error are u getting while trying to insert?

    Regards,

    Prateek

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 12, 2008 at 04:34 AM

    Concatinate date with time and send it to the Oracle db table field.you can use the same function for time also like date.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 12, 2008 at 07:48 AM

    Hello

    May be mismatch inbetween the source and target structures

    and use this

    to_date(sysdate,'dd/MM/yyyy')

    Add comment
    10|10000 characters needed characters exceeded