Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

oracle sql query

hi guys,

Can we know that , a particular column is exist in which table of database.
E.g I am working in a database 'ABC' which have 100 tables, now I want to know the name of tables which have a column 'ENO'.
Please rep soon.
0
ajay_erdci
Asked:
ajay_erdci
  • 2
  • 2
  • 2
  • +3
1 Solution
 
azureshowCommented:
hi, you can use the sql as following to find the table which the column_name ='ENO'[select table_name from cols where column_name='ENO'].Hope you can make it soon.
/
0
 
ajay_erdciAuthor Commented:
Dear Azureshow,

I very sorry to say that there is a change in the question, I was trying to change it on the same time you make the reply.
That is not the table , basically its a public synonym which is assiend to each user.
Please consider the change and make the reply.

Sorry again

AJAY
0
 
mona1974Commented:
COLS is a snonym for USER_TAB_COLUMNS. Try to select from ALL_TAB_COLUMNS.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
ajay_erdciAuthor Commented:
Dear Mona1974,

My user do't have the access to draw the data from tables, because he is no where conseren to table.
Give me the way by which we can know the synonym names in which that column has been used.

ajay
0
 
oraelbisCommented:
As say mona1974 try select from ALL_TAB_COLUMNS such as:

select C.TABLE_NAME
  from ALL_TAB_COLUMNS C
 where C.COLUMN_NAME='ENO' and C.OWNER='ABC'
0
 
oraelbisCommented:
You can grant this table directly to user or role.
Or such as for me, create simple view such as

create or replace view V_ALL_TAB_COLUMNS as
select C.TABLE_NAME, C.COLUMN_NAME, C.OWNER
 from SYS.ALL_TAB_COLUMNS C

and then grant this view to role or user such as:

GRANT SELECT ON V_ALL_TAB_COLUMNS TO FIN_ROLE;

granting privileges via ROLE are more simple, for many users.
0
 
azureshowCommented:
SQL: select synonym_name from user_synonyms A,cols B
where A.table_name=B.table_name and B.column_name='ENO' and B.owner='ABC'

Sorry, I have been busy these days, and hope that you have solved it already. If not wish the SQL above will help you clear your question. PS:Because I can not understand your question well, I can only give you the answer from the other comments.
0
 
walterecookCommented:
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately 4 days.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help.jsp#hs5

walterecook
EE Cleanup Volunteer
0
 
walterecookCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ - no points refunded

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

walterecook
EE Cleanup Volunteer
0
 
amp072397Commented:
PAQed - no points refunded (of 150)

amp
Community Support Cleanup Moderator
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now