如果您问sql * Plus命令(show create table table_name似乎不是sql语句),可以使用desc命令
sql> desc emp Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2)
如果你真的想要一个sql语句,你可以使用dbms_Metadata包
1 select dbms_Metadata.get_ddl( 'TABLE','EMP','SCOTT' ) 2* from dual sql> / DBMS_MetaDATA.GET_DDL('TABLE','SCOTT') -------------------------------------------------------------------------------- CREATE TABLE "SCOTT"."EMP" ( "EMPNO" NUMBER(4,0),"ENAME" VARCHAR2(10),"JOB" VARCHAR2(9),"MGR" NUMBER(4,"HIREDATE" DATE,"SAL" NUMBER(7,2),"COMM" NUMBER(7,"DEPTNO" NUMBER(2,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 DE FAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ALTER INDEX "SCOTT"."PK_EMP" UNUSABLE 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 DE FAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" CACHE
根据您使用的工具,您可能需要首先运行set long 10000,这将告诉sql * Plus显示所选LOB的前10,000个字节。如果您的DDL较长,请设置较大的值。