分页语句

select datetime, tb.*
  from (select rownum as rn, t.*
          from (select s.datetime,
                       s.microseconds,
                       s.imsi,
                       s.m_tmsi,
                       s.direction,
                       s.ipv4address,s.messageid,
                       s.gtp_teid,
                       s.lac,
                       s.tac,
                       s.ci,
                       s.rac,
                       s.enbid,
                       s.MMEUES1APID,
                       s.ENBUES1APID
                  from s1apmessage s
                 where 1 = 1
                 order by datetime) t
         where rownum <= 100) tb
where rn > 20


建表语句:

-- Create table
create table S1APMESSAGE
(
  datetime              DATE not null,
  microseconds          NUMBER(12) not null,
  messageid             NUMBER(12) not null,
  mmeues1apid           NUMBER(12),
  enbues1apid           NUMBER(12),
  traceid               NUMBER(8),
  enbid                 NUMBER(12),
  causegroup            NUMBER(8),
  causevalue            NUMBER(8),
  tac                   NUMBER(12),
  handovertype          NUMBER(8),
  e_rabid               NUMBER(8),
  ipv4address           VARCHAR2(50),
  ipv4address_ul        VARCHAR2(50),
  ipv4address_dl        VARCHAR2(50),
  gtp_teid              NUMBER(12),
  gtp_teid_dl           NUMBER(12),
  gtp_teid_ul           NUMBER(12),
  lac                   NUMBER(12),
  rac                   NUMBER(8),
  rncid                 NUMBER(12),
  ci                    NUMBER(12),
  throughput            NUMBER(12),
  m_tmsi                NUMBER(12),
  cndomain              NUMBER(5),
  rrcestablishmentcause NUMBER(5),
  imsi                  VARCHAR2(50),
  nasmessageid          NUMBER(12),
  eps_attach_type       NUMBER(1),
  imei                  VARCHAR2(50),
  eps_attach_result     NUMBER(1),
  nas_cause             NUMBER(5),
  nas_causeid           NUMBER(12),
  eps_update_type       NUMBER(1),
  eps_update_result     NUMBER(1),
  service_type          NUMBER(3),
  request_type          NUMBER(1),
  msgcontent            BLOB,
  eventid               NUMBER(12),
  direction             VARCHAR2(10),
  nasevent              NUMBER(12),
  epsbearerid           NUMBER(5),
  linepsepsbearerid     NUMBER(5),
  epsqos                NUMBER(5),
  pdntype               NUMBER(5)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 16K
    next 8K
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate indexes
create index IDX_TIME on S1APMESSAGE (DATETIME)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
create index S1_IMSI on S1APMESSAGE (IMSI)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );

猜你喜欢

转载自xixiyanqi.iteye.com/blog/1889632