-----------------------------------
create table testflow
(
userid number,
flowup number,
flowdown number
)
create table testflow
(
userid number,
flowup number,
flowdown number
)
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
commit
insert into testflow values (3,3,2);
commit
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (1,1,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (2,4,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
insert into testflow values (3,3,2);
commit
insert into testflow values (3,3,2);
commit
select count(*) from testflow;
create table userinfo
(
userid number,
userinfo char(20)
)
create table userinfo
(
userid number,
userinfo char(20)
)
insert into userinfo values(1,'qqq');
insert into userinfo values(2,'www');
insert into userinfo values(3,'eee');
commit
insert into userinfo values(2,'www');
insert into userinfo values(3,'eee');
commit
create table useraccount1
(
username char(20)
)
(
username char(20)
)
insert into useraccount1 values('qqq');
insert into useraccount1 values('eee');
commit
insert into useraccount1 values('eee');
commit
create table userid
(
userid number
)
(
userid number
)
insert into userid (userid)
select u.userid from userinfo u,useraccount1 ua where u.userinfo=ua.username;
commit
select * from userid
commit
select u.userid from userinfo u,useraccount1 ua where u.userinfo=ua.username;
commit
select * from userid
commit
select sum(fl.flowup+fl.flowdown) from testflow fl,userinfo u where fl.userid=u.userid and u.userid in (1,2,3,1)
select sum(fl.flowup+fl.flowdown) from testflow fl,userinfo u where fl.userid=u.userid and u.userid in (select userid from userid)
select
drop table "GCY1"."USER_LOAD"
CREATE TABLE "GCY1"."USER_LOAD"
( "USERID" NUMBER NOT NULL ENABLE,
"CHARTITO" NVARCHAR2(30),
"TIMEBEGIN" NVARCHAR2(30),
"TIMEEND" NVARCHAR2(30)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
select count(*) from "GCY1"."USER_LOAD"
CREATE TABLE "GCY1"."USER_LOAD"
( "USERID" NUMBER NOT NULL ENABLE,
"CHARTITO" NVARCHAR2(30),
"TIMEBEGIN" NVARCHAR2(30),
"TIMEEND" NVARCHAR2(30)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
select count(*) from "GCY1"."USER_LOAD"
exp gcy1/gcy1 tables=sys.testflow,sys.userinfo,sys.useraccount1,USER_LOAD file=gcy1.dmp
create user gcy3 identified by gcy3
grant sysdba,CREATE SESSION to gcy3
imp gcy1/gcy1 fromuser=gcy1 touser=gcy3 file=gcy1.dmp full=y
imp gcy1/gcy1 fromuser=gcy1 touser=gcy3 file=gcy1.dmp
create user gcy3 identified by gcy3
grant sysdba,CREATE SESSION to gcy3
imp gcy1/gcy1 fromuser=gcy1 touser=gcy3 file=gcy1.dmp full=y
imp gcy1/gcy1 fromuser=gcy1 touser=gcy3 file=gcy1.dmp
testflow,userinfo,useraccount1,USER_LOAD
select * from user_tables
sqlldr userid=gcy1/gcy1 control=user_load.ctl
select * from user_tables
sqlldr userid=gcy1/gcy1 control=user_load.ctl
load data
infile 'TITO_PCRF_26-05-2011_0315AM.txt'
insert into table USER_LOAD
fields terminated by ","
(USERID,CHARTITO,TIMEBEGIN,TIMEEND)
infile 'TITO_PCRF_26-05-2011_0315AM.txt'
insert into table USER_LOAD
fields terminated by ","
(USERID,CHARTITO,TIMEBEGIN,TIMEEND)
select sum(up+down) from user_flow u,
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25243263/viewspace-696727/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25243263/viewspace-696727/