DBMS_METADATA.GET_DDL的輸出怎麼顯示不全呀?

zhouxianwang發表於2014-01-14


HMBARCODE@ hanmi> SELECT DBMS_METADATA.GET_DDL('TABLE','T_PMAX','HMBARCODE') FROM DUAL;

DBMS_METADATA.GET_DDL('TABLE','T_PMAX','HMBARCODE')
--------------------------------------------------------------------------------

  CREATE TABLE "HMBARCODE"."T_PMAX"
   (    "JEPUM_CODE" CHAR(6) NOT NULL ENABLE,


HMBARCODE@ hanmi>
HMBARCODE@ hanmi> set long 100000
HMBARCODE@ hanmi> set pages 0


HMBARCODE@ hanmi> SELECT DBMS_METADATA.GET_DDL('TABLE','T_PMAX','HMBARCODE') FROM DUAL;

  CREATE TABLE "HMBARCODE"."T_PMAX"
   (    "JEPUM_CODE" CHAR(6) NOT NULL ENABLE,
        "JEJO_NO" VARCHAR2(20) NOT NULL ENABLE,
        "CASE_BARCODE" VARCHAR2(30) NOT NULL ENABLE,
        "MIDDLE_BARCODE" VARCHAR2(30) NOT NULL ENABLE,
        "LARGE_BARCODE" VARCHAR2(30) NOT NULL ENABLE,
        "IPGO_CHECK" CHAR(1),
        "IPGO_DATE" DATE,
        "IPGO_USER" VARCHAR2(255),
        "CHULGO_CHECK" CHAR(1),
        "CHULGO_DATE" DATE,
        "CHULGO_USER" VARCHAR2(255),
        "BANPUM_CHECK" CHAR(1),
        "BANPUM_DATE" DATE,
        "BANPUM_USER" VARCHAR2(255),
        "SALE_CHECK" CHAR(1),
        "SALE_DATE" DATE,
        "SALE_USER" VARCHAR2(255),
        "ITEM_CODE" CHAR(4),
        "POJANG_REC" NUMBER(2,0),
        "STOREHOUSE_CODE" VARCHAR2(3),
        "REG_TM" CHAR(8)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOC
OMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2
147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "BARCODE2013"



HMBARCODE@ hanmi>




EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',false);
set long 2000000000
set linesize 500
set pagesize 0
spool /home/oracle/create_table.sql;
select dbms_metadata.get_ddl('TABLE','USER') from dual;        
spool off;

如下:

HMBARCODE@ hanmi> EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);

PL/SQL procedure successfully completed.

HMBARCODE@ hanmi> EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',false);

PL/SQL procedure successfully completed.

HMBARCODE@ hanmi> set long 2000000000
HMBARCODE@ hanmi> set linesize 1500
HMBARCODE@ hanmi> set pagesize 0
HMBARCODE@ hanmi> spool /home/oracle/create_table.sql;
HMBARCODE@ hanmi> SELECT DBMS_METADATA.GET_DDL('TABLE','T_PMAX','HMBARCODE') FROM DUAL;
HMBARCODE@ hanmi> spool off;


將以上內容儲存位檔案,,透過sqlplus執行該檔案,,生成指令碼為:/home/oracle/create_table.sql;
其中最開始兩句是在生成的指令碼中不包含相關資訊,,當然還有其他一些自定義設定.

ref:http://www.itpub.net/thread-841660-1-1.html

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27036311/viewspace-1070639/,如需轉載,請註明出處,否則將追究法律責任。

相關文章