Basically, the syntax is as follows:
a. Get a single mergement table and the syntax of the index
SET Heading OFF;
Set echo OFF;
SET PAGES 999;
SET long 90000;
Spool dept.sql
SELECT DBMS_METADATA.GET_DDL ('Table', 'DEPT', 'Scott') from DUAL
SELECT DBMS_METADATA.GET_DDL ('INDEX', 'DEPT_IDX', 'Scott') from DUAL
Spool OFF;
b. Get all the scheduled tables and indexed syntax under Schema, which is SCOTT as an example:
SET PAGESIZE 0
Set long 90000
Set feedback off
Set echo off
Spool scott_schema.sql
CONNECT Scott / Tiger;
SELECT DBMS_METADATA.GET_DDL ('Table', u.table_name)
From user_tables u;
SELECT DBMS_METADATA.GET_DDL ('INDEX', U.Index_name)
From user_indexes u;
Spool OFF;
c. Get the syntax of all stored procedures for SCHEMA
CONNECT Brucelau / Brucelau;
Spool procedures.sql
SELECT
DBMS_METADATA.GET_DDL ('procedure', u.object_name)
From
User_Objects U
WHERE
Object_type = 'procadu';
Spool OFF;
another:
DBMS_METADATA.GET_DDL ('Table', 'Tab1', 'USER1')
In the three parameters, the first specified object type (in this case is a table type), the second is the username where the object name is the object name (in this example), the third is the username where the object is.