How do I copy a materialized view to a table?
-
29-09-2020 - |
Question
I have a materialized view. I want to create a copy of it so I can modify some of the data to test a few theories about an issue and its possible solutions.
How do I make a copy of this MV as a table? The copy will reside in the same schema but will have a different name. the copy should be an identical copy (structure and data) of the MV, it's just going to be a table so I edit the data.
Solution
It sounds like you just want a CREATE TABLE AS SELECT
CREATE TABLE your_new_table_name
AS
SELECT *
FROM your_materialized_view
If there are indexes on your materialized view that you want to create on the table, you'd need to create those separately.
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange