oracle存储过程高级,Oracle高级编程(存储过程)

Oracle高级编程

存储过程

84c3847f533030822762fae74a5f912d.png

PL/SQL procedure successfully completed

SQL> declare

2 --创建一个游标类型

3 type demo_emp_cursor is ref cursor ;

4 --实例化一个demo_emp_cursor类型的对象

5 test_cursor demo_emp_cursor;

6 --定义变量

7 v_ename emp.ename%type;

8 v_sal emp.sal%type;

9 begin

10 --把游标加入SELECT语句中

11 open test_cursor for select ename , sal into v_ename,v_sal from emp;

12 --开始循环

13 Loop

14 --游标指向数据

15 fetch test_cursor into v_ename,v_sal;

16 exit when test_cursor%notfound ;

17 dbms_output.put_line('姓名:'||v_ename||' 工资:'||v_sal);

18 end loop;

19 close test_cursor;

20 end;

21 /

姓名:SMITH 工资:1400

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值