Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Cergy
    Posts
    65

    Question Unanswered: Query to know if a field exists in a table ?

    What is the SQL (Oracle) to know if a field exists in a table ?

    Thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    492
    Basically any variation on this - you want to look in all_tab_columns

    Code:
    Select 'EXISTS'
      from dual
    where exists (select 1
                         from all_tab_columns
                       where table_name = 'EMP' and
                                column_name = 'EMPNO')
    Oracle OCPI (Certified Practicing Idiot)

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Or even "DESC table_name" (desc stands for "describe"); if number of columns fits the screen, you won't even have to scroll up/down to find it

Posting Permissions

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