这个存储过程编译后提示是正确的,但用Execute show_dept 来执行它,确什么提示都没有,请问在那里有错误? create or replace procedure show_dept
as
a1 NUMBER ;
o varchar(20);
begin
FOR a1 IN 1..3 LOOP
select dname into o from scott.dept where deptno = a1;
dbms_output.put_line(o);
END LOOP;
end;
as
a1 NUMBER ;
o varchar(20);
begin
FOR a1 IN 1..3 LOOP
select dname into o from scott.dept where deptno = a1;
dbms_output.put_line(o);
END LOOP;
end;
解决方案 »
- on、where、having的区别
- 如何通过oci编程连接到oracle(只提供ip地址和端口,数据库名,用户名,密码)
- 在这种情况下我应该如何写sql语句?
- 在sql检索数据的时候,就是where in语句,检索一个字段是肯定可以的.但能否用两个字段来做为in的条件
- 消除重复行,如何实现!急~~(不是完全重复的记录。)
- 调查问卷建库,每个问题一条记录,但每个问题可多选,显示时答案要分开显示,那位高人指点,如何处理?
- 请教一条查询语句
- 请教一个SQL的问题??
- oracle 中有没有类似sql中percent的东东
- select 语句的from 中 能用函数吗?
- Oracle数据库导入外部dmp报错的问题
- 求助,急.plsql链接报ORA-12514
show show_dept();是用的这个来执行的,但是还是什么都没有。
set serveroutput on;
exec show_dept;
就是scott.dept这个表没deptno=1,2,3的数据了.
execute show_dept;
错误报告:
ORA-01403: 未找到任何数据
ORA-06512: 在 "SYS.SHOW_DEPT", line 7
ORA-06512: 在 line 1
01403. 00000 - "no data found"
*Cause:
*Action:
ACCOUNTING
as
a1 NUMBER ;
o varchar(20);
begin
FOR a1 IN 1..3 LOOP
begin
select dname into o from scott.dept where deptno = a1;
dbms_output.put_line(o);
when no_data_found then
dbms_output.put_line('没有编码为'||a1||此部门');
end;
END LOOP;
exception
when others then
dbms_output.put_line(sqlcode||' '||sqlerrm); end;