Jump to content
xisto Community

Getting The Underlying Query For A View...

Recommended Posts

All,If someone is working in oracle... and have some time to explore... try this and help me finish my job :).Is it possible to get the underlying query for a view? If yes... how?Considerations:- Normal user -- Just select privileges on the view...- No external app. to access the DB. Just the basic editor.Thanks.In some cases where there is an UI... like in MS SQl, there should be an option to get the underlying query just by right clicking and selecting an option of the view. But in this case... I need the solution to get the underlying view via a query.I am sure there should be such an option... I have seen people modify the view, which is not possible if they do not have the query itself itself in the first place...

Share this post

Link to post
Share on other sites

Ok.. I got the solution for this and is the best solution.
It has something to do with the metadata.

All the details about the views are stored in a metadata table called all_views.
When I talk about all the details, it also means that details about the query that constructed about the view too.

All I had to do is to write the below query to get the underlying query. Simple.

select TEXT from all_views where VIEW_NAME='VIEW_NAME';

You might have to replace the VIEW_NAME in single quotes with the actual view name.
There is also this thing of privileges. You might need privileges to access the metadata.

Hope this helps.

Thanks to Karthikeyan who helped me in this. Check out the comments section of the post.
Edited by varalu (see edit history)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.