Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Posts
    5

    Question Unanswered: Creating Records of Unknown Table

    Is there any way to create a record type with a %rowtype variable without knowing the table's name? I'd like a record to be able to be created dynamically, as each table may have different numbers of columns.

    I already have a ref cursor that takes in a table name stored in a varchar2. I just need a record type to hold a row fetched from the ref cursor.

    If there's some way to use that varchar2 with the table's name when creating the record type, that would work perfectly.

  2. #2
    Join Date
    Jul 2010
    Posts
    5

    Unhappy

    After some research it seems like what I'm trying to do may be impossible. I want to make a stored procedure that when passed a table name and id value it will find all rows of that table with that id and create the insert statements needed to reproduce them.

  3. #3
    Join Date
    Mar 2007
    Posts
    623
    I want to make a stored procedure that when passed a table name and id value it will find all rows of that table with that id and create the insert statements needed to reproduce them.
    It is probably impossible with the approach you chose. That's why, it is good you posted the real requirement too.
    It could be achieved by adjusting Tom Kyte's print_table function available in this thread: http://asktom.oracle.com/pls/apex/f?...:1035431863958

  4. #4
    Join Date
    Jul 2010
    Posts
    5
    Thanks. That should work.

    I never even knew the DBMS_SQL package even existed until today.

Posting Permissions

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