Skip to content
Advertisement

Getting a not valid month and need to insert records in incremental manner

The problem which I am facing:

  1. I need to convert timestamp to date and then insert it into the deligate_details_trans for the completed_date column of the deligate_details_main table. When I am converting it is giving ORA-01843: not a valid month error.

  2. Currently, deligate_details_main has 3 rows that are going to be inserted into the deligate_details_trans table but if any rows got inserted into the deligate_details_main table say e_id 4 got inserted after doing insertion into the deligate_details_trans table. Then when I will run the INSERT query then it should append e_id 4 into the deligate_details_trans table

Expected Output if there are 3 records into the deligate_details_main table:

When one more e_id gets added into the deligate_details_main table

Then the output should be:

Advertisement

Answer

All you need is TRUNC on completed_date, I’d say.


To make inserts into deligate_details_trans automatic, you’ll need a database trigger:

Let’s test it:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement