select * from dict; -- 딕셔너리에서 뽑는다.
select table_name from dict;
desc dba_tables;
desc dba_tab_columns;
-- meta_table을 만들고 USER만 넣는다.
create table meta.meta_table as select * from dba_tables where
tablespace_name like'METATBS';
create table meta.meta_tab_columns as select * from dba_tab_columns; -- 이
건 long 유형때문에 사용이 안됨
select * from DBA_TABLES where tablespace_name like'METATBS';
-- meta_tab_columns 테이블 MAKING
create table meta.meta_tab_columns(
OWNER VARCHAR2 (30 ) NOT NULL
, TABLE_NAME VARCHAR2 (30 ) NOT NULL
, COLUMN_NAME VARCHAR2 (30 ) NOT NULL
, DATA_TYPE VARCHAR2 (106) NULL
, DATA_TYPE_MOD VARCHAR2 (3) NULL
, DATA_TYPE_OWNER VARCHAR2 (30 ) NULL
, DATA_LENGTH NUMBER NOT NULL
, DATA_PRECISION NUMBER NULL
, DATA_SCALE NUMBER NULL
, NULLABLE VARCHAR2 (1 ) NULL
, COLUMN_ID NUMBER NULL
, DEFAULT_LENGTH NUMBER NULL
, DATA_DEFAULT LONG NULL
, NUM_DISTINCT NUMBER NULL
, LOW_VALUE RAW (32) NULL
, HIGH_VALUE RAW (32) NULL
, DENSITY NUMBER NULL
, NUM_NULLS NUMBER NULL
, NUM_BUCKETS NUMBER NULL
, LAST_ANALYZED DATE NULL
, SAMPLE_SIZE NUMBER NULL
, CHARACTER_SET_NAME VARCHAR2 (44) NULL
, CHAR_COL_DECL_LENGTH NUMBER NULL
, GLOBAL_STATS VARCHAR2 (3 ) NULL
, USER_STATS VARCHAR2 (3 ) NULL
, AVG_COL_LEN NUMBER NULL
, CHAR_LENGTH NUMBER NULL
, CHAR_USED VARCHAR2 (1 ) NULL
, V80_FMT_IMAGE VARCHAR2 (3 ) NULL
, DATA_UPGRADED VARCHAR2 (3 ) NULL
, HISTOGRAM VARCHAR2 (15) NULL);
-- Insert 할때 데이터형 넣는 것 부야오, 테이블네임이 유저명인 것
-- 서브쿼리 에서 '=' 은 단일행만 된다. 복수형은 in을 사용한다.
-- meta_tab_columns 테이블 INSERT!!!!
insert into meta.meta_tab_columns( OWNER
,TABLE_NAME
,COLUMN_NAME
,DATA_TYPE
,DATA_TYPE_MOD
,DATA_TYPE_OWNER
,DATA_LENGTH
,DATA_PRECISION
,DATA_SCALE
,NULLABLE
,COLUMN_ID
,DEFAULT_LENGTH
,DATA_DEFAULT
,NUM_DISTINCT
,LOW_VALUE
,HIGH_VALUE
,DENSITY
,NUM_NULLS
,NUM_BUCKETS
,LAST_ANALYZED
,SAMPLE_SIZE
,CHARACTER_SET_NAME
,CHAR_COL_DECL_LENGTH
,GLOBAL_STATS
,USER_STATS
,AVG_COL_LEN
,CHAR_LENGTH
,CHAR_USED
,V80_FMT_IMAGE
,DATA_UPGRADED
,HISTOGRAM) select OWNER
,TABLE_NAME
,COLUMN_NAME
,DATA_TYPE
,DATA_TYPE_MOD
,DATA_TYPE_OWNER
,DATA_LENGTH
,DATA_PRECISION
,DATA_SCALE
,NULLABLE
,COLUMN_ID
,DEFAULT_LENGTH
,to_lob(DATA_DEFAULT)
,NUM_DISTINCT
,LOW_VALUE
,HIGH_VALUE
,DENSITY
,NUM_NULLS
,NUM_BUCKETS
,LAST_ANALYZED
,SAMPLE_SIZE
,CHARACTER_SET_NAME
,CHAR_COL_DECL_LENGTH
,GLOBAL_STATS
,USER_STATS
,AVG_COL_LEN
,CHAR_LENGTH
,CHAR_USED
,V80_FMT_IMAGE
,DATA_UPGRADED
,HISTOGRAM from dba_tab_columns where table_name in (select table_name
from dba_tables);
'wif LiNoUz > Oracle,Sql' 카테고리의 다른 글
PL/SQL의 Stored fuction (0) | 2012.10.19 |
---|---|
PL/SQL의 stored procedure (0) | 2012.10.19 |
DW ERD (0) | 2012.10.16 |
이게 2번인듯 (0) | 2012.08.15 |
2 (0) | 2012.08.15 |