Finding column name in database

Hi all..
I want to find each column name, how many tables this column name is there
in database.
For single colum, i can find by using this query..
select a.COLUMN_NAME, a.TABLE_NAME from all_tab_columns a where
a.OWNER='DC_ERD' and a.COLUMN_NAME ='ACCESSORY_MAKER'
If i want to find for each column present in the database, can anybody please tell
me if it is possible in sql or pqsql is needed.
Thanks in advance,
Pal

Are you asking about the number of tables, it's been used or the tables list?
select column_name, count(table_name)
from all_tab_columns
group by column_nameCheers
Sarma.

Similar Messages

  • How to find column names in a table

    Am learning the basics of SQL Plus.
    Have entered the following query:
    SELECT * FROM t_ebb_session;
    This gives me the following output.
    USER_ID SESSION_ID LAST_ACCE
    However LAST_ACCE is not the full name of the column as I get 'Invalid column name when I use it in a select statement.
    How do I display the full name?

    By default, SQL*Plus will set the column display width of a character column to its size in the database, and the heading will be the column name in uppercase, truncated to fit that width if necessary. (There is a different rule for numeric columns.)
    You can override this with the COLUMN command, e.g:
    COLUMN some_column_name FORMAT a30 HEADING "Alternative Name"
    Check out the SQL*Plus documentation for all the COLUMN options.

  • Finding Column Name for a Data Pattern

    Hi all,
    I want to find out all the column names which is having matching data pattern such as 'Football'
    I want to get all those column names whose data matches value 'FootBall'
    Which Data Dictionary i can find out column name with data value
    Pls advice
    Thanks

    Definitely a strange requirement but hey....
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    cursor cur_tables is
      3      select table_name from user_tables order by 1;
      4    cursor cur_columns(p_table IN VARCHAR2) is
      5      select column_name from user_tab_columns
      6      where data_type IN ('CHAR', 'VARCHAR2')
      7      and table_name = p_table;
      8    v_cnt NUMBER;
      9    v_sep VARCHAR2(10);
    10    v_where VARCHAR2(2000);
    11    v_word VARCHAR2(30) := 'FOOTBALL';
    12  begin
    13    DBMS_OUTPUT.ENABLE(1000000);
    14    FOR t IN cur_tables
    15    LOOP
    16      v_sep := ' WHERE ';
    17      v_where := NULL;
    18      FOR c IN cur_columns(t.table_name)
    19      LOOP
    20        v_where := v_where||v_sep||c.column_name||' LIKE ''%'||v_word||'%''';
    21        v_sep := ' OR ';
    22      END LOOP;
    23      IF v_where IS NOT NULL THEN
    24        EXECUTE IMMEDIATE 'SELECT count(*) FROM '||t.table_name||v_where INTO v_cnt;
    25        IF v_cnt > 0 THEN
    26          DBMS_OUTPUT.PUT_LINE(v_word||' is in table '||t.table_name);
    27        END IF;
    28      END IF;
    29    END LOOP;
    30* end;
    SQL> /
    FOOTBALL is in table ADDRESS
    FOOTBALL is in table LOGTEXT
    FOOTBALL is in table NOMINAL
    PL/SQL procedure successfully completed.
    SQL>

  • Find column name from constraint name

    How to fetch the column name from a constraint name to which the constraint is applied?.
    I only know the name of the constraint and can get the table name from "dba_constraints". How can I know to which column in the table this constraint is applied.
    Thanks

    What about this?
    satyaki>
    satyaki>
    satyaki>desc user_cons_columns;
    Name                                      Null?    Type
    OWNER                                     NOT NULL VARCHAR2(30)
    CONSTRAINT_NAME                           NOT NULL VARCHAR2(30)
    TABLE_NAME                                NOT NULL VARCHAR2(30)
    COLUMN_NAME                                        VARCHAR2(4000)
    POSITION                                           NUMBER
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Finding columns names in a ResultSet

    Hi,
    Is it possible to get the columns names in a ResultSet ?
    After a SQL query, while parsing the ResultSet List, I would like to detect the columns names used in the select processed. Is it possible ?

    Hi,
    Take a look at the method:
    public ResultSetMetaData getMetaData() in the ResultSet.
    /Kaj

  • Finding a column name in databases.

    I'm new to all of this, forum, SQL and my businiess' databases, and mostly selftaught to boot. So I'm sure one of the databases we keep has a column called UNIT_PRICE, is there a way for me to get Oracle SQL Developer find all databases with columns named that?

    select owner, table_name, column_name
       from all_tab_columns
    where column_name = 'UNIT_PRICE';

  • Finding column Name in structure

    Hi All
    I have a requirement where i have the field names ( matnr, ekorg) etc., in an intenal table. eg., . using those names I need to read another internal table which carries values for the fields. I need to write a program to check if a particular field in table 1 has an initial value in table 2 or not.
    for my logic, I am looping on tab1( since it will contan only few fields) and assigning it to field symbols. but since the values from tab1 are dynamic, i cant hard code to assign field name like Matnr. So I am unable to figure out who to read tab2 with the field names i find in tab1.
    I used cl_abap_tabledescr=>describe_by_data (itab2) to columize the fields of itab2. but this method doesnt fetch me the field values? I was wondering if my approach was correct and if there is any way to use fields from itab1 to read values from itab2.
    I am not an ABAP expert, so any help is appreciated
    Regards
    Ruel

    Hi,
    You can use this to get the field values.
    ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.
    [Here|http://help.sap.com/saphelp_470/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/content.htm] is the link to documentation.

  • Find column name in a package

    Hi,
    I am working in oracle 9i . I want to know the specified column (one) in the procedures that are availbale in the schema.
    For ex.
    If my schema contains 10 procdure means, i want to know the column (one) that are used in how many procedures..
    rgds...

    Like this?
    select * from user_source where upper(text) like '%YOUR_COLUMN%'

  • How to find column name for OIM attributes?

    What is the COLUMN_NAME for attributes "Password Generated" and "Design Console access" in OIM 11g?
    Also I cannot find FormMetaData.xml anywhere. Which file represents FormMetaData.xml in OIM11g?

    Thanks Rajiv.
    Here is what I got for the query,
    SELECT USR_EMP_TYPE FROM USR WHERE USR_FIRST_NAME = 'Test';
    USR_EMP_TYPE
    Consultant
    But Design Console Access is a CheckBox in UserForm for OIM 11g, doesnt this value has to be True/False?
    Please help me understand

  • Retrieval of the column name in Java Mapping

    Hi All
    I am presently working on JAVA mapping which retrives the data construct the xml I want to dynamically generate the xml tag name (table column names of the Table) is there any way to do it
    Thanks
    Jayaraman

    Hi,
    You can get column names from database tables as...
    ResultSet resultSet=statement.executeQuery("select * from table");
    resultSetMetadata=resultSet.getMetaData();
    String col1 = resultSetMetadata.getColumnLabel(1);  ---> to get first column name
    and use in XML node creation as...
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("Root");
    Element Node1 = document.addElement(col1);
    Regards,
    Uma

  • Finding source database table/column name for a column in a view

    Hi i need to be able to identify the original database table/column name for a column in a view.
    e.g. say i have a view like this
    create v1 as select a.name fname, b.name bname, c.name cname,......
    from u1.names a, u2.names b. u3.names c
    where .....
    Now I want to find out that the database table/column name for the fname, bname and cname columns in the view v1, which in this instance is u1.name.name, u2.names.name, u3.names.name.
    But i need to be able to do it for any view. Short of parsing the SQL is there an easy way of doing this?
    Now obviusly I can't do this for virtual columns but I will know my column is not virtual as it has an index on it.

    But i need to be able to do it for any view. Short of
    parsing the SQL is there an easy way of doing this?No, parsing the SQL is the only way. Good luck it is not something I would want to attempt.

  • Finding column and table name

    Hi,
    I need to find out that '101c_0000000018' value is which column and table of database.
    Is there a way to find it? I am looking for table and column which is storing this data.
    Thanks
    Sandy

    It's possible but performance is going to be horrible.
    Assuming the data is stored in a CHAR or VARCHAR2 column, something like
    DECLARE
      l_value VARCHAR2(100) := '101c_0000000018' ;
      l_cnt   PLS_INTEGER;
      l_sql    VARCHAR2(1000);
    BEGIN
      FOR x IN (
          SELECT table_name, column_name
            FROM dba_tab_cols
           WHERE owner = <<name of schema>>
             AND data_type IN ('CHAR', 'VARCHAR2' )
      LOOP
        l_sql := 'SELECT COUNT(*) FROM ' || x.owner || '.' || x.table_name || ' WHERE ' || x.column_name || ' = :1';
        EXECUTE IMMEDIATE l_sql
          INTO l_cnt
         USING l_value;
        IF( l_cnt > 0 )
        THEN
          dbms_output.put_line( 'Found the value ' || l_value || ' in owner = ' || x.owner || ' table name = ' || x.table_name || ' column name = ' || x.column_name );
        END IF;
      END LOOP;
    END;Justin
    Edited by: Justin Cave on Dec 8, 2011 12:20 PM

  • Find all tables in db with column name of a particular string?

    I'm looking for all tables in a db that have a certain column name. How can I find this?

    John,
    thanks for your answer.
    John Mcginnis wrote:
    The quick search field in the schema browser is doing client-side filtering of the list of objects. This means we can only filter on things that we already have fetched from the database, like the object name. We have no current plans to extend the types of information that can filter on, although it is possible we might add the ability to filter based on a few other types of information that we generally fetch with the object name. However, filtering by column name would require pre-fetching the lists of columns for all tables and as such is not likely to be added to the schema browsers search field.
    I'm sure you guys had a Toad review to understand how things are done there.....so
    My 2 cents are: instead of pre-fetching the columns of all tables why don't you add a button below the table drop-down list which should fetch the tables based on the filter columns condition - exactly like Toad.
    Thanks,
    Dani

  • Finding a TABLE based on a COLUMN NAME...

    I need to find all tables that that have a common column name.
    Upon searching the Forum, I found this nice nugget:
    How to find the table in a schema if I only know a particular column name
    The problem is, my USER_TAB_COLUMNS is EMPTY!
    If it had worked, then my statement would be:
    select * from USER_TAB_COLUMNS
    where COLUMN_NAME LIKE '%TEST%'
    and OWNER='ME';
    I get "no rows selected" (though I know they exist)
    if I do:
    select * from USER_TAB_COLUMNS
    I also get "no rows selected"
    Any ideas!
    Thanks!
    KSL.

    The user_xxx data dictionary tables show all of the whatevers that are owned by the logged in user. So, if you are logged in as user1 the user_tab_columns view will only show tables and views owned by user1.
    The all_xxx dictionary views show all of the whatevers that the logged in user has access to. so if you are logged in as user1 and user2 gave you selet privileges on tablea, then you would see tablea in all_tab_columns.
    The dba_xxx views show all objects in the database, but are generally only available to privileged users.
    If you have access to the dba_views, try:
    SELECT owner, object_type
    FROM dba_objects
    WHERE UPPER(object_name) = 'ANL'It is possible that the table and or its columns were created with double quotes so are case sensitve. It may also be a synonym, pointing to one of the tables that you got form your query.
    If you are only using all_tab_columns then it is possible that the user you are logged in as does not have privileges on the table anl so would not see it in the view.
    A long shot, but are you sure you are in the right database?
    John

  • Query the column names from Public database links

    Greetings,
    I would like to retrieve the list of all the column names from a public database link. A regular ALL_TAB_COLUMNS doesn't seem to be working.
    Thanks
    John9569

    Hi,
    I think your DBA needed to create a synonym for you to have access of that remote database view.
    CREATE SYNONYM synonym_name
    FOR view_name@db_link;Then you can find the column names by
    DESC   synonym_nameGuru's , please correct me If I am wrong.
    Thanks
    Edited by: user10679113 on Mar 12, 2009 12:28 PM
    Edited by: user10679113 on Mar 12, 2009 12:33 PM

Maybe you are looking for

  • Airport card 1.2.1 does not work with Ibook G3 with OSx.4.2

    I just purchased a brand new airport express base station. It seems to be up and running on my G4Imac just fine as a server. For the client, I have an ibook G3 and now have OSX.3.4 on it. I installed my ancient Airport card- 1.2.1 into the Ibook. I i

  • How do I change the theme of a custom theme presentation in Keynote?

    How do I change the theme of a custom theme presentation in Keynote? I have a beautiful preso that my designer created. I want to use the copy in those slides with a different theme more conducive to my audience. And use only some of the slides (I kn

  • Attribute EditHide in jsp

    Hello I dont know how to to this :( I have two attributes to one DB table column in VO in EditForm i am showing one like combobox with some values when the form are in insert mode, second need to be hidden , now i need to make that in edit mode this

  • Integrete with Websphere 5.0 example

    Write class like this: package com.test.kodo; import com.ibm.websphere.management.AdminService; import com.ibm.websphere.management.AdminServiceFactory; import com.ibm.websphere.runtime.CustomService; import javax.naming.*; import java.util.*; import

  • Illustrator CC, Photoshop CC and InDesign CC

    Is there any Illustrator or Photoshop and InDesign CC that's compatible with a 1366x768 screen size ? Thanks for the answer .