Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find table from querying column name in oracle SQL developer

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'.

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(?).

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?

like image 452
SunnyNewb Avatar asked Feb 25 '13 17:02

SunnyNewb


1 Answers

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

like image 159
SunnyNewb Avatar answered Oct 03 '22 15:10

SunnyNewb