首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

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

2012-08-08 
判断查询是否有结果怎么判断?判断一个查询是否查到结果,如果查到结果进行一个操作没有查到结果 进行其他操

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

[解决办法]
你指的是这样?
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; 

热点排行