Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question