divya.trehan573
divya.trehan573

Reputation: 564

Handling cannot insert Null into in Oracle

I have an insert statement where in i am inserting the data from table_abc to table_job. Now there is mandatory column in effec_start_date in table_job, but this effec_start_date is not mandatory in table_Abc. Hence there may be null values too in effec_start_date of table_abc. While inserting from table_abc to table_job it is going into exception stating

-1400 - ORA-01400: cannot insert NULL into ("HR"."table_job"."EFF_START_DATE")

and obviously when querying table_job it is not returning any value

Is there a possibility to insert the not null values for effective_Start_date in table_job and for only null values it goes into exception

insert into table_job
(job_code,
eff_start_date,
eff_end_date,
config_id
)

select * from table_Abc;

Upvotes: 0

Views: 831

Answers (1)

Ricardo Arnold
Ricardo Arnold

Reputation: 913

you need to filter your data in the select statement

insert into table_job
(job_code,
eff_start_date,
eff_end_date,
config_id
)
select * from table_Abc
where eff_start_date is not null;

Upvotes: 3

Related Questions