This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
insert into NEW_TABLE (COLUMN_A, COLUMN_B) select COLUMN_1, COLUMN_2 from OLD_TABLE where COLUMN_3 like 'variable%';
COLUMN_3 is VARCHAR2 type.
I want to loop through the above SQL with a different variable each time. How do I create a list of the variables and set a for or while loop to go through it? The list of the variable could be something like: aa, bb, cc, dd, ...
Elizabeth, You can add the values to a collection like an ArrayList. Then you can iterate through the list and call the insert each time. Note that it is likely to be more efficient to set a batch insert statement within the loop and then make only one call to the database.