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

ORACLE中的游标集锦

2013-04-09 
ORACLE中的游标汇总游标(Cursor):用来查询数据库,获取记录集合(结果集)的指针,可以让开发者一次访问一行结

ORACLE中的游标汇总
游标(Cursor):用来查询数据库,获取记录集合(结果集)的指针,可以让开发者一次访问一行结果集,在每条结果集上作操作。
????游标可分为:
???

cursor emp_cur ( p_deptid in number) is
set serveroutput on
declare
select * from employees where department_id = p_deptid;

?

l_emp
declare
begin
?update departments???游标FOR循环,简化游标操作my_dept_rec
Declare
?
?Cursor
declare
?--声明记录类型
?type
CREATE OR REPLACE PACKAGE
CREATE OR REPLACE PACKAGE BODY
create or replace procedure open_cv(choice
CREATE or replace procedure retrieve_data(choice IN INT) is


emp_rec
create or replace procedure REF_BULK is


?
type
Declare
typerc?is ref cursor;
cursor?c?is?select * from dual;

?

l_cursor?rc;
begin
if ( to_char(sysdate,'dd') = 30 ) then
???????open?l_cursor?for?'select * from emp';
elsif ( to_char(sysdate,'dd') = 29 ) then
???????open?l_cursor?for?select * from dept;
else
???????open?l_cursor?for?select * from dual;
end if;
open c;
end;
/?