2019-01-08 oracle导出表结构脚本

2019-01-08  本文已影响0人  emei18

使用这个脚本可以导出表结构,不含数据

SELECT B.TABLE_NAME     AS "Table",
       B.COLUMN_NAME    AS "Field",
       A.COMMENTS       AS "Desc",
       B.DATA_TYPE      AS "Type",
       B.DATA_LENGTH    AS "Len",
       B.nullable       AS "Nullable",
       B.COLUMN_ID      AS "Pos"
  FROM ALL_COL_COMMENTS A, ALL_TAB_COLUMNS B, ALL_TAB_COMMENTS C

WHERE A.TABLE_NAME = UPPER('OTD_TRANSIT_DETAIL_INFO') --IN (SELECT U.TABLE_NAME FROM USER_ALL_TABLES U)
   AND A.OWNER = B.OWNER
   AND A.TABLE_NAME = B.TABLE_NAME
   AND A.COLUMN_NAME = B.COLUMN_NAME
   AND C.TABLE_NAME = A.TABLE_NAME
  -- AND C.OWNER = A.OWNER
   --AND A.OWNER = 'XXX'
ORDER BY A.TABLE_NAME, B.COLUMN_ID;
上一篇下一篇

猜你喜欢

热点阅读