Oracle Date And/Or Time In Seconds
This page answers questions like these:
- How to get the date and time in Oracle?
Related Links:
Oracle Time in Microseconds
What Oracle Version do I Have?
Defragment Tablespace
INSERT INTO ... SELECT * FROM ...
Oracle Trigger Compilation Warnings/Errors
Get the Date and/or Time in Oracle:
SELECT SYSDATE FROM DUAL;
- 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-YYYY HH24: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.
Related Links:
Oracle Time in Microseconds
What Oracle Version do I Have?
Defragment Tablespace
INSERT INTO ... SELECT * FROM ...
Oracle Trigger Compilation Warnings/Errors
Home > Oracle > Oracle Date And/Or Time In Seconds
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
Copyright © HelpDoco.com
oracle-date-time.txt
Oracle/date-time-in-seconds.htm
3