DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Using column value as table name to delete records

Threaded View

  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Unhappy 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.
    Last edited by mydbuser; 12-09-2003 at 11:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width