我是要一个判断的语句的写法if ..... then 当中的查询语句if EXISTS(select * from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null) then . . .end if
你可以先做一个游标,然后fetch一下,看看有没有fetch到值就可以了。 cursor cur_1 is select * from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null and rownum=1
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; /
select count(*) into counter1 from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null; if counter1>0 then ... end if
变通一下 --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;
当中的查询语句if EXISTS(select * from t_jbxx_gwtzjl where ryid = In_ryid and gwzxsj is not null) then
.
.
.end if
cursor cur_1 is
select * from
t_jbxx_gwtzjl
where ryid = In_ryid and gwzxsj is not null
and rownum=1
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;
/
if counter1>0 then ...
end if
--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;