手机
当前位置:查字典教程网 >编程开发 >Oracle教程 >oracle 声明游标(不具备字段)规则应用
oracle 声明游标(不具备字段)规则应用
摘要:在开发过程中可能会声明一个含有某张表不具备字段的游标,来解决特殊问题,本文将详细介绍这类问题,需要了解更多的朋友可以参考下其中,data.*...

在开发过程中可能会声明一个含有某张表不具备字段的游标,来解决特殊问题,本文将详细介绍这类问题,需要了解更多的朋友可以参考下

其中,data.*是一张表,然后把其他表中的字段也加到sal_data的游标中

Sql代码

复制代码 代码如下:

cursor sal_data(cp_center_temp_id varchar2) is

select data.*,

post.id emp_post_id,

doc.Salary_Tax_Bd sa_tax_bd,

batch.bill_year_month bill_year_month,

batch.id batch_id,

post.emp_id employee_id

from sa_salary_data data

left join sa_salary_batch batch

on data.sa_batch_id = batch.id

left join sa_salary_document doc

on data.sa_doc_id = doc.id

left join pb_emp_post post

on doc.emp_post_id = post.id

left join pb_send send

on post.send_id = send.id

where send.cost_center_id = cp_center_temp_id;

使用此游标:

声明一个此游标类型的变量:

Sql代码

复制代码 代码如下:

salary_data_temp sal_data%rowtype;

然后编译此游标

Sql代码

复制代码 代码如下:

open sal_data(center_temp.id);

loop

fetch sal_data

into salary_data_temp;

exit when sal_data%notfound;

--TODO

end loop;

colse sal_data;

【oracle 声明游标(不具备字段)规则应用】相关文章:

Oracle数据库处理多媒体信息

oracle 删除重复数据

Oracle DBA常用语句第1/2页

Oracle 存储过程总结(一、基本应用)

oracle清理日常备份数据及恢复误删除表

oracle常用sql语句

oracle 日期函数集合(集中版本)第1/2页

Oracle] 解析在没有备份的情况下undo损坏怎么办

oracle数据库中如何处理clob字段方法介绍

oracle 多个字符替换实现

精品推荐
分类导航