Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Adding a column in a procedure
Hello,
I want dynamicly add a column to a table in a stored procedur. The code I created id accepted by the compiler, but if I call this nothing happens.
here is my code:
AS
cursor_name INTEGER;
newcol varchar2(10);
rows_processed INTEGER;
BEGIN newcol:= 'TEST1';
--to_char(sysdate,'DDMMYY');
cursor_name := dbms_sql.open_cursor;
dbms_sql.parse(cursor_name, 'alter table tablegrown add :X number(10)',
dbms_sql.v7);
dbms_output.put_line(newcol);
dbms_sql.bind_variable(cursor_name, ':X',newcol,10);
dbms_output.put_line('alter table tablegrown add :X number(10)');
rows_processed := dbms_sql.execute(cursor_name);
dbms_sql.close_cursor(cursor_name);
EXCEPTION WHEN OTHERS THEN dbms_sql.close_cursor(cursor_name);
END;
What's wrong with that program?
Please help.
Steffen Received on Mon Jun 10 2002 - 05:31:05 CDT
![]() |
![]() |