Oracle/PLSQL: FETCH Statement
来源:互联网 发布:js半圆形仪表盘占比 编辑:程序博客网 时间:2024/05/16 08:19
Oracle/PLSQL: FETCH Statement
The purpose of using a cursor, in most cases, is to retrieve the rows from your cursor so that some type of operation can be performed on the data. After declaring and opening your cursor, the next step is to FETCH the rows from your cursor.
译:大多数情况下,使用游标的目的,就是从你的游标中取得行,然后可以对这些数据进行一些操作。声明操作游标后,下一步就是从游标中FETCH行了。
The basic syntax for a FETCH statement is:
FETCH cursor_name INTO <list of variables>;
For example, you could have a cursor defined as:
译:例如,你可以象下面这样定义游标
CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
The command that would be used to fetch the data from this cursor is:
译:用于从游标中取数据的的命令如:
FETCH c1 into cnumber;
This would fetch the first course_number into the variable called cnumber;
译:这将会把第一个course_number取到名为cnumber的游标中。
Below is a function that demonstrates how to use the FETCH statement.
译:下面是一个演示如何使用FETCH语句的方法。
CREATE OR REPLACE Function FindCourse
( name_in IN varchar2 )
RETURN number
IS
cnumber number;
( name_in IN varchar2 )
RETURN number
IS
cnumber number;
CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
BEGIN
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
BEGIN
open c1;
fetch c1 into cnumber;
if c1%notfound then
cnumber := 9999;
end if;
close c1;
fetch c1 into cnumber;
if c1%notfound then
cnumber := 9999;
end if;
close c1;
RETURN cnumber;
END;
- Oracle/PLSQL: FETCH Statement
- Oracle/PLSQL: Case Statement
- Oracle/PLSQL: Exit Statement
- Oracle/PLSQL: OPEN Statement
- Oracle / PLSQL: ALTER TABLE Statement
- Oracle/PLSQL: WHERE CURRENT OF Statement
- Oracle/PLSQL: WHERE CURRENT OF Statement
- Oracle/PLSQL: WHERE CURRENT OF Statement
- Oracle/PLSQL: WHERE CURRENT OF Statement
- PLSQL:Exit Statement
- PLSQL 循环游标 cursor loop fetch into
- PLSQL Bulk Bind (FETCH BULK COLLECT INTO)
- oracle plsql
- oracle plsql
- oracle plsql
- oracle--PLSQL
- oracle plsql
- fetch oracle 存储过程
- Rational 统一过程
- 弹出对话框的同时保持页面的显示
- 质量管理的十三项步骤和八项原则(1)
- PreparedStatement的用法
- Web service到底是什么?
- Oracle/PLSQL: FETCH Statement
- 质量管理体系审核全解(1)
- 使用system.net中常用class来取得web 资源(webClient....)
- .net生成静态页面(转载死亡调零http://blog.csdn.net/zdyguilong)
- scjp的基础概念
- 30岁,我的程序员梦想
- asp.net中有四种页面跳转导航方式
- 用php实现gb2312和unicode间的编码转换
- 编写质量手册