存储过程:
declare cursor cu_student(minAge in number,maxAge in number) is
select * from students
where student_age>=minAge and student_age<=maxAge;
student students%rowtype;begin
open cu_student(19,20);
fetch cu_student into student;while cu_student%found loop
dbms_output.put_line(student.student_name||':'||
student.student_age||'岁');
fetch cu_student into student;
end loop;close cu_student;
end;请问如下语句在如上存储过程中是什么意义?由其是while cu_student%found loop这句是什么意思?-while cu_student%found loop
-dbms_output.put_line(student.student_name||':'||
-student.student_age||'岁');
-fetch cu_student into student;
-end loop;
declare cursor cu_student(minAge in number,maxAge in number) is
select * from students
where student_age>=minAge and student_age<=maxAge;
student students%rowtype;begin
open cu_student(19,20);
fetch cu_student into student;while cu_student%found loop
dbms_output.put_line(student.student_name||':'||
student.student_age||'岁');
fetch cu_student into student;
end loop;close cu_student;
end;请问如下语句在如上存储过程中是什么意义?由其是while cu_student%found loop这句是什么意思?-while cu_student%found loop
-dbms_output.put_line(student.student_name||':'||
-student.student_age||'岁');
-fetch cu_student into student;
-end loop;
解决方案 »
- Oralce查询语句执行函数先后问题
- SQL语句的优化
- oracle过程中执行动态的Sql语句Sql_insert:='insert into '|| srctable || '('||fielda,filedb||')'|| ' values( '||a,b ||')',有具体说
- 求Oracle10g在Windows 2000或者2003或者XP做RAC的文档
- 错误:ora-12699 本机服务内部错误
- 初级问题
- ORA-12560: TNS: 协议适配器错误
- 如何实现ORACLE象SQLSERVER一样实现INT的自动加一的功能??
- ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exit是进入LQLPLUS的错误提示,请问这是什么错误,急!急
- 关于oralce一条查询语句的优化问题
- ----- 数据库导入 imp问题 -----
- 如何导入数据库的方案
declare
--定义一个参数游标,参数为minAge,maxAge
cursor cu_student(minAge in number, maxAge in number) is
select *
from students
where student_age >= minAge
and student_age <= maxAge;
--定义一个students类型的变量
student students%rowtype;
begin
open cu_student(19, 20); --打开游标,用19,20作参数
fetch cu_student --取出一条记录到student变量中
into student; while cu_student%found loop --当发现有取出记录时,循环游标,没有取得记录时就会退出
dbms_output.put_line(student.student_name || ':' || --打印当前取出的这记录信息
student.student_age || '岁');
fetch cu_student --从游标中取出一条记录到student变量中
into student;
end loop; close cu_student; --游标需要关闭
end;