alter table your_table add (column1 col_type1,clumn2 col_type2...);
your_table :表名
column1/column2 :字段名
col_type1/col_type2 :字段类型
建议用过程实现添加字段,屏蔽掉字段已经存在所造成的错误。另外,一次添加一个字段会更好一些。
declare
vstr_sql varchar2(2000):='alter table your_table add (column1 col_type1,clumn2 col_type2...)';
begin
execute immediate vstr_sql;
end;
/
your_table :表名
column1/column2 :字段名
col_type1/col_type2 :字段类型
建议用过程实现添加字段,屏蔽掉字段已经存在所造成的错误。另外,一次添加一个字段会更好一些。
declare
vstr_sql varchar2(2000):='alter table your_table add (column1 col_type1,clumn2 col_type2...)';
begin
execute immediate vstr_sql;
end;
/
本文介绍了一种使用PL/SQL过程来向Oracle表中安全添加新字段的方法,避免因字段已存在而引发错误,并推荐逐个添加字段以提高操作的安全性和效率。
1707

被折叠的 条评论
为什么被折叠?



