if your columns are defined as DATE, you always have to input a complete date string (day-month-year), optionally including the time (hour-minute-second).
when entering time only (with TO_DATE()), the time is stored within the first day of the current month.
some examples:
-- create table for testing:
VTB@ABOT> CREATE TABLE schedule (atime DATE);
Table created.
-- insert today's date including time:
VTB@ABOT> INSERT INTO schedule (atime) VALUES (SYSDATE);
1 row created.
VTB@ABOT> SELECT TO_CHAR(atime, 'DD.MM.YYYY HH24:MI:SS') FROM schedule;
TO_CHAR(ATIME,'DD.M
-------------------
22.02.2007 14:31:26
-- insert today's date without time:
VTB@ABOT> INSERT INTO schedule (atime) VALUES (TRUNC(SYSDATE));
1 row created.
VTB@ABOT> SELECT TO_CHAR(atime, 'DD.MM.YYYY HH24:MI:SS') FROM schedule;
TO_CHAR(ATIME,'DD.M
-------------------
22.02.2007 00:00:00
-- insert tomorrow's date including time:
VTB@ABOT> INSERT INTO schedule (atime) VALUES (TO_DATE('22-02-2007 11:30:00', 'DD-MM-YYYY HH24:MI:SS'));
1 row created.
VTB@ABOT> SELECT TO_CHAR(atime, 'DD.MM.YYYY HH24:MI:SS') FROM schedule;
TO_CHAR(ATIME,'DD.M
-------------------
22.02.2007 11:30:00
-- insert time only:
INSERT INTO schedule (atime) VALUES (TO_DATE('11:30', 'HH24:MI'));
1 row created.
VTB@ABOT> SELECT TO_CHAR(atime, 'DD.MM.YYYY HH24:MI:SS') FROM schedule;
hope this helps ...
Main Topics
Browse All Topics





by: mechanismPosted on 2007-02-22 at 04:19:48ID: 18586770
I'm a newbie in Oracle; however, I enter the values in my database using the visual editor (while login to OMS as standalone) and I've noticed that I can see the SQL statement that inserts the new values in the table. If your answer involves additional user handling, please instruct me on how to do it (i.e. "go there, click that, choose X under Y and enter ABCDEF...")
MUCH appreciate, SORRY for inconvienience
Nick