how to select a table dynamically from system tab?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: how to select a table dynamically from system tab?

Hybrid View

  1. #1
    Join Date
    Oct 2000
    Posts
    1

    Question

    hi
    i want to know how to select the table dynamically from a system tab and insert the values to a row of the selected table in a query or a procedure?
    for example :
    i want to insert the value to a table selected from tab
    i tried

    INSERT INTO (SELECT tname FROM TAB where tname='table name') VALUES('a');

    ofcourse didnt work.


    here i pass the tablename from frontend.
    i want to select the table as i pass the parameter from front end and insert the value for the row in the selected table by passing parameter from front end.

    please help me
    thanks
    krithika


  2. #2
    Join Date
    Oct 2000
    Posts
    90
    krithika

    I think you will have to do some dynamic SQL, here is a URL on this site of a document that may help.

    [url]http://www.dbasupport.com/dsc/ora8/page6.shtml[/url]

    Mike

  3. #3
    Join Date
    Aug 2000
    Location
    Ny
    Posts
    105
    CREATE PROCEDURE ABC (P_TABLE_NAME VARCHAR2) AS
    SQL VARCHAR2(4000);
    BEGIN
    SQL := 'INSERT INTO '||P_TABLE_NAME||' VALUES (''A'')';

    EXECUTE IMMEDIATE SQL;
    END;

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