存储过程
来源:互联网 发布:python keras 人脸 编辑:程序博客网 时间:2024/05/16 09:27
create or relpace PROCEDURE P_B
is
v_type varchar2(1);--定义输出类型变量
v_count int;--定义最后条数变量
--定义游标
CURSOR cur_b
IS
select b1.type,count(*) from b1,b2 where b1.type1=b2.type1 group by b1.type;--这个sql运行的结果其实就是你想要的数据
begin
--打开游标
open cur_b;
loop
--取出游标中的结果
fetch cur_b into v_type,v_count;
exit when cur_b%notfound;
--输出结果
dbms_output.put_line(v_type||','||v_count);
--结束循环
end loop;
--关闭游标
close cur_b;
--存储过程执行完毕
end;
执行存储过程:exec P_B
0 0
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 火狐浏览器安装firebug 图文介绍
- 程序员面试题精选100题(23)-跳台阶问题[算法]
- getHibernateTemplate().execute(new HibernateCallback())方法
- Eclipse集成maven插件m2eclips
- Android五种数据传递方法汇总
- 存储过程
- 2、尚观笔记 - 4
- Openfire报账号或密码错误_c#版UC客户端登录
- RGB、YUY2、YUYV、YVYU、UYVY、AYUV
- Thinkphp常用常量
- Node.js at PayPal
- 解决Hibernate中MySQL的中文排序
- SVN使用总结
- QT: 如何实现程序的单实例运行检测?