Reputation: 2844
Is there a way to achieve this? Something like
alter table
'all_tables' add(newcol varchar2(20));
is this possible?
Upvotes: 1
Views: 2120
Reputation: 8905
Or directly execute the alter statements using execute immediate
begin
for i in (select table_name from user_tables)
loop
execute immediate 'alter table '||i.table_name||' add (newcol varchar2(20))';
end loop;
end;
/
Upvotes: 3
Reputation: 2115
run the following in sqlplus or sql developer, and then run the output from the query
select 'alter table ' || table_name || ' add (newcol varchar2(20));'
from user_tables
Upvotes: 4