oracle不存在则插入,存在则不插入

咱们有时在升级的时候须要单独向数据库中插入一条数据。又但愿脚本能够重复执行,因此。。。sql

以oracle为例:数据库

declare 
   v_count  number(10,0)%type;
begin
  select nvl(count(1),0)
  into v_count
  from XXX  where XXX
if v_count = 0 then 
 begin
 执行插入语句。。。
 end;
end if;
commit;
end;

既是记录,也供你们参考oracle

相关文章
相关标签/搜索