Query to Find Table and Column Name by using a value

Dear Legends,
I hope and surfed in our forums and google to find the Table Name and Column Name by having a value(Number/String). And my where clauses are
where owner NOT IN ('SYS','SYSTEM') and
      data_type IN ('CHAR','VARCHAR2','NUMBER')
May I have your help for building the query. and my query as follows
select a.owner, c.column_name, c.data_type, c.owner, c.table_name
from dba_objects a, all_tab_cols c
where a.owner NOT IN ('SYS','SYSTEM') and
where c.owner NOT IN ('SYS','SYSTEM') and
where c.data_type IN ('CHAR','VARCHAR2')
order by a.owner
Thanks,
Karthik

You can use
select * from user_tab_columns a, user_tables b
where a.table_name = b.table_name
and  a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR');
Or if you want to user DBA_* tables, you can use.
select * from dba_tab_columns a, dba_tables b
where a.table_name = b.table_name
and a.owner = b.owner
and  a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR')
and b.owner not in ('SYS', 'SYSTEM');
And now when I look a bit more closely, you don't need DBA_TABLES there. dba_tab_columns alone is sufficient. And requirement is still not clear yet. Why you need a group by there? If I get it right, you can use this.
select * from dba_tab_columns a
where a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR')
and a.owner not in ('SYS', 'SYSTEM');
Whether you use group by or not, the query will give you the same output.
Ishan

Similar Messages

  • List tables and column names a stored procedure is querying

    Hello,
    Is there a way to list tables and column names that a stored procedure is querying, i.e, selecting from, using T-SQL?  If yes, is there a way to also show data types for the columns that a stored procedure is querying, i.e, selecting from?
    Thank you,  
    Lenfinkel

    One way to view the dependencies of an object is to use SSMS; navigate to the object, right click and select "view dependencies".  However this does not tell you what columns are being referenced by the Stored Procedure.
    One way to view what is being referenced by a stored procedure is to run something like
    select
    text
    from syscomments
    where
    id in
    (select id
    from sysobjects
    where
    name
    =[Your Object Name]
    And xtype
    in
    ('p','P')
    Please click "Mark As Answer" if my post helped. Tony C.

  • How to get table and column names thats being used in SQL , that's generating all my reports on SSRS.

    Good day,
    I searched through the forum and cant find anything.
    I have around 300 published reports on SSRS and we are busy migrating to a new system.
    They have already setup their tables on the new system and I need to provide them with a list of table names and column names that are being used currently to generate the 300 reports on SSRS.
    We use various tables and databases to generate these reports, and will take me forever to go through each query to get this info.
    Is it at all possible to write a query in SQL 2008 that will give me all the table names and columns being used?
    Your assistance is greatly appreciated.
    I thank you.
    Andre.

    There's no straightforward method for that I guess. There are couple of things you can use to get these details
    1. query the ReportServer.dbo.Catalog table
    for getting details
    you may use script below for that
    http://gallery.technet.microsoft.com/scriptcenter/42440a6b-c5b1-4acc-9632-d608d1c40a5c
    2. Another method is to run the reports and run sql profiler trace on background to retrieve queries used.
    But in some of these cases the report might be using a procedure and you will get only procedure. Then its upto you to get the other details from procedure like tables used, columns etc
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Check the table and column name in R12 web screen

    Hello Friends
    Please any body can tell me how can I find out the table name and column name in web based forms like supplier, customer in R12. In 11i I can find out the table name and column name from help menu by record history and diagnostic -> examine menu.
    Thansk
    Makshud

    Hi,
    Please see (Note: 741366.1 - How to get Supplier table information? How to get About this Page link in OA page in R12).
    Thanks,
    Hussein

  • Toplink JPA forces database table and column names to UPPERCASE! Why?

    I have recently experienced using Toplink JPA while using glassfish ... migrating an existing application to EJB 3.0 persistence. Toplink JPA, as implemented in glassfish, forces tablenames and column names from my code to be uppercase in select statements, etc. as then submitted to the database. Why? I cannot find anything in the EJB 3.0 specs on persistence that even suggests this.
    This created a serious problem for me, in my application. For my code to work I had to change the names of the database tables to all uppercase, even though that meant other of my applications, already written using the original mixed case names of the databases, will no longer work unless I revise the code in those applications! (I am using mySQL as my database.)
    In both Unix/Linux and Java, which are both case sensitive, If I wanted names of files or other items to be uppercase, I would have written them that way. I do not expect some middleware piece of software to muck around with the case of text I have put into my code.
    I am hopeful this 'feature' of the reference implementation of the EJB Persistence API will be corrected in a subsequent version. [Maybe you can tell I am not happy!]
    Thanks for listening to my rant.

    Robert,
    I found that the name I specify in all of my @Table, @Column, ... annotations is used with the case as it is provided.
    If TopLink determines the schema information through defaults then the names it comes up with are definitely upper cased by default.
    Are you specifying the schema information that you want in annotations or XML?
    Doug

  • Sql query parsing (retrieve tables and columns used in query)

    Hi,
    1. Is there any view in Oracle which can tell me, which tables and columns were used in the last ran query, no matter how complex the query is.
    2. Secondly I can get table names, used in stored procedures and views, using USER_DEPENDENCIES VIEW, however this System View does not return column names, used in that procedure / view, any idea please .
    Thanks and Regards,
    Luqman

    luqman123 wrote:
    Hi,
    1. Is there any view in Oracle which can tell me, which tables and columns were used in the last ran query, no matter how complex the query is.I don't believe so. You can look at V$SQL and retrieve the actual SQL text from there.
    2. Secondly I can get table names, used in stored procedures and views, using USER_DEPENDENCIES VIEW, however this System View does not return column names, used in that procedure / view, any idea please .Oracle added fine grained dependency tracking in 11g, but didn't expose any views to query this information. However, it has been reverse engineered a bit: About Oracle: DBA_DEPENDENCY_COLUMNS

  • Retrieve tables and column names in a universe

    Hi - Is there a way to retrieve tables and columns used in a given universe? We have to do analysis and need to know the tables as well as fields used anywhere in any object defined in the universe.
    I tried Query Builder and did some selection on ci_infoobjects and ci_appobjects; they don't seem to have that kind of information.
    Please advise.
    Thanks

    Hi.
    Are you try with the option save as ... and choose to pdf inside the designer?
    In designer tools->option you can choose what you want it print/PDF.
    I hope it be helpfull for you.
    Regards.

  • How to retrieve DB links and column names details used in code

    Hi All,
    I am looking for code that will retrieve database links name, referenced object and column names used in source code within the schema.
    It’s easy enough to find the link names using xxx_db_links / user_source, the trick part it to list the column names used within the code.
    Any expert advice is much appreciate
    Thanks
    Aali

    That wil not give me column names .
    Thanks
    Message was edited by:
    aalishan

  • Displaying table and column names

    i have a user that created a table, he is not sure of the name of the table. how do i display a list of tables and display the column names within a table??

    You would need to know who the user is, or alter the following script.
    The script waits for 2 entries:
    1- the tablenames that start with the first characters entered;
    2- the columns that start with the first characters entered;
    (If you want to search for "any" tables and/or columns that contain the charatcers you enter, preceed the parameters entered with a % sign).
    (If you want to search for "any" table or character, do not enter anything.
    This is a "raw" script that should do job. I think it should do the minimum you are looking for.
    SET PAGESIZE 50
    SET LINESIZE 120
    SET TIMING ON
    COLUMN OWNER HEADING 'OWNER' FORMAT A12
    COLUMN TABLE_NAME HEADING 'TABLE NAME' FORMAT A30
    COLUMN COLUMN_NAME HEADING 'COLUMN NAME' FORMAT A30
    COLUMN DATA_TYPE HEADING 'TYPE' FORMAT A10
    COLUMN DATA_PRECISION HEADING 'PREC' FORMAT 99G999
    COLUMN DEFAULTVAL HEADING 'DEF VALUE' FORMAT A10
    COLUMN INDEX_NAME HEADING 'INDEX NAME' FORMAT A30
    COLUMN INDEX_TYPE HEADING 'TYPE OF INDEX' FORMAT A27
    COLUMN UNIQUENESS HEADING 'UNIQUE' FORMAT A3
    COLUMN PARAMETERS HEADING 'PARAMETERS' FORMAT A500 NEWLINE
    -- Query
    SELECT DISTINCT --COUNT(*)
    C.TABLE_NAME,
    C.COLUMN_NAME,
    C.DATA_TYPE,
    C.DATA_LENGTH,
    C.DATA_PRECISION
    FROM ALL_TAB_COLUMNS C,
    ALL_CONS_COLUMNS CC1
    WHERE
    (C.COLUMN_NAME = CC1.COLUMN_NAME(+)
    AND UPPER(C.TABLE_NAME) = UPPER(CC1.TABLE_NAME(+)))
    AND UPPER(C.TABLE_NAME) LIKE UPPER('&PARAM1%')
    AND UPPER(C.COLUMN_NAME) LIKE UPPER('&PARAM2%')
    --AND OWNER = 'SYS'
    --AND DATA_TYPE = 'DATE'
    --AND DATA_TYPE != 'CLOB'
    --AND DATA_TYPE != 'LONG'
    ORDER BY C.TABLE_NAME, C.COLUMN_NAME;
    Hope this helps.

  • Put query iresults n tables and columns

    hello , i have this query and should display
    but i need it to be in a cells like rows and columns . just
    like a ecxel spread sheet but only in html.
    here is the code.
    what do i have to add to make this happen?
    thanks in adv
    <cfquery name="GetCompanies"
    datasource="#Request.MainDSN#">
    SELECT
    CompanyID,
    CompanyName,
    Address,
    City,
    State,
    ZipCode,
    Comments
    FROM
    Company
    ORDER BY
    CompanyName ASC
    </cfquery>
    <html>
    <head>
    <title>ColdFusion MX Bible</title>
    <link rel="stylesheet" href="styles.css">
    </head>
    <body>
    <h1>Company List</h1>
    <table>
    <tr>
    <td><b>ID</b></td>
    <td><b>Name</b></td>
    <td><b>Address</b></td>
    <td><b>City</b></td>
    <td><b>State</b></td>
    <td><b>ZIP Code</b></td>
    <td> </td>
    </tr>
    <cfoutput query="GetCompanies">
    <tr>
    <td>#CompanyID#</td>
    <td>#CompanyName#</td>
    <td>#Address#</td>
    <td>#City#</td>
    <td>#State#</td>
    <td>#ZipCode#</td>
    <td>
    <a
    href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
    <a href="CompanyAddForm.cfm">Add</a>
    <a
    href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
    <a
    href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
    </td>
    </tr>
    </cfoutput>
    </table>
    </body>
    </html>
    when it is displayed it is like
    Company List
    ID Name Address City State ZIP Code
    27 555k ddd ddd dd 90556 Employees Add Edit Delete
    26 555k ddd ddd dd 90556 Employees Add Edit Delete
    31 dd dd dd dd 89995 Employees Add Edit Delete
    23 ddd ddd ddd dd 90556 Employees Add Edit Delete
    22 ddd ddd ddd dd 90556 Employees Add Edit Delete
    24 ddd ddd ddd dd 90556 Employees Add Edit Delete
    21 mama 252 los angeles ca 90056 Employees Add Edit Delete
    14 Ma's Homemade Pies 5332 Courtland Court Abilene AL 29555
    Employees Add Edit Delete
    25 nknknk ddd ddd dd 90556 Employees Add Edit Delete
    15 Normwelland and Drake Clothing Co. 1240 Pierpont Point
    Boston MA 02134 Employees Add Edit Delete
    16 Pizza Palace 1548 High Point Freeway New York NY 00248
    Employees Add Edit Delete
    29 qqqq 888 laverne za 90000 Employees Add Edit Delete
    30 qqqq 888 laverne za 90000 Employees Add Edit Delete
    13 The Very Big Corporation of America 5806 Glenn Hollow Lane
    Norcross GA 30071 Employees Add Edit Delete
    without the cells/records>

    <cfquery name="GetCompanies"
    datasource="#Request.MainDSN#">
    SELECT
    CompanyID,
    CompanyName,
    Address,
    City,
    State,
    ZipCode,
    Comments
    FROM
    Company
    ORDER BY
    CompanyName ASC
    </cfquery>
    <html>
    <head>
    <title>ColdFusion MX Bible</title>
    <link rel="stylesheet" href="styles.css">
    </head>
    <body>
    <h1>Company List</h1>
    <TABLE width=100% align="left" border="4" rules="all">
    <tr>
    <td><b>ID</b></td>
    <td><b>Name</b></td>
    <td><b>Address</b></td>
    <td><b>City</b></td>
    <td><b>State</b></td>
    <td><b>ZIP Code</b></td>
    <td> </td>
    </tr>
    <cfoutput query="GetCompanies">
    <tr>
    <td>#CompanyID#</td>
    <td>#CompanyName#</td>
    <td>#Address#</td>
    <td>#City#</td>
    <td>#State#</td>
    <td>#ZipCode#</td>
    <td>
    <a
    href="EmployeeList.cfm?CompanyID=#CompanyID#">Employees</a>
    <a href="CompanyAddForm.cfm">Add</a>
    <a
    href="CompanyEditForm.cfm?CompanyID=#CompanyID#">Edit</a>
    <a
    href="CompanyDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
    </td>
    </tr>
    </cfoutput>
    </TABLE>
    </body>
    </html>
    thanks i did but the out put is still the same
    Company List
    ID Name Address City State ZIP Code
    26 555k ddd ddd dd 90556 Employees Add Edit Delete
    27 555k ddd ddd dd 90556 Employees Add Edit Delete
    31 dd dd dd dd 89995 Employees Add Edit Delete
    22 ddd ddd ddd dd 90556 Employees Add Edit Delete
    23 ddd ddd ddd dd 90556 Employees Add Edit Delete
    24 ddd ddd ddd dd 90556 Employees Add Edit Delete
    21 mama 252 los angeles ca 90056 Employees Add Edit Delete
    14 Ma's Homemade Pies 5332 Courtland Court Abilene AL 29555
    Employees Add Edit Delete
    but still
    its not in cells

  • Generating mixed case for table and column names

    I trying to get table definition from Oracle 9i database into my toplink workbench
    (version 9.0.3), the column names and table names are capitilized by
    default, how do I change this to be mixed case? Thanks

    I'm not sure why you want them changed. The Oracle database by default is case insensitive, which in essence means it converts everything to upper case when a case is not specified (which can be done by wrapping it in quotes). Unfortunately, Java strings are case sensitive. This means that if you try searching resultsets for "TableName" when the database driver is returning "TABLENAME", you will run into problems. It is probably better to have your project match your database as closely as possible to avoid any issues later on.
    That said, I don't know of a way to automatically have the workbench use mixed case names - it uses the strings as they are returned from the database. I believe you will need to manually change the table names if you want them to be different than what you have imported.
    Best Regards,
    Chris

  • How to view all tables and column names from a remote database

    Hey Guys,
    I have a database in a remote server. I have the db link and the schema name.. Now i want to view all the tables in the remote database with column names.. I dont have access to that database using sql developer.. But i can view some tables using the db link..Is there any way i can view all the tables with the column names?

    user10683742 wrote:
    Dont think i have DBA access..It gives the following error
    ORA-00942: table or view does not exist
    00942. 00000 - "table or view does not exist"You don't have to have 'dba' access, per se. You just have to have SELECT ALL TABLES privilege. when you use a db_link, you are connecting to the remote db with the user defined in the link, and .. on that db .. you will have the privileges of the user defined in the db link. Exactly as if you had used sqlplus to connect to that db with that user.

  • How to get constraint name and table and column names

    Hi Team,
    I am a junior DBA. I want to check how many columns are under PRIMARY KEY constraint.
    I used dba_constraints view. Please find below details.
    SQL> select OWNER,CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME from dba_constraints
    2 where TABLE_NAME='DSET_PRODUCT_S';
    OWNER CONSTRAINT_NAME C TABLE_NAME
    SCOTT SYS_C10202456 C EMPLOYEE
    SCOTT SYS_C234576 C DEPT
    Please suggest any one.
    Regards,

    Do you want to list the columns under a primary key?
    This is listing index and columns:
      SELECT cn.owner, cn.constraint_name, cn.constraint_type, cn.table_name
           , cn.index_owner, cn.index_name, ix.column_position, ix.column_name
        FROM dba_constraints cn, dba_ind_columns ix
       WHERE     cn.table_name = 'DSET_PRODUCT_S'
             AND cn.constraint_type = 'P'
             AND cn.index_owner = ix.index_owner
             AND cn.index_name = ix.index_name
    ORDER BY cn.owner, cn.table_name, cn.index_owner, cn.index_name
           , ix.column_position;
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • XLA tables and column names while creating accounting in AP.

    Dear All,
    Could anybody please tell me what are the columns of the XLE tables gets hitted when i am creating accounting for an AP invoice?
    Also Please let me know from which tables and which columns, i can get all eligible invoices for payment?
    any code snippet is highly appreciated.
    Thanks & Regards,
    BS.

    HI BS,
    Simply run a diagnostic on the respective invoice from the front end, and you will get the required information.
    Thanks &
    Best Regards,

  • How to find tables and columns in SAP Logon?

    I cant seem to find the table in SAP Logon,therefore i cant proceed with my abap.please help me,thanks

    Hi Koh,
    Create Table Step by step Process:
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/frameset.htm
    You can follow the below steps to create the table in SE11.
    step 1. Go to transaction se11.
    step 2. write a table name prefix with z.
    step 3. Give description.
    step 4. It comes to delivery and maintainance, In delivery class u have 3 types u can select any of those 3. I have selected as A(master and transaction data).
    Along with this u have to mention ur data browser as Display/ maintainance allowed only.
    step 5. Go to technical settings, specify ur data class (APPL0) and size.
    step 6. Create your fields with data element and domain.
    step 7. While u enter ur data element ( the name u give should prefix with z) double click on that.
    step 8. Now u have two options either to create domain or data type. After creating this, it will ask for field label, mention the field label.
    step 9. Now activate at the same screen and come back u'll come to data element screen then again activate. Finally u'll come to first screen.
    step 10. Follow steps 6 to 9 for more fields.
    step 11. then activate.
    step 12. To create entries in the table. On menu bar u have utilities, in that u have table contents, in that u have create entries.
    step 13. After every entry save the data. That will be saved in the databaase.
    Hope this helps u...
    Regards,
    KK.

Maybe you are looking for