我创建了此查询,以在MySQL
中找到数据库的所有架构。
SELECT
T.TABLE_SCHEMA,
T.TABLE_TYPE,
T.TABLE_NAME,
C.COLUMN_NAME,
C.DATA_TYPE,
C.COLUMN_DEFAULT,
C.IS_NULLABLE
FROM INFORMATION_SCHEMA.TABLES T
INNER JOIN INFORMATION_SCHEMA.COLUMNS C ON
(T.TABLE_SCHEMA = C.TABLE_SCHEMA AND T.TABLE_NAME = C.TABLE_NAME)
WHERE (T.TABLE_NAME= ? OR ? IS NULL)
ORDER BY T.TABLE_SCHEMA, T.TABLE_TYPE, T.TABLE_NAME, C.COLUMN_NAME;
我现在想为
Oracle
创建相同的代码。 最佳答案
非常感谢大家!!!
我找到了解决方案:
SELECT
TABE.OWNER,
TABE.TABLE_NAME,
COLO.COLUMN_NAME,
COLO.DATA_TYPE,
COLO.DATA_DEFAULT,
COLO.NULLABLE
FROM ALL_TABLES TABE
INNER JOIN ALL_TAB_COLUMNS COLO ON
(TABE.TABLE_NAME = COLO.TABLE_NAME AND TABE.OWNER = COLO.OWNER)
WHERE (TABE.TABLE_NAME= ? OR ? IS NULL)
ORDER BY TABE.OWNER, TABE.TABLE_NAME, COLO.COLUMN_NAME;
如果需要,分享。敬请关注!