how to get the query of a view in oracle

Solutions on MaxInterview for how to get the query of a view in oracle by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to get the query of a view in oracle"
Luna
02 Aug 2017
1-- Views (use USER_VIEWS or DBA_VIEWS if needed):
2SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME) LIKE upper('%VIEW_NAME%');
3-- Or:
4SELECT dbms_metadata.get_ddl('VIEW', 'FLEX_TRADE_AGREG', 'OWNER_NAME') 
5	FROM DUAL;
6
7-- Materialized views (use USER_VIEWS or DBA_VIEWS if needed):
8SELECT QUERY FROM ALL_MVIEWS WHERE upper(MVIEW_NAME) LIKE upper('%VIEW_NAME%');
9-- Or:
10SELECT dbms_metadata.get_ddl('MATERIALIZED_VIEW', 'VIEW_NAME', 'OWNER_NAME') 
11FROM DUAL;