表结构和创建过程如下:
-- Create table
create table TBL_CALL_REC
(
seqnum NUMBER(10) not null,
row_date DATE,
row_time NUMBER(10),
acwtime NUMBER(10)
);
-- Create/Recreate primary, unique and foreign key constraints
alter table TBL_CALL_REC
add constraint PK_SEQNUM primary key (SEQNUM)
using index
tablespace BOUSER
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
数据如下:
--创建视图日志
create materialized view log on tbl_call_rec with rowid;
--创建物化视图,在需要时fast刷新
create materialized view mv_call_rec refresh fast on demand
as
select period_time,sum(acwtime) from
(
SELECT DECODE(LENGTH(row_time),3,lpad(SUBSTR(row_time,1,1),2,'0')||':00--'||lpad(SUBSTR(row_time,1,1),2,'0')||':59',4,SUBSTR(row_time,1,2)||':00--'||SUBSTR(row_time,1,2)||':59') AS
period_time,acwtime FROM cms_call_rec
)a group by period_time
表结构和创建过程如下:
-- Create table
create table TBL_CALL_REC
(
seqnum NUMBER(10) not null,
row_date DATE,
row_time NUMBER(10),
acwtime NUMBER(10)
);
-- Create/Recreate primary, unique and foreign key constraints
alter table TBL_CALL_REC
add constraint PK_SEQNUM primary key (SEQNUM)
using index
tablespace BOUSER
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
数据如下:
--创建视图日志
create materialized view log on tbl_call_rec with rowid;
--创建物化视图,在需要时fast刷新
create materialized view mv_call_rec refresh fast on demand
as
select period_time,sum(acwtime) from
(
SELECT DECODE(LENGTH(row_time),3,lpad(SUBSTR(row_time,1,1),2,'0')||':00--'||lpad(SUBSTR(row_time,1,1),2,'0')||':59',4,SUBSTR(row_time,1,2)||':00--'||SUBSTR(row_time,1,2)||':59') AS
period_time,acwtime FROM cms_call_rec
)a group by period_time