declare
  num number;
begin
  select count(1) into num from user_indexes where table_name=upper('t_sale_order') and index_name=upper('sale_order_xdsj_index');
  if num =0 then
    execute immediate 'create index sale_order_xdsj_index on t_sale_order(to_char(xdsj,''yyyy-MM-dd''),orgid,xsqd)';
  end if;
end;
/

 

declare
  num number;
begin
  select count(1) into num from cols where table_name = upper('T_AUTHORITY')and column_name = upper('GNMC');
  if num >0 then
    update t_authority a set gnzt=0 where a.gnmc in ('版本配置','部署配置','日志管理');
    commit;
  end if;
end;
/