Using column value as table name to delete records
Hi,
I am using Oracle 8i.
I need to write an Oracle SQL Script to delete records from the selected tables (i.e. EMPLOYEE and ACCOUNT tables, where the TABLE_TYPE column value of MAP_TABLE table is equal to 'A'). But the table names are stored in TABLE_NAME column of MAP_TABLE.
Question 1: How to write the delete statement script for EMPLOYEE and ACCOUNT tables by using the TABLE_NAME column values that retrieved from MAP_TABLE.
Question 2: How to use the TABLE_NAME column values to select a particular field in script, eg. EMP_NAME field of EMPLOYEE table.
TABLE_NUMBER, TABLE_NAME, TABLE_TYPE
1, EMPLOYEE, A
2, ACCOUNT, A
3, STOCK, B
4, RAW, C
EMP_NO, EMP_NAME
100, James Mil
200, Tom Cris
300, Mark
400, Jessica
ACC_NO, ACC_CODE
01, ACDS
02, SDV
03, SDV
04, RFS
Need advice from expert here. Thanks in advance.
Chrlyn.