Thursday 21 October 2021

ORA-00932: inconsistent datatypes: expected DATE got NUMBER

SQL> insert into table1 values(1,'Jay',2000,01-06-85,11-11-15);

insert into table1 values(1,'Jay',2000,01-06-85,11-11-15)

                                            *

ERROR at line 1:

ORA-00932: inconsistent datatypes: expected DATE got NUMBER


SQL> desc table1

 Name              Null?    Type

 ---------------- -------- ----------------------------

 SNO                            NUMBER(12)

 NAME                           VARCHAR2(32)

 SAL                            NUMBER(10)

 DOB                            DATE

 HIREDATE                       DATE   



01-06-85 is a numeric value , use to_date function to convert number to date


SQL> insert into table1 values(1,'Jay',2000,to_date('01-06-85','DD-MM-YY'),to_date('11-11-15','DD-MM-YY'));

1 row created.


SQL> commit;

Commit complete.

No comments:

Post a Comment