You can get the current date and/or time in per-second resolution using the SYSDATE function.
Caveats: The resolution of the time returned is 1 second. If you want sub-second resolution, you need to use
SYSTIMESTAMP.
Store the Oracle Date and/or Time in Seconds:
CREATE TABLE mytable
(
DATE(9) mydatetime,
VARCHAR2(30) mycomment
);
INSERT INTO mytable
VALUES (SYSDATE, "This is the time that I ran the insert statement.");
In order to keep a SYSDATE value in the database, you need to use the column type DATE.
Caveats: The resolution of the time returned is 1 second. If you want sub-second resolution, you need to use
SYSTIMESTAMP.
See the Oracle Date and/or Time in Seconds:
SELECT TO_CHAR(SYSDATE, 'DD-MM-YYYYHH24:MI:SS')
FROM mytable;
In order to see a SYSDATE/DATE value, you can use the TO_CHAR function.
Format Models include ...
DD = Date (number).
MM = Month (number).
YYYY = Year (number).
HH24 = Hour (24 hour time).
MI = Minutes.
SS = Seconds (integral).
Caveats: The resolution of the time returned is 1 second. If you want sub-second resolution, you need to use
SYSTIMESTAMP.
Tags: oracle time in seconds, oracle time precision, oracle time resolution, time, seconds, sub-second time, sub-second resolution, sub-second accuracy, oracle database, oracle, database