[oracle ] global temporary table 연습 ~~ 용-ILE/DB-mysql / oracle2009. 2. 26. 15:57
http://suite.tistory.com/ 2009 02 fs
global temporary TABLE
//테이블 먼저 생성
create global temporary TABLE DEPT_TMP2
( cst_no CHAR(10) ,
ang_data VARCHAR2(100) ,
name VARCHAR2(50)
)ON COMMIT preserve rows;
AS SELECT a.cst_no , a.agent ||'_'|| a.cst_type ||'_'|| a.cst_grade as ang_data , b.name from tbl__ang_agent a, wjcom.wc_bp_sap_agent b where a.agent = b.agent
SELECT
//인덱싱
create INDEX idxcst_no222 ON DEPT_TMP2 (cst_no)
//삽입
INSERT into DEPT_TMP2 ( cst_no,ang_data,name )
SELECT a.cst_no , a.agent ||'_'|| a.cst_type ||'_'|| a.cst_grade as ang_data , b.name from tbl__ang_agent a, wjcom.wc_bp_sap_agent b where a.agent = b.agent
// 생성과 동시에
create global temporary TABLE dept_tmp2
ON COMMIT preserve rows
AS SELECT a.cst_no , a.agent ||'_'|| a.cst_type ||'_'|| a.cst_grade as ang_data , b.name from tbl__ang_agent a, wjcom.wc_bp_sap_agent b where a.agent = b.agent
drop TABLE DEPT_TMP2
TRUNCATE TABLE DEPT_TMP2
COMMIT
SELECT * FROM dept_tmp2 WHERE cst_no='0000000377'
wjcom.wc_bp_sap_agent
CREATE INDEX WJTH.IDX_TBL_ERP_cst_X1
ON WJTH.TBL_ERP_cst (REG_NO)
insert into gtt1
select level
from dual
connect by level <= 1101
;
그냥 연습~~~~~ 쓸모가 있을려나 ...
'용-ILE > DB-mysql / oracle' 카테고리의 다른 글
mysql 컬럼만 select show (0) | 2019.05.16 |
---|---|
JDBC 오류 메시지 Borrow prepareStatement from pool failed (0) | 2011.05.04 |
[DB] 서브쿼리 여러값을 합치기 ?? 하위 쿼리 둘 이상 반환 어쩌구 일때? 여러행 한행 ? (0) | 2009.01.30 |
[oracle] exp imp (export , import) 덤프 (0) | 2008.05.15 |
[oracle] PRIMARY KEY FOREIGN KEY 기본키 외래키 보기 sqlplus 로 (0) | 2008.05.15 |