HOME       >>       Software

Getting The Underlying Query For A View...


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...


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.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.