[답변]조인 결과를 테이블로 생성..?? 0 0 2,257

by 이병훈 [2007.01.24 18:06:45]


안녕하세요..

 

짧은 식견으로 몇자 적어 봅니다.

 

현재 님께서 하시려는 작업은 전문용어로 CTAS 입니다.

이는 Create Table as select 의 줄임말이죠..

 

사용 방법은 이렇습니다.

 

1) ctas

 

create table xxx_new
tablespace new_tablespace_name
storage (initial new_initial next new_next freelists new_freelist_number )
as
select * from xxx
order by primary_index_key_values;

 

2) Parallel ctas

 

create table vbap_sorted
tablespace vbap_copy
storage (initial 500m
next 50m
maxextents unlimited
)
parallel (degree 4)
as
select *
from
sapr3.vbap
order by
mandt,
vbeln,
posnr;

3) ctas using index hint

 

create table vbap_sorted
tablespace vbap_copy
storage (initial 500m
next 50m
freelists 30
maxextents unlimited
)
as
select /*+ index(vbap vbap___0) */
*
from
sapr3.vbap
;

 

4) ctas with order by

 

create table vbap_sorted
tablespace vbap_copy
storage (initial 500m
next 50m
maxextents unlimited
)
as
select *
from
sapr3.vbap
order by
mandt,
vbeln,
posnr;

 

5) ctas unrecoverable

 

Create table new_lips
tablespace lips_b
storage (initial 900m
next 50m
maxextents unlimited
)
parallel (degree 4)
unrecoverable
as
select
from sapr3.lips;

 

출처 : http://www.dba-oracle.com/t_create_table_select_ctas.htm

 

그럼 수고하세요..

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입