I have a table in which there is a column with datatype TIMESTAMP(0)
When I insert a date into this column using
INSERT INTO TEST_TIMESTAMP VALUES(SYSDATE)
it inserts a date in the following example format
12-SEP-12 10.31.19.000000000 AM
I want to know how the below timestamp formats can be inserted in the table
12-SEP-12 10.31.19 and 12-SEP-12 10.31.19 AM
I tried specifying some formats using TO_CHAR while inserting SYSDATE into the table, but it didn't work.
Please suggest.
timestampordatedatatype doesn't have a format. A format is only needed when you retrieve the value to display it to a user.TIMESTAMP(0)is effectively the same asDATE, which will store times down to the second anyway. YourNLS_DATE_FORMATsetting may not make that obvious as it could only show the date part by default, butTO_CHAR(<date_field>, 'DD-Mon-RR HH24.MI.SS')would include the time. (The data types are explained in the documentation)