select * from table_name where EXISTS(select * from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null)

解决方案 »

  1.   

    我是要一个判断的语句的写法if ..... then
    当中的查询语句if EXISTS(select * from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null) then
    .
    .
    .end if
      

  2.   

    你可以先做一个游标,然后fetch一下,看看有没有fetch到值就可以了。
    cursor cur_1 is
    select * from 
    t_jbxx_gwtzjl 
    where ryid = In_ryid and gwzxsj is not null
    and rownum=1
      

  3.   

    declare
    num number;
    begin
    select count(1) into num from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null;
    if num>0 then
    ...
    end  if;
    end;
    /
      

  4.   

    select count(*) into counter1 from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null;
    if counter1>0  then ...
    end if
      

  5.   

    变通一下
    --declare v_count int := 0;
    select count(*) into v_count from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null;
     if v_count > 0 then
    end if;