Thursday, May 29, 2008

Dates

A date needs to be entered either in the standard format (dd-mon-yy) as shown in the first example:

INSERT INTO EMP VALUES(1234,'MICKEY','CEO',7249,
'10-JUL-08',
1000,500,10
);
or you must use the TO_DATE function which tells the system the format of the date.

INSERT INTO EMP VALUES(1235,'MINNEY','DBA',7249,
TO_DATE('10/07/2008','MM/DD/YYYY'),
1000,500,10
);
Use To_Char to display a date in a format other than dd-mon-yy

Select To_Char(Sysdate,'mm/dd/yyyy') Today
From Dual;


Today
----------
05/29/2008

No comments:

Post a Comment