FUN_SYS_GET_CALENDAR_WEEK

CREATE OR REPLACE FUNCTION LBI_SYS_VDF.FUN_SYS_GET_CALENDAR_WEEK
(
       iv_date          varchar2,
       ii_calendar_flag number,
       ii_action_flag   number
)
/** head
  * @name lbi_sys#fun_sys_get_calendar_week
  * @caption  automatic get the what's the week input day is.
  * @type     primarily management program
  * @parameter iv_date in varchar2 deal date.Formate:yyyymmdd
  * @parameter ii_calendar_flag in number execute state:
                    0 means first week start with Jan 1st ;
                    1 means first week start with the first sunday of the year.
                    other means error
  * @parameter ii_action_flag in number execute state:
                    0 means get the add week ;
                    1 means delete the old week.
                    2 means it's not about t_s_det_week table
  * @description  automatic management of partition by day
  * @target
  * @source
  * @middle
  * @version 1.0.000
  * @author wenchenteng
  * @create-date
  * @todo
  * @author
  * @create-date 2012-07-31
  * @description
  * @copyright Huawei
  */
return varchar2

as

    vd_deal_date        date; --The date you want to deal with
    vd_flag_date        date; --The data for checking whether Jan 1st is sunday
    vi_flag_week        integer; --The number of dealing week in The t_s_det_week table
    vd_first_week_date  date; --The first sunday of the year when Jan 1st is not the first sunday
    vd_first_week_date1  date; --The first sunday of the last year when Jan 1st is not the first sunday
    vi_loop_num         integer := 1; -- The number for checking the
    vi_minus_num        integer; -- The minus number of dealing date minus first sunday
    vi_minus_num1        integer; -- The minus number of last date of last year minus first sunday
    ov_return           varchar2(6); -- The return week
    oi_return           integer; --The result code when excetion
    exc_calendar_err    exception; -- The exception for insert or delete error

begin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值