查询表的DDL

时间:2023-12-11 17:45:38

例如:

SQL>create table tab001(id varchar(4));

SQL>select dbms_metadata.get_ddl(‘TABLE’,’tab001’) from dual;

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

Object “tab001” not found in schema “SYS”

SQL>select dbms_metadata.get_ddl(‘TABLE’,TAB001’) from dual;

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

CREATE TABLE “SYS”.”TAB001”

(

“ID” VARCHAR2(4)

) PCTFREE 10 PCTUSED 40

SQL>alter table tab001 modify id varchar(6);

SQL>select dbms_metadata.get_ddl(‘TABLE’,’TAB001’) from dual;

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

CREATE TABLE “SYS”.”TAB001”

(

“ID” VARCHAR2(6)

) PCTFREE 10 PCTUSED 40