How can I declare a ref cursor for unknown table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • osman7king
    New Member
    • Sep 2010
    • 61

    #1

    How can I declare a ref cursor for unknown table?

    I write a procedure which will generate the insert statments
    for a table (the table name passed as parameter),
    in this procedure I use a reference cursor but I have error because I don't know the name of the table before the run time

    Code:
    CREATE OR REPLACE PROCEDURE GENERATE_INSERT_STAT(V_TABLE_NAME VARCHAR2) AS
    DECLARE
    V_INSERT VARCHAR2(1000);
    
    BEGIN
    FOR TAB_CUR IN ( SELECT * 
                     FROM  [I]V_TABLE_NAME[/I] 
                     WHERE (...any condition....)
                    )
    ....
    ...
    
    
    END;
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Try to use SYS_REFCURSOR.

    Comment

    Working...