Home » SQL & PL/SQL » SQL & PL/SQL » Update in EXECUTE IMMEDIATE (Oracle 11G)
Update in EXECUTE IMMEDIATE [message #649953] |
Mon, 11 April 2016 07:51 |
|
RaShi.Raj
Messages: 84 Registered: May 2014 Location: Bangalore
|
Member |
|
|
Hi,
How can I update one column to another from the same table using execute immediate.
E.G. I have a table My_Table with column My_Col1 with some values. For some reason I need to write a script to create a new column My_Col2 and copy the contents of My_col1 to My_Col2 for all rows.
Something like this...
BEGIN
execute immediate 'ALTER TABLE My_Table ADD My_Col2 VARCHAR2(1)';
execute immediate 'UPDATE appointments SET My_Col2 = My_Col1';
END;
Thanks
|
|
|
Goto Forum:
Current Time: Fri Apr 26 09:01:33 CDT 2024
|