oracle创建临时表

-- oracle临时表,先创建,后使用
create global temporary table TMP_CUSTOMERINFO
(
  BRANCHFLAG      CHAR(3) not null,
  CUSTOMERID      VARCHAR2(11) not null,
  CUSTOMERNO      VARCHAR2(20),
  CUSTOMERNAME    VARCHAR2(200),
  GROUPCUSTOMERNO VARCHAR2(20),
  CUSTOMERTYPE    CHAR(1),
  DENGJI          CHAR(3)
)
on commit delete rows          --在事务提交后数据就已经清除了.
--or
--on commit preserve rows;   --在会话中止时或者导常退出时数据都会被清除掉.

-- Add comments to the columns
comment on column TMP_CUSTOMERINFO.BRANCHFLAG
  is '公司标识';
comment on column TMP_CUSTOMERINFO.CUSTOMERID
  is '客户id';
comment on column TMP_CUSTOMERINFO.CUSTOMERNO
  is '客户编号';
comment on column TMP_CUSTOMERINFO.CUSTOMERNAME
  is '客户名称';
comment on column TMP_CUSTOMERINFO.GROUPCUSTOMERNO
  is '客户统一编号';
comment on column TMP_CUSTOMERINFO.CUSTOMERTYPE
  is '客户类别';
comment on column TMP_CUSTOMERINFO.DENGJI
  is '客户等级';
-- Create/Recreate primary, unique and foreign key constraints
alter table TMP_CUSTOMERINFO
  add primary key (BRANCHFLAG, CUSTOMERID);

原文地址:https://www.cnblogs.com/pan11jing/p/1513110.html