Get VIEW ddl using query

后端 未结 2 1103
挽巷
挽巷 2021-01-02 10:39

For database re-architecture I need to get DDL of each table and view in the database(Oracle). I don\'t want to go to property of each table/view and get SQL out of it in SQ

相关标签:
2条回答
  • 2021-01-02 10:58

    For materialized views use:

    select dbms_metadata.get_ddl('MATERIALIZED_VIEW','MView_name','Schema_Name') 
      from dual;
    

    See all supported object types here: DBMS_METADATA: Object Types

    0 讨论(0)
  • 2021-01-02 11:05

    Try the below query for view:

    select text from ALL_VIEWS where upper(view_name) like upper(<view_name>);
    

    For mviews:

    select query from ALL_MVIEWS where upper(mview_name) like upper(<mview_name>);
    
    0 讨论(0)
提交回复
热议问题