I have the following DDL and DML statements :
create table emp_details (
ID number(2) constraint t_pk primary key,
F_Name varchar(10) not null,
L_Name varchar(10) not null,
DOB date,
Mob_no number(10),
City varchar(10),
PIN number(5),
Gender char(1),
Designation varchar(15),
Join_Date date,
);
insert into emp_details values (01,'John','Wick','1990-07-05',9856482358,'Goa',403001,'M','SDE II', '2015-01-08');
then, I get the error of ORA-01843. So, what could be the problem?
It seems when you query with
you won't get
YYYY-MM-DDorYYYY-DD-MMfrom your result of errorORA-01843.This problem is due to inserting wrong-formatted value for date columns
DOBandJoin_date.There may be two ways to prevent this error :
Assume you get
DD/MM/YYYYfrom above query, then use05-07-1990forDOB, and08/01/2015forJoin_Datecolumns, respectively.Format your values as
to_date('1990-07-05','YYYY-MM-DD')forDOBandto_date('2015-01-08','YYYY-MM-DD')forJoin_Date