我為你狂
          為你而瘋狂
          posts - 29,comments - 9,trackbacks - 0


          truncate table info_space

          /*--------- 用戶空間信息數(shù)據(jù)導(dǎo)入 -------------*/
          insert into info_space(SPACE_ID,OBJ_ID,TOTAL,USEING,FIELD_1,STATE,SPACE_TYPE,ORG_ID)
          select user_id,user_id,'50',round(dbms_random.value(1,20),0),'','1','user_space',org_id from sys_user

          /*--------- 部門空間信息數(shù)據(jù)導(dǎo)入 -------------*/
          insert into info_space(SPACE_ID,OBJ_ID,TOTAL,USEING,FIELD_1,STATE,SPACE_TYPE,ORG_ID)
          select DEPT_ID,DEPT_ID,'200',round(dbms_random.value(1,40),0),'','1','dept_space',org_id from sys_dept

          /*--------- 單位空間信息數(shù)據(jù)導(dǎo)入 -------------*/
          insert into info_space(SPACE_ID,OBJ_ID,TOTAL,USEING,FIELD_1,STATE,SPACE_TYPE,ORG_ID)
          select ORG_ID,ORG_ID,'500',round(dbms_random.value(1,50),0),'','1','union_space',ORG_ID from sys_org


          update info_space m set m.useing= (
          select a.file_size from
            (
            select b.send_person,sum(c.file_size)as file_size from
            (select t.bulletin_id,t.send_person from e_bulletin t where t.is_files='1') b,
            (select f.object_id,f.file_size/1024 as file_size from file_relation f)c
            where b.bulletin_id=c.object_id
            group by b.send_person
          )a where a.send_person=m.obj_id
          )

           

           

           

           

           

           

          update info_space m set m.useing= (
            select a.file_size from
            (
            select t.bulletin_id,t.send_person,f.file_size/1024 as file_size,p.total,p.useing
            from e_bulletin t,file_relation f,cgqfile.sys_files s,info_space p
            where t.is_files='1' and t.bulletin_id=f.object_id and f.file_id=s.file_id and p.obj_id=t.send_person

            )a where a.send_person=m.obj_id
          )

          update info_space m set m.useing= (select 1 from 2 where 2.3=m.3)


          update info_space m set m.useing= (
          select a.file_size from
            (
            select b.send_person,sum(c.file_size)as file_size from
            (select t.bulletin_id,t.send_person from e_bulletin t where t.is_files='1') b,
            (select f.object_id,f.file_size/1024 as file_size from file_relation f)c
            where b.bulletin_id=c.object_id
            group by b.send_person
          )a where a.send_person=m.obj_id
          )

          posted on 2009-06-09 11:30 小虎(年輕) 閱讀(872) 評論(0)  編輯  收藏 所屬分類: Oracle相關(guān)
          主站蜘蛛池模板: 盈江县| 太保市| 安远县| 兴义市| 英吉沙县| 台中市| 云阳县| 棋牌| 盘锦市| 色达县| 澄迈县| 仁寿县| 阿瓦提县| 太仓市| 天镇县| 邢台市| 扶余县| 通化市| 门源| 福贡县| 文成县| 左权县| 华蓥市| 石台县| 泾阳县| 伊春市| 张家川| 永泰县| 永善县| 泰来县| 四会市| 巴林左旗| 资中县| 张家口市| 长沙县| 云安县| 屏边| 兴海县| 额济纳旗| 东海县| 北票市|