刚刚表达错了,不好意思,重新问一下,呵呵,我是想实现如果select 有结果(一个,多个均可),我将执行一段代码,如果select 没有结果执行另外的代码,问题是我不知道怎么写这个判断有无的语句,我写了if sql%found then 不好用(我的数据库中有符合条件的记录,可是没有执行if sql%found then 下面的代码),我该怎么写啊???
解决方案 »
- oracle 能隐藏数据吗
- 安装完CRS后,OracleCSService服务启动不了.....
- 急!oracle10g 的dump能在oracle9i上用吗?
- 请beckhambobo(beckham)进来拿分
- 请教 , 我要将ORACLE数据库里的所有数字型的默认值设为0.可以吗???????????
- person_list_ := person_list_ || person_information.name|| ' <' || person_information.identity|| '>' || field_separator_;这句话是
- 用户密码忘记了怎么办?
- 关于透明网关的问题
- SQLPLUS无法启动
- oracle新手入门 求大神推荐电脑
- 我需要定义一个数据库连接过程,能够通用的连接数据库
- 如何引用另一个用户的过程或函数`
begin
.....
begin
select .. into ... from table;
--以下写有数据时的操作
..........
exception
when no_data_found then
--以下写没有数据时的操作
..........
end;
......
end;
cursor cur is select ....from table;
record table%rowtype;
begin
loop
fetch cur into record;
exitwhen cur%notfound;
....
end loop;
exception
when no_data_found then
....
end;
if i>0 then
....
--有数据
else
....
end if;
select count(*) into iCOunt form tablename where your conditions;if iCOunt=0 then
not find data
else
end if;
不过
plsql中when no_data_found 异常不用定义。
if cur%notfound then
.....
else
....
end if;
方法应该很多