我为你狂
为你而疯狂
posts - 29,comments - 9,trackbacks - 0


truncate table info_space

/*--------- 用户空间信息数据导入 -------------*/
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

/*--------- 部门空间信息数据导入 -------------*/
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

/*--------- 单位空间信息数据导入 -------------*/
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 小虎(年轻) 阅读(851) 评论(0)  编辑  收藏 所属分类: Oracle相关

只有注册用户登录后才能发表评论。


网站导航: