Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    chennai
    Posts
    25

    Unanswered: how to find a particular column presents

    hi all,

    after creating a table,i want to see the structure of the table,
    for that i can use ,
    sql> Desc table;
    but it gives column_name and datatypes as well.

    i want the query for following;
    first Q' ---> i need only the column_name of the table
    second Q' ---> how to find whether a particular column_name exists in a table.

    plz send the queries...
    thanx in advance
    Sakthi

  2. #2
    Join Date
    Apr 2002
    Posts
    56
    You can use the view ALL_TAB_COLUMNS (or DBA_TAB_COLUMNS) to look for columns of a table

    SELECT TABLE_NAME,COLUMN_NAME
    FROM ALL_TAB_COLUMNS
    WHERE TABLE_NAME = :FILL IN

  3. #3
    Join Date
    Mar 2004
    Location
    chennai
    Posts
    25
    hi,
    thanx for reply...

    from the first Q': i find the query is--> select column_name from user_objects where table_name="EMPLOYEE";

    it will give me the column name only....

    but i need second Q's answer:

    actually what i need is,
    for example: i am having a table EMPLOYEE which contains the column_name of, ENO,ENAME,ADDRESS,PHNO..

    i want to find out whether ADDRESS column is present in EMPLOYEE table.

    plz send me the query..
    thanx in advance
    Sakthi

  4. #4
    Join Date
    May 2003
    Posts
    45
    select COLUMN_NAME from all_tab_columns where COLUMN_NAME like 'ADDRESS' and table_name like 'EMPLOYEE'

    IF COLUMN_name IS displayed that means the table contains the column and if 'no rows selected' is diplayed that means table does not contain the column

  5. #5
    Join Date
    Mar 2004
    Location
    chennai
    Posts
    25
    Thanx itsmanyam
    Sakthi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •