[SQL팁]테이블 DDL 스크립트(create table) 뽑아내기
-- SCOTT 계정의 EMP 테이블의 CREATE TABLE 구문을 뽑아내는 예문
SELECT DBMS_METADATA.get_ddl ('TABLE', 'EMP', 'SCOTT') FROM DUAL;
==> 결과
CREATE TABLE "SCOTT"."EMP"
( "EMPNO"
NUMBER(4,0),
"ENAME"
VARCHAR2(10),
"JOB"
VARCHAR2(9),
"MGR"
NUMBER(4,0),
"HIREDATE"
DATE,
"SAL"
NUMBER(7,2),
"COMM"
NUMBER(7,2),
"DEPTNO"
NUMBER(2,0),
CONSTRAINT
"PK_EMP" PRIMARY KEY ("EMPNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT
"FK_DEPTNO" FOREIGN KEY ("DEPTNO")
REFERENCES
"SCOTT"."DEPT" ("DEPTNO") ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS"
댓글 없음:
댓글 쓰기