heting

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            40 隨筆 :: 9 文章 :: 45 評論 :: 0 Trackbacks
          <2010年10月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

           

          create or replace package CARD_SERVICE_DAY_VIEW_PARAM  is 
             
          function set_param(num varcharreturn varchar
             
          function get_param  return varchar

             
          end CARD_SERVICE_DAY_VIEW_PARAM; 
          commit;
             
             
          create or replace package body CARD_SERVICE_DAY_VIEW_PARAM is 
                 paramValue 
          varchar(10); 
                 
          function set_param(num varcharreturn varchar is 
                 
          begin 
                   paramValue:
          =num; 
                   
          return num; 
                  
          end;  
                 
                 
          function get_param return varchar is 
                 
          begin 
                   
          return paramValue; 
                 
          end
                 
             
          end CARD_SERVICE_DAY_VIEW_PARAM;    
          commit;

          create or replace view CARD_SERVICE_DAY_VIEW as 
          select
          cs.id,
          cs.card_id,
          cs.lock_money,
          to_char(cs.check_time,
          'yyyy-MM-dd hh24:mi'as check_time,
          cs.name,cs.phone,( months_between(to_date(CARD_SERVICE_DAY_VIEW_PARAM.get_param(),
          'yyyyMMdd'),
          to_date(to_char(cs.CHECK_TIME,
          'yyyyMMdd'),'yyyyMMdd'))  ) as curr_batch,
          (
          select count(1from transaction where card_id=cs.card_id and tran_time between cs.check_time and to_date(CARD_SERVICE_DAY_VIEW_PARAM.get_param(),'yyyyMMdd'and (curr_bal-money)<cs.lock_money) as condition,
          (
          select count(1from service_transaction where batch=(months_between(to_date(CARD_SERVICE_DAY_VIEW_PARAM.get_param(),'yyyyMMdd'),to_date(to_char(cs.CHECK_TIME,'yyyyMMdd'),'yyyyMMdd'))) and s_id=cs.id) as hasAudit 
          from card_service cs 
          where cs.state='T' 
          and 
          months_between(to_date(CARD_SERVICE_DAY_VIEW_PARAM.get_param(),
          'yyyyMMdd'),to_date(to_char(cs.CHECK_TIME,'yyyyMMdd'),'yyyyMMdd')) in (1,2,3,4,5,6
          order by cs.card_id
          commit;
          posted on 2010-10-11 15:26 賀挺 閱讀(545) 評論(0)  編輯  收藏 所屬分類: 數(shù)據(jù)庫

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 鞍山市| 城口县| 余江县| 珲春市| 平和县| 乌鲁木齐县| 青州市| 大同市| 枝江市| 桃园市| 呼和浩特市| 天水市| 安福县| 宝应县| 苍溪县| 聂荣县| 沙湾县| 开远市| 博白县| 桐柏县| 六安市| 九江县| 铁力市| 高台县| 亳州市| 堆龙德庆县| 龙州县| 福清市| 潼关县| 安徽省| 宜宾县| 邯郸县| 徐闻县| 碌曲县| 鸡泽县| 南汇区| 贺州市| 雅江县| 江油市| 新乐市| 睢宁县|