当前位置: 代码迷 >> Oracle管理 >> 判断查询是否有结果如何判断
  详细解决方案

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

热度:12   发布时间:2016-04-24 05:11:06.0
判断查询是否有结果怎么判断?
判断一个查询是否查到结果,
如果查到结果进行一个操作  
没有查到结果 进行其他操作。 
怎样判断是否查到结果,
查询 下面就要接着这个判断 怎么实现?

------解决方案--------------------
你指的是这样?
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;
  相关解决方案