【问题标题】:Get list of table names in oracle from information schema [duplicate]从信息模式中获取oracle中的表名列表[重复]
【发布时间】:2018-02-25 06:44:36
【问题描述】:

我在 MySQL 和 POSTGRESQL 中使用以下查询。

MySQL SELECT table_name FROM information_schema.tables where table_schema='SmartHome' and table_name like '%House%'

POSTGRESQL。 SELECT table_name FROM information_schema.tables where table_schema='public' and table_name like '%House%'。

我想知道 Oracle DB 中的等效查询。

【问题讨论】:

    标签: java mysql database oracle rdbms


    【解决方案1】:

    您可以使用以下 sql 查询进行相同的操作 -

    select * from user_tables; /* The relational tables owned by the current user.*/
    
    select * from dba_tables;  /* describes all relational tables in the database - For this you need to login as a DBA */
    
    select * from tab; /* Gives you all tables */
    
    select * from cat; /* Gives you sequences as well */
    

    【讨论】:

    • 如何获取与特定数据库关联的表列表,这个查询对吗? SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER='DBName' and TABLE_NAME like '%HOUSE%'
    • 它应该可以正常工作,如果您不想错过任何小写表,只需添加一个小调整 - SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER='DBName' 和大写(TABLE_NAME),如 '% HOUSE%'
    • 如果同样解决了您的问题,请采纳,谢谢。
    • 谢谢你的朋友
    【解决方案2】:

    从 user_tables 中选择 TABLE_NAME

    【讨论】:

      猜你喜欢
      • 2012-01-17
      • 1970-01-01
      • 2011-08-24
      • 1970-01-01
      • 1970-01-01
      • 2014-03-20
      • 2022-01-14
      • 2010-10-01
      • 1970-01-01
      相关资源
      最近更新 更多