• 欢迎光临~

oracle查看建表语句显示不全

开发技术 开发技术 2022-05-25 次浏览
查看建表语句:
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";

  

程序员灯塔
转载请注明原文链接:oracle查看建表语句显示不全
喜欢 (0)