oracle中有exists函数,但是必须用在sql语句中。例如
select * from tab1 where tab1.id exists(select id from tab2);

解决方案 »

  1.   

    select count(*) into v_num from user where code='xxx';
    if v_num>0 then
    ...
    else
    ...
    end if;
      

  2.   

    在oracle中有exists函数阿,但是正如楼上所说的,不过bzszp(SongZip)也是一种变通的办法
      

  3.   

    但是如果code字段是主键,采用count(*)函数是否会降低查询效率?或者是否还有更好的方法?
      

  4.   

    如果code时主键,可以采用count(code)会好点,可以利用索引