I have gotten pretty good at writing SQL that generates other SQL. But try as I might, I can't figure out how to add this twist to it.
I have a call history table that has a record with data for each call into our system. I need to move this data from one schema to another in. Since there may be hundreds of thousands of rows, I want to move a days worth, commit it, move another days worth, etc. In the past, I have written out the script for one day, copy and pasted it for the number of days to move, and then editted each line manually to set the date.
I get the feeling this would be done using an IN clause and a sub-query to populate the DISTINCT TRUNC dates of the data. The basic query for one day would be:
Any Suggestions?
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
I have a call history table that has a record with data for each call into our system. I need to move this data from one schema to another in. Since there may be hundreds of thousands of rows, I want to move a days worth, commit it, move another days worth, etc. In the past, I have written out the script for one day, copy and pasted it for the number of days to move, and then editted each line manually to set the date.
I get the feeling this would be done using an IN clause and a sub-query to populate the DISTINCT TRUNC dates of the data. The basic query for one day would be:
Code:
insert into easl_prod_history.call_history
select * from easl_prod.call_history
where trunc(call_date) = '09-APR-07';
commit;
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...