数据库
首页 > 数据库> > oracle查看建表语句显示不全

oracle查看建表语句显示不全

作者:互联网

查看建表语句:
select dbms_metadata.get_ddl('TABLE','TEST_SQL','TEST') from dual;

DBMS_METADATA.GET_DDL('TABLE','TEST_SQL','TEST')
--------------------------------------------------------------------------------

  CREATE TABLE "TEST"."TEST_SQL"
   (	"ID" VARCHAR2(500) NOT NULL ENABLE,

可以看到查询结果是显示不完整的,此时如果想要查看全部内容,需要重新调整一下字段大小。

set long xxx(数值)
例如:set long 9999

接下来就可以查看到完整的建表语句:
select dbms_metadata.get_ddl('TABLE','TEST_SQL','TEST') from dual;

DBMS_METADATA.GET_DDL('TABLE','TEST_SQL','TEST')
--------------------------------------------------------------------------------

  CREATE TABLE "TEST"."TEST_SQL"
   (	"ID" VARCHAR2(500) NOT NULL ENABLE,
   "NAME" LONG,
 "COLUMNA" VARCHAR2(2000),
 "COLUMNB" VARCHAR2(20),
 "COLUMNC" VARCHAR2(6),
 "COLUMND" VARCHAR2(20),
 "COLUMNE" VARCHAR2(200),
 "COLUMNF" VARCHAR2(200),
 "COLUMNG" VARCHAR2(1) DEFAULT 1,
 "COLUMNH" VARCHAR2(20),
 "COLUMNI" VARCHAR2(6),
 "COLUMNJ" DATE
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 524288 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";

  

标签:语句,建表,DEFAULT,TEST,VARCHAR2,SQL,oracle,TABLE
来源: https://www.cnblogs.com/orcl-2018/p/16307897.html