AYR
AYR

Reputation: 1179

How to view the original script of a materialized view?

I am interested in moving a materialized view from one db to the other, regardless, I also need to change one of the columns. How can I view the original script that build the MV? I am running TOAD, but cannot seem to find the original script.

Thanks in advance!

Upvotes: 23

Views: 92946

Answers (4)

Icaro
Icaro

Reputation: 2787

If you use Oracle SQL Developer you just have to go to the "view" or "materialized view" node of the navigation tree

Upvotes: 7

manyways
manyways

Reputation: 4746

I ended up running:

select * from all_mviews where mview_name = ‘YOUR_MV_NAME’;

Upvotes: 10

Marco Baldelli
Marco Baldelli

Reputation: 3728

You can use the function dbms_metadata.get_ddl:

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

Upvotes: 36

Petr Pribyl
Petr Pribyl

Reputation: 3575

select query from user_mviews
  where mview_name = 'your materialized view';

Upvotes: 7

Related Questions