zoukankan      html  css  js  c++  java
  • DBMS_METADATA.set_transform_param格式化输出

    DBMS_METADATA.set_transform_param格式化输出获得DDL

    --输出信息采用缩排或换行格式化

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'PRETTY', TRUE);

    --确保每个语句都带分号

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'SQLTERMINATOR', TRUE);

    --关闭表索引、外键等关联(后面单独生成)

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'CONSTRAINTS', FALSE);

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'REF_CONSTRAINTS', FALSE);

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'CONSTRAINTS_AS_ALTER', FALSE);

    --关闭存储、表空间属性

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'STORAGE', FALSE);

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'TABLESPACE', FALSE);

    --关闭创建表的PCTFREE、NOCOMPRESS等属性

    EXEC DBMS_METADATA.set_transform_param(DBMS_METADATA.session_transform, 'SEGMENT_ATTRIBUTES', FALSE);

    18.11.1 Using a PL/SQL Package to Display Information About Schema Objects

    The Oracle-supplied PL/SQL package procedure DBMS_METADATA.GET_DDL lets you obtain metadata (in the form of DDL used to create the object) about a schema object.

    See Also:

    Oracle Database PL/SQL Packages and Types Reference for a description of the DBMS_METADATA package

    Example: Using the DBMS_METADATA Package

    The DBMS_METADATA package is a powerful tool for obtaining the complete definition of a schema object. It enables you to obtain all of the attributes of an object in one pass. The object is described as DDL that can be used to (re)create it.

    In the following statements the GET_DDL function is used to fetch the DDL for all tables in the current schema, filtering out nested tables and overflow segments. The SET_TRANSFORM_PARAM (with the handle value equal to DBMS_METADATA.SESSION_TRANSFORM meaning "for the current session") is used to specify that storage clauses are not to be returned in the SQL DDL. Afterwards, the session-level transform parameters are reset to their defaults. Once set, transform parameter values remain in effect until specifically reset to their defaults.

    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');

    The output from DBMS_METADATA.GET_DDL is a LONG data type. When using SQL*Plus, your output may be truncated by default. Issue the following SQL*Plus command before issuing the DBMS_METADATA.GET_DDL statement to ensure that your output is not truncated:

    SQL> SET LONG 9999

  • 相关阅读:
    拓扑检查(ArcEngine)
    IMap.SelectByShape 方法选择要素
    根据图层获取要素的渲染颜色
    ArcEngine(AE)符号选择器及符号恢复功能【转载】
    版面元素介绍IElement
    示例:由线段生成一个环,由环构成一个多边形(可以包含多个环的多边形集)
    AO的Display对象简介二【转载】
    显示要素层中的某些要素
    示例:从GraphicsContain中取出一个元素
    示例:从Table中获取SelectionSet
  • 原文地址:https://www.cnblogs.com/kawashibara/p/10054678.html
Copyright © 2011-2022 走看看