读书人

判断查询是否有结果如何判断

发布时间: 2012-08-08 14:32:45 作者: rapoo

判断查询是否有结果怎么判断?
判断一个查询是否查到结果,
如果查到结果进行一个操作
没有查到结果 进行其他操作。
怎样判断是否查到结果,
查询 下面就要接着这个判断 怎么实现?

[解决办法]
你指的是这样?
declare
v_temp varchar2(30);
begin
select col1 into v_temp from table where condition..;
dbms_output.put_line('find the result');
exception
when no_data_found then
dbms_output.put_line('that is no data');
end;
[解决办法]

SQL code
declarev_temp varchar2(30);begin  select max(col1) into v_temp from table where condition..;  if v_temp is null then   begin   -----你要做什么  end;  else   begin  ---你要做什么  end ;  end if;end; 

读书人网 >oracle

热点推荐