I need to run an insert query in a BTEQ based on the number of records in another table.
SELECT BU_ID FROM TABLE1 WHERE BU_FLAG = 'A';
for example, if the output is 5 values then my insert query in a BTEQ (loads other tables) should run for 5 times for each business unit. I have to run these queries from a JCL, so don't want to handle this logic in the JCL otherwise there is no option.
We have only 10 rows in our table1. The users will manually set the flag every month end. I can try REPEAT but can we pass the number of records at the run time from another query?
- prax
Forums: