Select Query not retrieving all tables' columns!
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Select Query not retrieving all tables' columns!

  1. #1
    Join Date
    Feb 2001
    Posts
    286
    Hi all!

    I have this query:

    1.I would like to see all the columns and table_names for the query passed as under.

    But there are 3 to 4 tables which have column names like STORE_CODE which is not getting
    selected by the undermentioned query.

    Could anyone please guide me as to where I had gone wrong.

    Why this query is not selecting all the table names in the STORE Modules.

    select distinct(ucc.column_name),ucc.table_name
    from user_constraints u,user_cons_columns ucc
    where ucc.column_name in ('STORE_NO','STORE_CODE','ISSUE_STORE_CODE','RECEIPT_STORE_CODE')
    and ucc.owner = 'BALAJI'

    Could anyone please guide me as to where I had gone wrong.


    Thanks&Regards,

    Amit.

  2. #2
    Join Date
    Sep 2001
    Posts
    163
    I think it's because you are selecting "distinct" column_name. The query will return only one value and will ignore all the other values it returned. If you get rid of distinct, you will get all tablenames and columns for those tables.


    Also, according to your sql statement, you included user_constraints are not using the user_constraints table.

  3. #3
    Join Date
    Jul 2000
    Posts
    521
    You are using 'USER_...' views. Are you sure that those 3-4 tables that certainly have STORE_CODE column are owned by the user through which you firing this query ?
    svk

Posting Permissions

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



Click Here to Expand Forum to Full Width