Materialized View [message #60558] |
Sun, 15 February 2004 21:44 |
Mark
Messages: 284 Registered: July 1998
|
Senior Member |
|
|
Does anyone know how to get the source code that was used to create a Materialized View from the data dictionary.
|
|
|
Re: Materialized View [message #60562 is a reply to message #60558] |
Mon, 16 February 2004 03:09 |
Frank Naude
Messages: 4587 Registered: April 1998
|
Senior Member |
|
|
Hi,
If you are using Oracle9i or above, you could use DBMS_METADATA.GET_DDL(). Look at this example:
SQL> CREATE MATERIALIZED VIEW x
2 REFRESH COMPLETE WITH ROWID
3 AS SELECT * FROM dual;
Materialized view created.
SQL> set long 32000 pages 50000
SQL> SELECT dbms_metadata.get_ddl('MATERIALIZED_VIEW', 'X')
2 FROM dual;
DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','X')
--------------------------------------------------------------------------------
CREATE MATERIALIZED VIEW "SYS"."X"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOG
GING
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSTEM"
BUILD IMMEDIATE
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSTEM"
REFRESH COMPLETE ON DEMAND
WITH ROWID USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT "DUAL"."DUMMY" "DUMMY" FROM "DUAL" "DUAL"
Best regards.
Frank
|
|
|
|