ORALCE中不能用EXISTS (SELECT COUNT(*) FROM TABLE WHERE USERID = 1)来判断,EXISTS只能用于SQL语句中

解决方案 »

  1.   

    declare
      n number;
    begin
      SELECT COUNT(*) into n FROM TABLE WHERE USERID=1
      if n=0 then
         null;
      else 
        null;
      end if;
    end;
    /
      

  2.   

    select case userid when 1 then null else null end from table
      

  3.   

    select case count(*) when >0 then flag=1 else flag=0 end from table
    这句怎么写?
      

  4.   

    select case when count(*)>0 then flag=1 else flag=0 end from table