create or replace procedure update_hb_order_state is
--商城卡
CURSOR funds_ssk--前一天商城卡支付金额
IS
select t.order_id as order_id,is_reconciliation
from hb_order_settle t where t.settle_type = 2
and to_char(t.settle_time, 'yyyy-MM-dd') = to_char(sysdate - 1, 'yyyy-MM-dd');
CURSOR cusor_a--前一天商城卡支付金额根据订单号分组
IS
select t.order_id as order_id
from hb_order_settle t where t.settle_type = 2
and to_char(t.settle_time, 'yyyy-MM-dd') = to_char(sysdate - 1, 'yyyy-MM-dd') group by t.order_id;
--兑换卡
cursor funds_ddk--前一天兑换卡支付金额
is
select t3.id as order_id
from hb_goods_card t1, hb_goods_card_type t2, hb_order t3
where to_char(t1.change_time, 'yyyy-MM-dd') = to_char(sysdate - 1, 'yyyy-MM-dd')
and t1.type_code = t2.type_code and t3.goods_card_num = t1.card_num;
--实物销售
cursor funds_swss--前一天的实物销售数据
is
select t.id as order_id from hb_order t where t.order_type = 4
and to_char(t.insert_time, 'yyyy-MM-dd') = to_char(sysdate - 1, 'yyyy-MM-dd');
recon number;--1未对账
begin
--如果商城卡支付全部已对账则将主订单对账状态改为0
for a in cusor_a loop
--判断是否全部已对账
for b in funds_ssk loop
if a.order_id = b.order_id
then
if b.is_reconciliation <> 0--如果这组订单包含未对账的
then
recon := 1;
end if;
end if;
end loop;
if recon <> 1
then
update hb_order t set t.is_reconciliation = 0 where t.id = a.order_id;
end if;
end loop;
--兑换卡
FOR o IN funds_ddk LOOP
update hb_order t set t.is_reconciliation = 0 where t.id = o.order_id;
end LOOP;
--实物销售
FOR o IN funds_swss LOOP
update hb_order t set t.is_reconciliation = 0 where t.id = o.order_id;
end LOOP;
commit;
end update_hb_order_state;
分享到:
相关推荐
本文实例讲述了Python使用cx_Oracle调用Oracle存储过程的方法。分享给大家供大家参考,具体如下: 这里主要测试在Python中通过cx_Oracle调用PL/SQL。 首先,在数据库端创建简单的存储过程。 create or replace ...
oracle 存储过程实例 oracle存储过程实例
oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel
oracle 存储过程 unwrap 图形解密 工具
可以将SQL Server存储过程转为oracle存储过程的工具
ibatis调用oracle存储过程分页
帆软报表调用Oracle存储过程如果存储过程定义中没有参数,但是设计器中缺弹出一个storeParameter1参数的解决插件
4、开发指南:《Oracle存储过程入门指南&100+种真实业务场景存储过程实例.pdf》,可以帮助初学者系统学习。 5、资源包括“通用存储过程整理” 和 “真实业务存储过程整理” 两部分,通用适合各种系统,可以无缝隙...
oracle存储过程加密破解 0
使用java实现oracle存储过程。 共有3个小例子。实现的功能 1、无返回值的存储过程 如 insert 2、有返回值的存储过程(非列表)select id from tab 3、返回列表 如:select * from tab 顺便鄙视下csdn,作为一个it...
oracle存储过程学习经典入门 非常好的 初学者必看
oracle 存储过程 函数 dblink 绝对对工作和平时学习有价值的资料。针对个人具体情况做修改即可使用
Oracle存储过程中使用临时表 会话级临时表 事务级临时表
oracle 存储过程批量提交
oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记
行业内Oracle存储过程最基本的开法规范,适合oracle入门小白学习
oracle 存储过程实例 oracle 存储过程实例 oracle 存储过程实例 oracle 存储过程实例
linux系统中使用shell脚本对oracle存储过程进行编译
oracle存储过程+日期+定时任务Job oracle存储过程+日期+定时任务Job oracle存储过程+日期+定时任务Job