Find the name of the column in all tables

How to find the name of the column in all tables in the database for any column to reveal the name of the person?


We have over 1000 tables looking for.and in some places, the name column FNAME LNAME, First_NAME, DNAME

For example we have Customer table, Table EMPLOYEE and the ORDER Table

--------------------------------

Customer table
--------------------------------

LNMAE

EMPLOYEE table

EMP_ID
DEPT_NAME (we don't want this column as it is not a name column)
Last_name (he must propose this column because it is named)

----------------------------

CONTROL Panel

-----------------------------

ORDER_ID
ORDER_NAME (we don't want this column as it is not a name column)
Last_name (he must propose this column because it is named)

-------------------------

Dept table

-------------------------

Dept_ID
DEPT_NAME (we don't want this column as it is not a name column)

Please advise...

Thank you.

Hello

What exactly do you do?

If you want to display the tables containing these columns, you can query the view data dictionary USER_TAB_COLS (or ALL_TAB_COLS, or, if you have privileges, DBA_TAB_COLS).

For example:

SELECT table_name, column_name

Of user_tab_cols

WHERE nom_de_colonne IN ('DNAME', 'FNAME', 'FIRST_NAME', 'LAST_NAME', 'LNAME') - or else

ORDER BY table_name, column_name

;

Tags: Database

Similar Questions

  • Interrogate the columns of all tables

    Hello
    I called A, B, C... upto z. of these 26 paintings of paintings, 15 tables have the column common name "AAA". Now, I want to find the names of the tables in which there is a column name "AAA". for example, if this column name 'AAA' is present in the tables B, F, G,... Y(15 tables). The query should display all the table names. Here, in this example we donot know what table is the name of the column "AAA". We find the tables where is the name of the column "AAA"?

    Thanks in advance...

    Let me know if you have any confusion with my question.
    SQL> select * from user_tab_columns where column_name = 'AAA';
    
  • How to find the name of a column in a table

    Hi all

    I have a Table that contains approximately 100 columns.


    I need to find the column name, to find in specific columns containing data like 'abc '.

    Ex: I have a table like temp_table_name
    the columns are col1, col2, col3, col4, col5, col6, col7, col8,.... col99
    I'm looking for with data specific like 'abc '.

    Need to find the name of the table column that contains data of 'abc '.

    Please suggest me. How to find in a single query... :-)

    Actually I'm looking through a column of the table as below
    Select count (*) in the temp_table_name where col1 = 'abc '.

    FOR I IN 1.20 LOOP
    ln_num_of_rows: = 0;
    lv_column_name_search: = "col" | I have;

    lv_sql: = ' select count (*) in the temp_table_name where ' | lv_column_name_search | "= abc";

    EXECUTE IMMEDIATE lv_sql INTO ln_num_of_rows;

    IF ln_num_of_rows > 0
    -column found in lv_column_name_search
    EXIT;
    END IF;
    END LOOP;

    But I'm gettig performance problem.

    How can I do this in any other alternative way? could you suggest any way possible as soon as POSSIBLE.

    It's probably never going to be effective - realistic, you have to scan completes the picture.

    You could probably improve a little things by doing something like

    SELECT DISTINCT column_name
      FROM (
        SELECT (CASE WHEN col1 = 'abc' THEN 'col1'
                    WHEN col2 = 'abc' THEN 'col2'
                    WHEN col3 = 'abc' THEN 'col3'
                    ...
                    WHEN col20 = 'abc' THEN 'col20'
                    ELSE NULL
                    END) column_name
          FROM table_name
        WHERE col1 = 'abc'
            OR col2 = 'abc'
            ...
            OR col20 = 'abc'
      )
    

    but it's never going to be incredibly fast.

    Justin

  • Find the column for a constraint name

    Hi guru,.

    I know the name of the constraint, now I need the column name and the name of the table of the constraint?

    Thank you

    Ask the USER_CONS_COLUMNS then you'll find the column name and table name

    SQL > Select * from USER_CONS_COLUMNS where Constraint_Name = "";

  • I can't find the function "bookmark all tabs" in Firefox 5 used to be there. He moved or just removed?

    I can't find the function "bookmark all tabs" in Firefox 5 used to be there. He moved or just removed?

    You can also right click on a tab to see this menu item.

  • find the ddl for all index

    Hello
    on the 11g on Win 2008 R2

    How to find the ddl for all index built on MY_VW?
    Thank you.

    You can use DBMS_METADATA for this:

    SELECT DBMS_METADATA.GET_DDL
           ( 'INDEX'
           , index_name
           , owner
           )
    FROM   all_indexes
    WHERE  table_name  = ''
    AND    table_owner = ''
    ;
    
  • Select all the values of column except the specific columns in all tables

    Hello

    I want to display all the column values for all tables in the database, with the exception of 3 columns that exist in all tables...

    Can someone give some advice?

    See you soon,.

    Jin

    How are you going to display all columns of all tables?

    Thank you
    Baskar.l

  • Correspondence of the columns from one table to another

    I have a database column that contains the name of a person. I have another table that has a column that contains the names separated by a comma.

    I want to match records where all records of two columns have a corresponding name. I tried this:

    < cfquery name = "MyQuery" datasource = "myds" >

    SELECT *.

    OF TBL_A

    WHERE TBL_A.customername IN (#DifferentQuery.ListOfNames #)

    < / cfquery >

    Everything that I try results in only get a recording. Basically, I want to get all records from a table where one of its columns contains the name of a column in another table.

    It's a many-to-many relationship. That is to say an editorial can be linked to many ads, and vice versa.  He is best represented with three tables. Such as:

    Table: [Editorial] column: [EditorialID (PK), EditorialText,...]

    Table: Columns of the [advertiser]: [AdvertiserID (PK), AdvertiserName]

    Table:   [Editorial_Advertisers] columns: [EditorialID, AdvertiserID]

    The name of the advertiser throw himself into a column...

    my client can decide which ads get related to which editorials

    The third table stores the relationship between ads and editorials.  So instead of storing a list of advertisers, you need to insert record for each EditorialID + AdvertiserID combination. You can then use joins to retrieve all the advertisements for EditorialID 123.

    SELECT  a.AdvertiserName
    FROM     Editorial_Advertiser ea INNER JOIN Advertiser a ON ea.AdvertiserID = a.AdvertiserID
    WHERE   ea.EditorialID = 123
    
  • Deactivation of the column in a table based on the setting in the search box

    Hi all

    I use Oracle Apex 4.1. I have two region

    1. search box

    2. in the form of a table

    In the search box, I have a LOV field where the user can select the value. Based on this LOV in the search box, tabular column f06 must disable or read-only.

    For example if I select THREE in LOV then only column f06 is expected on the other it must disable. How to get there.

    Thanks in advance

    Ravi

    Hi Bobo,

    Hope link below will solve your query.

    Disable the column in a table.

    BR,

    Patrick

  • Get the DDL for all tables in a schema;

    Hello

    I tried to get the DDL for all tables under my own diagram "A". Here are the steps I've tried, but in vain I
     1. logged in as a user A 
    2. And the ran query 
              
    SELECT DBMS_METADATA.get_ddl ('TABLE', 'XYZ')
    FROM user_tables
          
    o/p
    (HugecloB)
    
    {code}
    
    Any idea how i can get the DDL for all the tables under my own schema ?
    
    
    Thank you so much!
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:07 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Your idea is good, you missed only to use the correct table name:

    SELECT DBMS_METADATA.get_ddl ('TABLE', table_name)
    FROM user_tables;
    

    Concerning

  • How can I know the Position of the column in a table

    Hi all
    How can I know the position of the column in a table...
    For example: -.
    I have a table

    DESC EMPLOYEES

    EmpID
    Ename
    SAL

    I want to know the Empid is in 1st position, ename is 2nd and sal is in 3rd place.

    is this possible?

    SELECT *.
    Of user_tab_cols
    WHERE table_name = 'EMP ';

    Concerning
    Arun

  • Inventory of the data of all Tables in a database

    Hello
    We do the analysis of the existing data base (Oracle 10 g) and I want to prepare an inventory of the data of all tables in a database that is

    1. total number of records in a table
    2. total number of records that have null values in a column
    3. total number of standalone tables IE have no connection with other tables
    etc...

    Please let me know if there are tools or query that can do these tasks.

    Thank you and best regards,
    Lokesh
    select owner "Owner",
    table_name "Table_Name",
    column_name "Column_Name",
    initcap(data_type) ||
    decode(data_type,
    'CHAR', '('|| char_length ||')',
    'VARCHAR', '('|| char_length ||')',
    'VARCHAR2', '('|| char_length ||')',
    'NCHAR', '('|| char_length ||')',
    'NVARCHAR', '('|| char_length ||')',
    'NVARCHAR2', '('|| char_length ||')',
    'NUMBER', '('||
    nvl(data_precision,data_length)||
    decode(data_scale,null,null,
    ','||data_scale)||')',
    null) "Type",
    nullable "Nullable",
    decode(to_char(num_distinct),
    0,'No',
    'YES') "Have Data",
    owner sdev_link_owner,
    table_name sdev_link_name,
    'TABLE' sdev_link_type
    from sys.dba_tab_columns
    where (:OWNER is null or instr(owner,upper(:OWNER)) > 0)
    and (:TABLE_NAME is null or
    instr(upper(table_name),upper(:TABLE_NAME)) > 0)
    and (:COLUMN_NAME is null or
    instr(upper(column_name),upper(:COLUMN_NAME)) > 0)
    and substr(table_name,1,4) != 'BIN$'
    and substr(table_name,1,3) != 'DR$'
    order by owner, table_name, column_id
    

    I added a new column with an alias "get data". This new column will display "NO" is the entire column is zero and 'YES' if there is even a value not null in the column. But caution is that statistics table must be updated to get the correct results.

    Thus, it may be useful to gather current statistics before executing the query.

    Exec dbms_stats.gather_schema_stats or even dbms_stats.gather_database_stats.

  • Update the value of the column based on another value of the column to another table

    Hi all

    I have something very confused me and need your help.

    Having two tables A and B.

    Table A have 2 column (+ id + and desc1)

    Table B have column 2 also (+ transnum + and desc2)

    Now, I want to update the column desc2 of table B identical desc1 of table was where transnum of Table B same as the id of the table has.

    I use this SQL

    update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1

    but this error occurs

    Error from line 5 in order:
    update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1
    Error in the command line: 5 column: 35
    Error report:
    SQL error: ORA-00933: SQL not correctly completed command
    * 00933. 00000 - "command not properly ended SQL."
    * Question: *.

    * Action. *

    Hope someone can help me. TQ for help...
    SQL> create table a1 (id number(2),des varchar2(10));
    
    Table created.
    
    SQL> create table b1 (transnum number(2),des varchar2(10));
    
    Table created.
    
    SQL> insert into a1 values (1,'maran');
    
    1 row created.
    
    SQL> insert into b1 values (1,'ram');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> update b1 set des=(select des from a1 where b1.transnum=a1.id);
    
    1 row updated.
    
    SQL> select * from b1;
    
      TRANSNUM DES
    ---------- ----------
             1 maran
    
  • How to search all columns of all tables in a database

    I need to search all columns of all tables in a database, I already write the code below, but I got the below error message when running this script


    DECLARE
    The CNT number;
    v_data VARCHAR2 (20);
    BEGIN
    v_data: = "5C4CA98EAC4C";
    FOR t1 IN (SELECT table_name, column_name FROM all_tab_cols where owner = 'admin' and DATA_TYPE = 'VARCHAR2') LOOP
    RUN IMMEDIATELY "SELECT COUNT (*) FROM" | T1.table_name | 'WHERE ' | T1.column_name | ' =: 1' IN cnt USING v_data;
    IF cnt > 0 THEN
    dbms_output.put_line (t1.table_name |) » '|| T1.column_name | | » '|| CNT);
    END IF;
    END LOOP;
    END;
    /



    Error report:
    ORA-00933: SQL not correctly completed command.
    ORA-06512: at line 7
    00933 00000 - "not correctly completed SQL command.
    * Cause:
    * Action:


    Any help please

    If you are running this as a different user than the ADMIN you will also need to add the schema name.

    EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' ||t1.owner||'.'||t1.table_name|| ' WHERE ' ||t1.column_name || ' = :1' INTO cnt USING v_data;
    

    The error could be any strange names of tables or columns. For example, if they contain spaces in the name.
    If you have names, then all identifieres must be placed in "."

    + untested example +.
    {code}
    RUN IMMEDIATELY "SELECT COUNT (*) FROM" ' | "" T1. Owner: ' ». » ' || T1.table_name | " » OÙ « ' || T1.column_name | "" =: 1' IN cnt USING v_data;
    {code}

  • How can I get number of columns for all tables in a schema?


    Hello

    Can someone help me with the code to retrieve any of the columns in each table of a master plan? I'm sorry if it sounds simple. I'm a newbie...

    Thank you

    Maybe:

    Select table_name

    count (*) col_count

    of user_tab_cols

    Table_name group

    order of table_name;

Maybe you are looking for

  • Some videos do not play

    HelloI can't play videos. I can see them on Youtube, Facebook, etc., but some pages do not show the video player.I started Firefox in Safe Mode, but it does not solve the problem, tried to reset Firefox but I have the same problem. Updated Firefox an

  • How to activate the Tecra R80 - 144 sata 6GBs 3 for SSD

    Hello I have toshiba tecra r850-144 and I ssd but it does only have 3GBs why? What can I do to activate the full speed

  • CompactDAQ controllers

    Hello I have a question about CompactDAQ controllers. Is it possible to access it remotely through an internet connection? As is - this program start run after the power is on or the user must manually switch? Is it possible to Setup to do it automat

  • Dell Streak 7 locks, has power but will not turn on or off... what to do?

    I just got my Dell Streak a little over a month.  This is the second time that happens... don't know what's going on.  It has the power, you can tell because the sidebar lights but can't get anything to come on the screen at all. I tried to turn it o

  • Probem locking of blackBerry Smartphones