I have a procedure that should take a table name which can be a dblink table.
When the table name is a normal table we can easily withdraw the column
Names using the following cursor
WHERE TABLE_NAME = upper(p_table_name);
The procedure has the following signature:
Procedure Get_ColumnList( p_table_name IN VARCHAR, p_list out va_list)
p_list is VARRAY list
When it is a dblink table (tablename@my_link) the cursor would have to be in a similar format :
WHERE TABLE_NAME = upper(tablename);
I have try to take the tablename@my_link which is passed through the parameter p_table_name, split it into tablename and @mylink and use a OPEN FOR cursor with a dynamic SQL having bind variablies but I am having problems to pass ALL_TAB_COLUMNS@my_link during run time.
The cursor is the format:
OPEN c_colNames FOR
'SELECT COLUMN_NAME FROM '||
':1 WHERE TABLE_NAME =:2'
USING v_my_table_type, v_tabname;
How can I execute the query which at the moment of declaration doesn’t know what would be passed in the FROM clause