Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> procedure error
Dear Gurus.
I created a procedure and this procedure takes
parameters and then makes and alter table DDL on the database.
But when I write
exec
pp(table_name1,field,table_name2);
Gives error.
ERROR at line 1:ORA-06550: line 1, column
10:PLS-00357: Table,View Or Sequence reference 'K_CT_IST_KTP_SYF_ALN' not
allowed in this contextORA-06550: line 1, column 7:PL/SQL: Statement
ignored
Here is the source
create or replace procedure pp(table_name in
varchar2,field in
varchar2,pk_table_name in varchar2)
is cursor_name INTEGER; rows_processed
INTEGER; begintemp:='ALTER TABLE '||table_name||' ADD CONSTRAINT
'||table_name||'_FK'||' FOREIGN KEY ('||field||') REFERENCES '|| pk_table_name||'('||field||')';dbms_output.put_line(temp);dbms_sql.parse(cursor_name, 'ALTER TABLE '||table_name||' ADD CONSTRAINT '||table_name||'_FK'||' FOREIGN KEY('||field||') REFERENCES '|| pk_table_name||'('||field||')',
dbms_sql.native); rows_processed := dbms_sql.execute(cursor_name);dbms_sql.close_cursor(cursor_name);end;Received on Mon Jun 11 2001 - 04:31:30 CDT