How can I add the fractional part to a TIMESTAMP. I tried this and it didn't seem to work.
CREATE TABLE t(A TIMESTAMP);
INSERT INTO t(A) VALUES (
DATE '2022-04-01' INTERVAL '18:02:42.123456' HOUR TO SECOND);
SELECT * from t;
A
01-APR-22 06.02.42.000000 PM
CodePudding user response:
Try
INSERT INTO t(A) VALUES (
TIMESTAMP '2022-04-01 00:00:00' INTERVAL '18:02:42.123456' HOUR TO SECOND);
When you add in INTERVAL
to a DATE
then the result is converted to DATE
which does not support fractional seconds, see Datetime/Interval Arithmetic
CodePudding user response:
Use a high resolution timestamp.
CREATE TABLE t(A TIMESTAMP(6));