加入收藏 | 设为首页 | 会员中心 | 我要投稿 商洛站长网 (https://www.0914zz.com/)- AI应用、CDN、边缘计算、云计算、物联网!
当前位置: 首页 > 数据库 > Oracle > 正文

Oracle生成单据编号存储过程的实例代码

发布时间:2020-09-01 09:46:48 所属栏目:Oracle 来源:互联网
导读:Oracle生成单据编号存储过程,在做订单类似的系统都可能会存在订单编号不重复,或是流水号按日,按年,按月进行重新编号。下面给大家分享oracle生成单据编号存储过程,需要的的朋友参考下吧

Oracle生成单据编号存储过程,在做订单类似的系统都可能会存在订单编号不重复,或是流水号按日,按年,按月进行重新编号。

可以参考以下存储过程

0 then if DIsAutoCreate=1 THEN if DResetType=1 then --按年份 if to_number(to_char(sysdate,'yyyy')) <>to_number(to_char(DDateValue,'yyyy')) then update "SysReceiptConfig" set "NO"=1,"DateValue"=to_date(sysdate) where "ReceiptCode"=TypeTable; else update "SysReceiptConfig" set "NO"="NO"+1 where "ReceiptCode"=TypeTable; end if; --年份 end if;--DResetType=1 if DResetType=2 then --按月份 if to_number(to_char(sysdate,'MM')) <>to_number(to_char(DDateValue,'MM')) then update "SysReceiptConfig" set "NO"=1,"DateValue"=to_date(sysdate) where "ReceiptCode"=TypeTable; else update "SysReceiptConfig" set "NO"="NO"+1 where "ReceiptCode"=TypeTable; end if; --月份 end if;--DResetType=2 if DResetType=3 then --按日 if to_number(to_char(sysdate,'dd')) <>to_number(to_char(DDateValue,'dd')) then update "SysReceiptConfig" set "NO"=1,"DateValue"=to_date(sysdate) where "ReceiptCode"=TypeTable; else update "SysReceiptConfig" set "NO"="NO"+1 where "ReceiptCode"=TypeTable; end if; --月份 end if;--DResetType=3 else update "SysReceiptConfig" set "NO"="NO"+1 where "ReceiptCode"=TypeTable; end if;--DResetType end if; strSql:=' select * from "SysReceiptConfig" where 1=1 '; strSql:=strSql ||' and "ReceiptCode"='''||TypeTable||''''; open cur_mycursor for strSql; end;

以上所述是小编给大家介绍的Oracle生成单据编号存储过程的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

(编辑:商洛站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读