新增列
declare
cnt number;
begin
select count(1) into cnt from user_tab_columns where upper(table_name)=upper('tchannelgroup') and upper(column_name)=upper('c_servicetype') ;
if cnt =0 then
execute immediate 'alter table tchannelgroup add c_servicetype char(1)';
end if;
end;
/
删除
declare
cnt number;
begin
select count(1) into cnt from user_tab_columns where upper(table_name)=upper('tchannelgroup') and upper(column_name)=upper('c_servicetype') ;
if cnt <>0 then
execute immediate 'alter table tchannelgroup drop column c_servicetype ;
end if;
end;
/
修改列
禁用列
alter table t1 set unused column name --设置某字段无用
alter table t1 drop unused columns checkpoint 10 --删除无用字段