php oracle SQL developer从查询列名中查找表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15072248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:30:22  来源:igfitidea点击:

Find table from querying column name in oracle SQL developer

phpsqloraclecoldfusionoracle-sqldeveloper

提问by SunnyNewb

I want to query a database for a column name to find the table without knowing the table name (there are a huge number of tables)

我想在不知道表名的情况下查询数据库的列名以查找表(表数量很大)

I am working with a huge database at the moment and trying to find where, based on CFML code and the URL of the problematic page, a website is retrieving information from. I am new to ColdFusion however I can see that the URL contains a few ID references with column names. Some I have been able to find easily and others, I have no idea as the column names are quite vague e.g. 'NTASKID'.

我目前正在使用一个庞大的数据库,并试图根据 CFML 代码和有问题的页面的 URL 查找网站正在从中检索信息的位置。我是 ColdFusion 的新手,但是我可以看到 URL 包含一些带有列名的 ID 引用。有些我很容易找到,有些我不知道,因为列名很模糊,例如“NTASKID”。

My plan is to try to query the database using the column name but Google has presented me queries which require knowing the table name which I do not have. I guess those examples may have been more useful for denormalised tables(?).

我的计划是尝试使用列名查询数据库,但 Google 向我提供了需要知道我没有的表名的查询。我猜这些例子可能对非规范化表更有用(?)。

If someone knows such a query it would be great. Additionally, could someone please comment on whether I am going down the right avenue of investigation here?

如果有人知道这样的查询,那就太好了。此外,有人可以评论我是否在这里进行正确的调查吗?

回答by SunnyNewb

The query that worked was

有效的查询是

SELECT * FROM ALL_TAB_COLUMNS 
WHERE COLUMN_NAME LIKE '%TASK%' 
AND owner = 'database_name';

It was the 'owner' part I did not previously know about. Everyone who answered certainly opened avenues for further Googling.

这是我以前不知道的“所有者”部分。每个回答的人肯定为进一步的谷歌搜索开辟了途径。

Cheers

干杯

回答by Art

If you need to find table name then 'juergen d' answered your question. If you nee to find column names then use user_tab_columns/all_tab_columns to select column names where table='YOUR_TABLE' - must be in upper case as well as column names.

如果您需要查找表名,则 'juergen d' 回答了您的问题。如果您需要查找列名,则使用 user_tab_columns/all_tab_columns 来选择列名,其中 table='YOUR_TABLE' - 必须大写以及列名。

回答by thatjeffsmith

The IDE itself has a feature for this, View > Find DB Obect

IDE 本身有一个功能,View > Find DB Obect

here's a 20 second videoshowing it, in action

这是一个 20 秒的视频,展示了它的实际效果