码迷,mamicode.com
首页 > 其他好文 > 详细

游标 根据目录号 操作用户 查看 对应得影像数

时间:2016-08-16 16:02:10      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:

declare

--定义一个变量
icount number(18);
begin
for cur_entry in (

--查询的语句根据目录号、用户查询出entry_id,案卷号

select entry_id,file_code from am_c_entry where catalogue_code=‘B-11-1-11‘ and
created_by=‘sa‘

) loop

--变量初始值
icount:=0;
execute immediate ‘

select count(*) from am_c_page where entry_id=‘||cur_entry.entry_id into icount;

--输出符合条件的结果
dbms_output.put_line(‘案卷号:‘||cur_entry.file_code||‘影像数:‘||icount);
end loop;
end;

输出如下:

案卷号:1影像数:8

游标 根据目录号 操作用户 查看 对应得影像数

标签:

原文地址:http://www.cnblogs.com/ylldbk/p/5776523.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!