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;