oracle查看创建表的sql语句

1,DESCRIBE 命令

使用方法如下:

SQL> describe nchar_tst(nchar_tst为表名)

显示的结果如下:

名称                                      是否为空? 类型

----------------------------------------- -------- ----------------------------

NAME                                               NCHAR(6)

ADDR                                               NVARCHAR2(16)

SAL                                                NUMBER(9,2)

2,DBMS_METADATA.GET_DDL包

使用方法如下:

SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST') FROM DUAL;

如果显示的结果并未完整,如下:

CREATE TABLE "SCOTT"."NCHAR_TST"

(    "NAME" NCHAR(6),

"ADDR" NVARCHAR2(16

那么修改如下:

SQL> SET LONG 9999

SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST') FROM DUAL;

则显示如下的结果:

DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST')

------------------------------------------

CREATE TABLE "SCOTT"."NCHAR_TST"

(    "NAME" NCHAR(6),

"ADDR" NVARCHAR2(16),

"SAL" NUMBER(9,2)

) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING

STORAGE(INITIAL 12288 NEXT 12288 MINEXTENTS 1 MAXEXTENTS 249 PCTINCREASE 50

FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "SYSTEM"

更多推荐

oracle查看表sql语句,oracle查看创造表的sql语句