to_date and insert statement

The following sql uses to_date function to convert string to a date value and then insert it to database.


CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
                      HIREDATE DATE);

SQL> INSERT INTO
  2  emp(empno, hiredate)
  3  VALUES (6,TO_DATE('05-FEB-2012 19:32:36', 'DD-MON-YYYY HH24:MI:SS'));

1 row created.

SQL> select * from emp;

     EMPNO HIREDATE
---------- ---------
         6 05-FEB-12

SQL>
Home »
Oracle »
Conversion Functions » 

to_date:
  1. to_date function
  2. to_date and insert statement
Related: