判断数据表里面是否存在某个字段属性,不存在则新增

declare
  v_rowcount integer;
begin
   select count(1) into v_rowcount from user_tab_columns
   where table_name=upper('表名')
   and column_name=upper('字段属性名');
   if v_rowcount=0 then
      execute immediate 'alter table 表名 add 字段属性名 number(10) not null';
   end if;
end;
/

猜你喜欢

转载自dongxylove.iteye.com/blog/2282266