Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Times and dates in Oracle
Try char to date conversion using syntax like
INSERT INTO SPECAUD (CHANGE_DATE) VALUES (SYSDATE); SYSDATE is a system variable which holds current date & time
When retrieving use
SELECT TO_CHAR(CHANGE_DATE,'YYYYMMDD'), TO_CHAR(CHANGE_DATE,'HH24:MI') FROM SPECAUD; Send me a note if you need further details
Eamonn Keating wrote:
> I want to write a script to create a table which includes a date and time
> field. How can this be done in oracle. When I do the following :
>
> CREATE TABLE SPECAUD
> PARTCODE VARCHAR2(12) ,
> CHANGE_DATE DATE,
> ....
> CONSTRAINT SPECAUD_PRIMARY_KEY PRIMARY KEY ( PARTCODE,CHANGE_DATE,REV_NO));
>
> it will not allow me to enter a time value with the date field.
> Also is it possible to create a field holding only the time
> Any help in this regard would be greatly appreciated.
> Eamonn
Received on Tue Aug 03 1999 - 18:26:14 CDT