Still can't get the procedure to compile and run

Sorry still having issues.
Here is the whole sql, but I seriously suspect the problem is in the beginning somewhere, with one of the declarations.
Any help would be appreciated. Since I can get this to run without a stored procedure ( all except the execute immediate statement ), then I assume my logic is ok, but as I said, something is wrong near the top.
Thanks ,
Floyd
The sql is:
spool proc.err
CREATE OR REPLACE PROCEDURE floydw.loadtable_config AS
i pls_integer ;
sql_stmt VARCHAR2(4000);
all_names VARCHAR2(4000);
all_names2 VARCHAR2(4000);
TYPE typ_coltab IS TABLE OF dba_tab_columns%ROWTYPE INDEX BY pls_integer;
coltab_table typ_coltab ;
coltab_table2 typ_coltab ;
coltab_rec dba_tab_columns%ROWTYPE ;
CURSOR cur is SELECT *
FROM dba_tab_columns where owner='GWSTAGING_SENTRYPROD' and table_name='CONFIG' ;
BEGIN
i := 0 ;
OPEN cur ;
LOOP
FETCH cur into coltab_rec ;
exit when cur%notfound ;
i := i+1 ;
coltab_table(i) := coltab_rec ;
coltab_table2(i).column_name := '"' || coltab_table(i).column_name || '"' ;
END LOOP;
all_names := NULL;
all_names2 := NULL;
FOR j IN 1 .. i
LOOP
all_names := all_names || ',' || coltab_table(j).column_name;
all_names2 := all_names2 || ',' || coltab_table2(j).column_name ;
END LOOP;
all_names := SUBSTR (all_names, 2); -- Remove ', ' from beginning of list
all_names2 := SUBSTR (all_names2, 2); -- Remove ', ' from beginning of list
sql_stmt := 'insert into ' || coltab_rec.table_name ||' (' || all_names || ') SELECT ' || all_names2 || ' FROM "config"@sentry_l ;' ;
--dbms_output.put_line ('executing ' || sql_stmt) ;
execute immediate sql_stmt ;
END;
If I try to create it as is, I get:
SQL> show errors
Errors for PROCEDURE FLOYDW.LOADTABLE_CONFIG:
LINE/COL ERROR
7/3 PL/SQL: Item ignored
7/31 PLS-00201: identifier 'DBA_TAB_COLUMNS' must be declared
10/14 PL/SQL: Item ignored
10/14 PLS-00201: identifier 'DBA_TAB_COLUMNS' must be declared
11/18 PL/SQL: SQL Statement ignored
12/8 PL/SQL: ORA-00942: table or view does not exist
18/5 PL/SQL: SQL Statement ignored
18/20 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
21/5 PL/SQL: Statement ignored
LINE/COL ERROR
21/24 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
22/5 PL/SQL: Statement ignored
22/22 PLS-00487: Invalid reference to variable
'DBA_TAB_COLUMNS%ROWTYPE'
30/7 PL/SQL: Statement ignored
30/56 PLS-00487: Invalid reference to variable
'DBA_TAB_COLUMNS%ROWTYPE'
LINE/COL ERROR
31/7 PL/SQL: Statement ignored
31/61 PLS-00487: Invalid reference to variable
'DBA_TAB_COLUMNS%ROWTYPE'
37/3 PL/SQL: Statement ignored
37/33 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

Hi Floyd,
fwellers wrote:
Frank,
Does something in the compile errors I sent ( below again ), lead you to believe there is a permission issue ?
LINE/COL ERROR
7/3 PL/SQL: Item ignored
7/31 PLS-00201: identifier 'DBA_TAB_COLUMNS' must be declaredYes. "PLS-00201: identifier 'DBA_TAB_COLUMNS' must be declared" is the error you would get if you tried to say
TYPE typ_coltab IS TABLE OF dba_tab_columns%ROWTYPE INDEX BY pls_integer;wihtout privileges on dba_tab_columns.
The line above appears to be line 7 of your code.
"dba_tab_columns" appears to start in postion 29 (not 31) of that line, but you didn't post your code inside tags, so 2 characters of whitespace could easily have gotten lost in the posting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

Maybe you are looking for