Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
DBMS_METADATA , 11 of 11
GET_XML and GET_DDL return the metadata for the specified object as XML or DDL.
FUNCTION get_xml ( object_type IN VARCHAR2, name IN VARCHAR2, schema IN VARCHAR2 DEFAULT NULL, version IN VARCHAR2 DEFAULT 'COMPATIBLE', model IN VARCHAR2 DEFAULT 'ORACLE', transform IN VARCHAR2 DEFAULT NULL) RETURN CLOB; FUNCTION get_ddl ( object_type IN VARCHAR2, name N VARCHAR2, schema IN VARCHAR2 DEFAULT NULL, version IN VARCHAR2 DEFAULT 'COMPATIBLE', model IN VARCHAR2 DEFAULT 'ORACLE', transform IN VARCHAR2 DEFAULT 'DDL') RETURN CLOB;
Parameter | Description |
---|---|
|
The type of object to be retrieved. This parameter takes the same values as the |
|
An object name (case-sensitive). If |
|
A schema name (case sensitive). The default is the current schema if |
|
The version of metadata to be extracted. This parameter takes the same values as the |
|
The object model to use. This parameter takes the same values as the |
|
The name of a transformation on the output. This parameter takes the same values as the |
The metadata for the specified object as XML or DDL.
INVALID_ARGVAL
. A NULL
or invalid value was supplied for an input parameter. The error message text identifies the parameter.
OBJECT_NOT_FOUND
. The specified object was not found in the database.
These functions provide a simple way to return the metadata for a single object. Conceptually each GET_xxx
call is comprised of an OPEN
, one or two SET_FILTER
calls, optionally an ADD_TRANSFORM
, a FETCH_xxx
and a CLOSE
. The object_type
parameter has the same semantics as in OPEN
. The schema
and name
parameters are used for filtering. If a transform is specified, schema-level transform flags are inherited.
This function can only be used to fetch named objects. It cannot be used to fetch objects of type OBJECT_GRANT
or SYSTEM_GRANT
. To fetch these objects, use the programmatic interface.
set pagesize 0 set long 90000 SELECT DBMS_METADATA.GET_XML ( 'TABLE','EMP','SCOTT') FROM DUAL;
This example fetches the DDL for all "complete" tables in the current schema, filtering out nested tables and overflow segments. The example uses SET_TRANSFORM_PARAM
(with the handle value = DBMS_METADATA.SESSION_TRANSFORM
meaning "for the current session") to specify that storage clauses are not to be returned in the SQL DDL. Afterwards, the example resets the session-level parameters to their defaults.
set pagesize 0 set long 90000 execute DBMS_METADATA.SET_TRANSFORM_PARAM( DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false); SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) FROM USER_ALL_TABLES u WHERE u.nested='NO' AND (u.iot_type is null or u.iot_type='IOT'); execute DBMS_METADATA.SET_TRANSFORM_PARAM( DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|