begin
update table_name set createdate = sysdate where filename = 'aaa' and drawmonth = '201909';
if sql%notfound then
insert into table_name (drawmonth,filename,createdate)values('201909','aaa',sysdate) ;
end if;
commit;
end;
在java中先查询,再根据查询结果进行数据操作太过繁琐,可以直接使用上述sql进行处理
现在说明一下流程
1:update是更新语句,写上要更新的条件
2:if sql%notfound then 说明没有满足此条件的数据,就执行下面的插入语句