<div id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New',courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New',monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">--演示隐式游标,系统自动声明,自动打开,自动使用并且自动关闭
emp sal = 1000;
|| sql%);
;
;方法:循环操作关闭游标*/代码声明了一个游标mycur * emp deptno = 20;
mycur; --打开游标mycur emprow; --把游标所指的纪录放到变量中
(mycur%notfound); --当游标没有指向行时退出循环
|| emprow.ename || || emprow.sal);
loop;mycur; --关闭游标;mycur ename,sal emp deptno = 30;
mycur;mycur empname,empsal;
mycur%notfound;
|| empname || || empsal);
loop;c* dept;
c;c vDept_row_record;
c;c* dept;
c;c vDept_row_record;
(c%notfound);
loop;cc vDept_row_record;
(c%) loop
c vDept_row_record;
vDept_row_record c loop
loop;c(sSal emp.sal%type,sEmpno emp.empno%type)* emp sal >= sSal empno > sEmpno;
record_data c(2500,6666) loop
c(sSal emp2.sal%type)* emp2 sal >= sSal ;
record_data c(2500) loop
(record_data.sal < 3000)emp2 sal = sal + 3 c;
emp2 sal = sal - 3 c;
;
删除和修改提取的数据行的类型;
;(which = )
mycur * dept;
mycur deptrow;
(mycur%notfound);
|| deptrow.dname);loop;)mycur * emp;
mycur emprow;
(mycur%notfound);
|| emprow.ename);loop;;
mycur;提取的数据行的类型 ,只能是record或%rowtype类型number是错的, emp.ename%type也是错的
emp%rowtype;
mycur * emp;
mycur emprow;
mycur%notfound;
|| emprow.ename);mycur;;