1.参考
oracle两种临时表的创建及使用方法_oracle 临时表-CSDN博客
【SQL】全局临时表 GLOBAL TEMPORARY TABLE-CSDN博客
2.语句
CREATE GLOBAL TEMPORARY TABLE tablename (columns) [ ON COMMIT PRESERVE | DELETE ROWS ]
3.应用
CREATE GLOBAL TEMPORARY TABLE "SEC_BASE" ( "C_SEC_CODE" VARCHAR2(100) DEFAULT ' ' NOT NULL ENABLE, "C_SEC_NAME" VARCHAR2(200) DEFAULT ' ' NOT NULL ENABLE, "C_SEC_MKT_CODE" VARCHAR2(30) DEFAULT ' ' NOT NULL ENABLE, "C_SEC_ISIN_CODE" VARCHAR2(40), "C_MKT_CODE" VARCHAR2(40) DEFAULT ' ' NOT NULL ENABLE, "C_SEC_VAR_CODE" VARCHAR2(40) DEFAULT ' ' NOT NULL ENABLE, "C_DC_CODE" VARCHAR2(40) DEFAULT ' ' NOT NULL ENABLE, "N_PRICE_FCR" NUMBER(18,4) DEFAULT 1 NOT NULL ENABLE, "C_SEC_CODE_TRG" VARCHAR2(100), "N_AMOUNT_HD" NUMBER(18,4) DEFAULT 1 NOT NULL ENABLE, "N_FV_ISSUE" NUMBER(30,15) DEFAULT 1 NOT NULL ENABLE, "D_TO_LIST" DATE DEFAULT TO_TIMESTAMP('1900-01-01','YYYY/MM/DD') NOT NULL ENABLE, "D_OFF_LIST" DATE DEFAULT TO_TIMESTAMP('1900-01-01','YYYY/MM/DD') NOT NULL ENABLE, "N_BLXS" NUMBER(15,8), "C_JCJG" VARCHAR2(120), "N_UPPER_LIMIT" NUMBER(15,8), "N_LOWER_LIMIT" NUMBER(15,8), "C_INTERVAL_TIME" VARCHAR2(4000), "C_INTERVAL_DAY" VARCHAR2(20), "C_SETT_ORG" VARCHAR2(100), "N_XSFWFL" NUMBER(18,8), "C_TGR_CODE" VARCHAR2(50), "C_TGR_NAME" VARCHAR2(50), "D_TO_LIST_ZQ" DATE DEFAULT TO_TIMESTAMP('1900-01-01','YYYY/MM/DD'), "C_FXJG_CODE" VARCHAR2(20) DEFAULT ' ', "C_MAIN_PROP" VARCHAR2(20) DEFAULT ' ', "C_GUAR_TYPE" VARCHAR2(20), "C_FINA_COMM" VARCHAR2(20), "C_SFJF" VARCHAR2(20), "D_SQAI_BEGIN" DATE, "C_BASE_DATE_TYPE" VARCHAR2(50), "N_BASE_DATE" NUMBER(3,0), "C_DUE_DATE_TYPE" VARCHAR2(50), "N_DUE_DATE" NUMBER(3,0), "C_FINANCE_TOOL" VARCHAR2(30) DEFAULT ' ', "C_KZCD_GQ" VARCHAR2(20), "C_SEC_NAME_CN" VARCHAR2(20), "C_EXT_ASS_CODE" VARCHAR2(20), "C_GLF" VARCHAR2(50), "C_ORG_TYPE" VARCHAR2(20), "C_ISSUERS_CODE" VARCHAR2(50) DEFAULT ' ' NOT NULL ENABLE, "D_CHANGE_LIST" DATE DEFAULT to_timestamp('9998-12-31','YYYY/MM/DD'), "C_DESC" VARCHAR2(300)) ON COMMIT DELETE ROWS ;CREATE INDEX "IDX_R_P_SV_SEC_BASE0" ON "R_P_SV_SEC_BASE" ("C_SEC_CODE") ;
1.先利用SEC_BASE处理第1个逻辑然后再commit, (commit之后临时表自动清空)
2.再处理后面的第2个逻辑