hi bunyamin
you have forgot to open the cusror before the start of the programme.
excute  the dbms_sql.open_cursor function to get the curosr id.
cursor_name:=dbms_sql.open_cursor;
Venkata Ramana
Sierra Optima Limited,
SVR Towers, 8-2-1/B/1, Panjagutta,
Hyderabad 500082, India.
Ph: (91-40) - 3730321, 3746122, 3745051 Ext: 228,219
Fax:(91-40) - 3746419.
Email : [EMAIL PROTECTED]


> ----------
> From:         Bunyamin K. Karadeniz[SMTP:[EMAIL PROTECTED]]
> Reply To:     [EMAIL PROTECTED]
> Sent:         Monday, June 11, 2001 3:45 PM
> To:   Multiple recipients of list ORACLE-L
> Subject:      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 context
> ORA-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;
>  begin
> temp:='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;
> 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Venkata Ramana Kanchinadam
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to