Determine whether there is a field attribute in the data table, if it does not exist, add it

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

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327065640&siteId=291194637