MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/kuiot.xsl

<?xml version="1.0"?>
<!-- 

 Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.

NAME
    kuiot.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of IOT ADTs
NOTES
    Do NOT modify this file under any circumstance. If you wish to use this
    stylesheet with an external XML/XSL parser, first make a copy then reverse
    the comments on any xsl:import statements appearing below.

MODIFIED        MM/DD/YY
    rapayne     01/20/15 - lrg 14979799: handle OVERFLOW with dsc segments.
    tbhukya     01/05/15 - Bug 20319428: Declare referred params and import
                           xsl files for referred templates
    bwright     08/15/13 - Bug 17312600: Remove hard tabs from DP src code
    tbhukya     07/13/13 - Bug 11769599: Add tempplate DoIotCntIdx 
    lbarton     03/20/13 - bug 11769626: IOV logging; add template headers
    rapayne     12/06/08 - merge BLOCKSIZE logic for CM
    lbarton     11/02/05 - Bug 4715313: reformat files for use with XMLSpy 
    htseng      08/08/05 - bug 3560220: get correct behavior from processor 
    lbarton     05/09/05 - bug 4331909: use dataobj_num for OBJNO_REUSE in 
                           overflow seg 
    lbarton     05/21/04 - Bug 3617842: SAMPLE and PCTSPACE 
    lbarton     07/15/03 - Bug 3045654: nested table tablespace if vsn >= 10
    lbarton     06/04/03 - bug 2990330: for IOV supply obj# for transportable
    htseng      11/01/02 - temp disable nestead tablespace
    gclaborn    11/03/00 - change name
    lbarton     06/23/00 - Multinested collections
    lbarton     05/15/00 - Params for new API
    lbarton     03/17/00 - Add module header
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Needed for template DoPIOTSegAttrs -->
 <xsl:import href="kuprtobj.xsl"/>
 <!-- Needed for templates QuoteObject, DoParse, DoLogging -->
 <xsl:import href="kucommon.xsl"/>
 <!-- Top-level parameters -->
 <xsl:param name="PRETTY">1</xsl:param>
 <xsl:param name="SQLTERMINATOR">0</xsl:param>
 <xsl:param name="SEGMENT_ATTRIBUTES">1</xsl:param>
 <xsl:param name="VERSION">9999999999</xsl:param>
 <!-- Templates -->
 <xsl:template match="PK_CON">
  <!-- *******************************************************************
Template: PK_CON: primary key constraint for IOT
******************************************************************** -->
  <xsl:param name="InColList">0</xsl:param>
  <xsl:if test="$InColList=1">
   <xsl:text>, </xsl:text>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;&#x9;</xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- if not system-generated name, emit constraint name -->
  <xsl:if test="8>(FLAGS mod 16)">
   <xsl:text>CONSTRAINT "</xsl:text>
   <xsl:value-of select="NAME"/>
   <xsl:text>" </xsl:text>
  </xsl:if>
  <xsl:text>PRIMARY KEY (</xsl:text>
  <xsl:apply-templates select="COL_LIST">
   <xsl:with-param name="ADT_type">INDEX</xsl:with-param>
   <xsl:with-param name="DoLF">0</xsl:with-param>
   <xsl:with-param name="DoHidden">1</xsl:with-param>
  </xsl:apply-templates>
  <xsl:text>)</xsl:text>
  <!-- primary key & unique constraints
                            can't use NOVALIDATE. bug 573946 -->
  <xsl:apply-templates select="ENABLED">
   <xsl:with-param name="NOVALIDATE_OK">0</xsl:with-param>
  </xsl:apply-templates>
 </xsl:template>
 <xsl:template name="DoIOV">
  <xsl:param name="Node" select="''"/>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: DoIOV: IOT overflow table
Parameters:
  Node: parent of IOV node
  Nested - 1 = generating DDL for a nested table
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <xsl:if test="($Node/INCLCOL_NAME)">
   <xsl:text> INCLUDING "</xsl:text>
   <xsl:value-of select="$Node/INCLCOL_NAME"/>
   <xsl:text>"</xsl:text>
  </xsl:if>
  <xsl:text> OVERFLOW</xsl:text>
  <xsl:if test="$SEGMENT_ATTRIBUTES=1">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <xsl:text> </xsl:text>
   <xsl:choose>
    <xsl:when test="($Node/PROPERTY mod 64)>=32">
     <!-- PIOT -->
     <xsl:call-template name="DoPIOTSegAttrs">
      <xsl:with-param name="Node" select="$Node/PART_OBJ/OVPARTOBJ"/>
     </xsl:call-template>
     <xsl:call-template name="DoPIOTLogging">
      <xsl:with-param name="Node" select="$Node/PART_OBJ/OVPARTOBJ"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:apply-templates select="$Node/IOV">
      <xsl:with-param name="Nested" select="$Nested"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
     </xsl:apply-templates>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template match="IOV">
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: IOV - do physical properties for IOT overflow table
 Current node: IOV
 Parameters:
  Nested - 1 = generating DDL for a nested table
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <xsl:apply-templates select="PCT_FREE"/>
  <xsl:call-template name="DoLogging">
   <xsl:with-param name="FlagsNode" select="FLAGS"/>
  </xsl:call-template>
  <xsl:choose>
   <xsl:when test="DATAOBJ_NUM">
    <xsl:choose>
     <xsl:when test="not(STORAGE)">
      <!-- There is no deferred storage metadata for IOT overflow tables.
           So, we just need to ensure we get the tablespace
      -->
      <xsl:if test="$TABLESPACE=1">
        <xsl:apply-templates select="TS_NAME"/>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates select="STORAGE">
       <xsl:with-param name="Nested" select="$Nested"/>
       <xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
       <xsl:with-param name="Dataobjnum" select="DATAOBJ_NUM"/>
       <xsl:with-param name="Pctspace" select="$Pctspace"/>
      </xsl:apply-templates>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:otherwise>
    <!-- An old Data Pump dump file may not have DATAOBJ_NUM.
         But sometimes OBJ_NUM will contain the same value.
         So use it as the value of Dataobjnum and hope we're lucky -->
    <xsl:apply-templates select="STORAGE">
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
     <xsl:with-param name="Dataobjnum" select="OBJ_NUM"/>
     <xsl:with-param name="Pctspace" select="$Pctspace"/>
    </xsl:apply-templates>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="$VERSION>=1000000000 and $Nested='1'
                and string-length(TS_NAME)!=0">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <xsl:text> TABLESPACE "</xsl:text>
   <xsl:value-of select="TS_NAME"/>
   <xsl:text>" </xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoIotCntIdx">
  <xsl:param name="Oname" select="''"/>
  <xsl:param name="Cname" select="''"/>
  <xsl:param name="Iname" select="''"/>
  <!-- *******************************************************************
Template: DoIotCntIdx: IOT top index
Parameters:
  Oname - Owner name
  Cname - Constraint name 
  Iname - Index name
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ALTER</xsl:with-param>
   <xsl:with-param name="ObjectType">INDEX</xsl:with-param>
   <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
   <xsl:with-param name="NameNode" select="SCHEMA_OBJ/NAME"/>
  </xsl:call-template>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa; </xsl:text>
  </xsl:if>
  <xsl:text> ALTER INDEX </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Schema" select="$Oname"/>
   <xsl:with-param name="Object" select="$Cname"/>
  </xsl:call-template>
  <xsl:text> RENAME TO </xsl:text>
  <xsl:text>"</xsl:text>
  <xsl:value-of select="$Iname"/>
  <xsl:text>"</xsl:text>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO