You'd have to use execute immediate or DBMS_SQL to change the table name like this. On the other hand, if you had a limited selection of tables that all exist then you might do something like:
Code:CURSOR batch_cur IS SELECT ROW_ID, IF_ROW_BATCH_NUM FROM TABLE1 WHERE IF_ROW_BATCH_NUM = v_batch_num AND 'TABLE1' = v_eim_table UNION ALL SELECT ROW_ID, IF_ROW_BATCH_NUM FROM TABLE2 WHERE IF_ROW_BATCH_NUM = v_batch_num AND 'TABLE2' = v_eim_table ORDER BY 2, 1;




Reply With Quote