日期:2014-05-17  浏览次数:20958 次

oracle表如何判断某条记录是否存在?
我常用的方法时:
v_count   int;
select   count(id)   into   v_count   from   tableName;

if(v_count   >   0)   then
  --
else
  --
end   if;

有没有类似Sql   server的exists函数?

在oracle中我使用如下语句报错呢.
if   exists   (select   id   from   tablename)   then
  ---
end   if;

------解决方案--------------------
你完全可以自己写一个EXISTS:)
------解决方案--------------------
你的常用方法是oralce的标准做法,而且效率上来说如果id是逐渐而且是递增的话应该很快。