在 Oracle 中查找 table 详细信息

Find table details in Oracle

我有 TEST 模式,它有很多 tables。
我想查找 table 详细信息,例如

Table name, column name, column datatype, column length, column default value, column allow null, column comment

我正在使用 Oracle 数据库,请指导我如何操作。
在 SQL 开发人员中,我可以找到个人 table 的这些详细信息,但我想为 table 获取此信息,其中 table 名称以 A、B 或 C 开头(这可以是任何字母字符)

如果您以 DBA 用户身份登录,您可以使用:

SELECT *
FROM   dba_tab_columns
WHERE  OWNER = 'TEST'
AND    SUBSTR(TABLE_NAME, 1, 1) IN ('A', 'B', 'C', 'a', 'b', 'c');

或者您可以查询 all_tab_columns 数据字典视图,或者,如果您以 TEST 用户身份登录:

SELECT *
FROM   user_tab_columns
WHERE  SUBSTR(TABLE_NAME, 1, 1) IN ('A', 'B', 'C', 'a', 'b', 'c');
select * from ALL_TAB_COLUMNS
where 
OWNER = 'TEST'
and SUBSTR(TABLE_NAME, 1, 1) IN ('A', 'B', 'C', 'a', 'b', 'c');

这将为您提供当前用户可访问的所有表的列名和信息 https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2094.htm