Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6332221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:13:14+00:00 2026-05-24T18:13:14+00:00

Using the following SQL, the DDL for a given materialized view can be obtained.

  • 0

Using the following SQL, the DDL for a given materialized view can be obtained.

BEGIN
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'STORAGE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'TABLESPACE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', FALSE);
END;
SELECT DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW', 'OBJECT_NAME', 'SCHEMA_NAME') FROM DUAL;

I am having difficulty retrieving the DDL without the tablespace information. The SET_TRANSFORM_PARAM directives are actually documented as being specific to tables and indexes (not materialized views). The STORAGE one does actually work whereas the TABLESPACE and SEGMENT_ATTRIBUTES ones have no effect. Is there any way to omit the tablespace info from the generated DDL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:13:16+00:00Added an answer on May 24, 2026 at 6:13 pm

    You need to set the object_type in the calls to SET_TRANSFORM_PARAM to MATERIALIZED_VIEW. In my example below, the tablespace is no mentioned:

    create materialized view mv
    as select * from large_t where rownum < 100;
    
    begin DBMS_METADATA.SET_TRANSFORM_PARAM (
                  transform_handle => dbms_metadata.session_transform,
                  name             => 'TABLESPACE',
                  value            => false,
                  object_type      => 'MATERIALIZED_VIEW');
    end;
    /
    
    select dbms_metadata.get_ddl(
               'MATERIALIZED_VIEW',
               'MV',
               user)
             from dual;
    
    CREATE MATERIALIZED VIEW "SODONNEL"."MV" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME")
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      BUILD IMMEDIATE
      USING INDEX 
      REFRESH FORCE ON DEMAND
      USING DEFAULT LOCAL ROLLBACK SEGMENT
      USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
      AS select * from large_t where rownum < 100
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can drop a SqlServer Backup Device using SQL-DMO using the following pseudo-code: SQLDMO.SQLServer2
I can easily see a list of recently run queries using the following SQL:
How can I execute the following SQL in a scalable way using JdbcTemplate running
I'm currently using the following SQL for retrieving the last seven days worth of
Hi i am using the following dynamic sql: declare @cmd nvarchar(4000) set @cmd= 'select
For instance, my query is like the following using SQL Server 2005: SELECT *
I am using SQL Server 2008 management studio to execute the following SQL statements,
How do I do the following SQL in LINQ? I am actually using LINQ
I have a SqlDependency set up using the following query: string sql = "SELECT
as example, I've the following SQL query ( using Access 2007 ) SELECT ID,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.