How to find a column in database

admin
Categories: ERP, ERP Tables

Once, at a client site I was asked to do a drill through report from Purchasing to Fixed Assets. I don’t remember the exact details but it had something to do with Purchase orders. I knew little bit about Oracle Purchasing but had not worked enough on Fixed Assets. So I thought maybe I should start reading the FA user guides and the FA technical reference manuals. Most of my knowledge in ERP is gained through reading the User guides and TRMs but having to go through them requires significant patience.

First I had to find out which table stores the relevant PO details and then figure out how the information can be linked back to Purchasing. The client kept asking me on how to get started and I asked for some time to research on the drill link. I started reading the manuals but eventually gave up as I couldn’t locate it(not that it did not have the information).

Suddenly browsing through the table structure in the database, I realized that maybe I can run a query against the Database meta data and find out if there is a PO related item in a FA related table.

So I ran the below query

“select * from dba_tab_cols all_tab_cols where table_name like ‘FA%’ and column_name like ‘PO%’ ”

Bingo! This gave me a list of all the possible Fixed Assets table which contained the Purchasing columns in it. This became the starting point for my research and eventually traced back to the root information, built the queries and finally informed the client.

So what is dba_tab_cols? This is a database meta table maintained by Oracle database itself. It stores every column name for each table name in the database. You can query your Oracle database right now to see how it looks.

Before leaving the site, I showed the trick to the client on how this was accomplished and told him that this way you can find information yourself rather than calling anybody to help. He was really happy to have found this new “Magic wand”

Since then this trick has become my consulting arsenal. You shoulld too make it a habit of using it to stay sharp and ahead of others.

I developed similar queries for Oracle Flexfields and Discoverer which I will post soon.

Try MockupTiger to build Wireframes for your next software prototypes or initial Mockups when you are just iterating over ideas.


MockupTiger Wireframes builds instant wireframes for your Dashboards or Oracle Forms

8 Responses to “How to find a column in database”

  1. RMW says:

    I wrote up a little reply to this entry on my blog with a tiny bit more information about searching for columns in a database: http://ryanmwhaley.com/blog/

  2. Nilesh says:

    Hello Ryan,
    Thanks for the tip. all_tab_cols is the right view to look at.

    Thanks
    Nilesh

  3. [...] In a previous post, we covered the trick on how to find a column in database, now we will do similar stuff with Discoverer. [...]

  4. sri says:

    Hi i just got a hit of your website from google search , looks got and informative , keep posting the good posts

    thanks

    Sri

  5. [...] I’m not an oracle guru like Jarva, but supposedly you can  do the same in Oracle with this (from here) select * from dba_tab_cols all_tab_cols where table_name like ‘table%’ and column_name like ‘column%’ â€? [...]

  6. Anurag says:

    Thnks..for valuable info!!

  7. ABHISHEK says:

    select * from all_tab_columns where owner = ‘OWNER’ and column_name like ‘COLUMN_NAME’

  8. madhu says:

    hi guru

    gr8 this is very useful query.
    once we get the tables and colums
    how can we choose the join conditions as per the requirement.is there any rule to write the join conditions

    thanks,
    madhu