DataBase/Oracle
[Oracle Database] 임시테이블 사용
mongyang
2013. 2. 13. 15:07
오라클에서 MS_SQL에서 처럼 임시 테이블 사용하는 법.
1. 임시 테이블생성
SQL> create global temporary table temp_tab (col1 number, col2 char(15)) on commit delete rows ;
2. 임시 테이블에 인덱스 만들기
SQL> create index temp_tab_n1 on temp_tab(col1);
3. 임시 테이블에 데이터 인서트
SQL> insert into temp_tab values ( 1 , 'ABC') ;
★ 주의 : Insert/Update 했다고 Commit 하시면 안됩니다.
4. 임시 테이블에서 데이터 가져오기
SQL> select * from temp_tab ;