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/kutable.xsl

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

 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

NAME
    kutable.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of md$_{h/fh/pfh/io}table_t ADTs
NOTES
    Do NOT modify this file under any circumstance. Copy the file
    if you wish to use this stylesheet with an external XML/XSL parser

MODIFIED        MM/DD/YY
    apfwkr      04/13/18 - Backport rmacnico_bug-25882883 from main
    rapayne     03/18/18 - add inmemory support for external table objects.
    tbhukya     10/25/17 - Bug 26953179: Generate memoptimize at table level
                           for merge partition_options.
    jjanosik    10/24/17 - Bug 26847241: move collation to alter for clustered
                           tables
    rapayne     10/13/17 - Bug 26959181: Suppress IOT OVERFLOW clause if
                           DWCS_CVT_IOTS is set.
    jjanosik    10/11/17 - Bug 26952839: handle memoptimize for read and write
                           wrt datapump in DoMemoptimizeSyntax
    rapayne     10/06/17 - Bug 26895793: suppress INDEXING clause when departitioning.
    sdavidso    10/07/17 - Bug26385367 move chunk fails with ILM POLICY
                           Bug26392312 move chunk fails with temporal validity
    rapayne     10/06/17 - Bug 26895793: suppress INDEXING clause when departitioning.
    rapayne     10/01/17 - Bug 26878794: dont call iopphysicalatt if DWCS_CVT_IOTS.
    jjanosik    09/22/17 - Bug 26636020: do not alter anydata columns that have
                           been set unused.
    mjangir     09/21/17 - bug 26640535: wrong read only emit
    jjanosik    09/13/17 - Bug 26721864: do not emit memoptimize for read if
                           CONSTRAINTS is turned off
    jjanosik    09/07/17 - Bug 25321187: fix properties when departitioning a
                           subpartition
    sdavidso    08/29/17 - bug25453685 name mapping for domain indexes
    rapayne     08/12/17 - Bug DWCS: add support for DWCS envir.
    tbhukya     08/08/17 - Bug 26582168: Generate inmemory clauses for 
                           non-partitioned external table
    tbhukya     08/03/17 - Bug 26555858: Support INMEMORY_CLAUSE with 
                           departition of Partitioned external table
    tbhukya     08/02/17 - Bug 26549646: Support departition for composite
                           partitioned external table
    tbhukya     08/01/17 - Bug 25322579: Handle Xmltype partition lob storage 
                           in departition
    tbhukya     07/26/17 - Bug 26515193: Pass external partition conversion flag
    jjanosik    07/18/17 - Bug 26449902: Get inmemory when merge partitions
    sdavidso    07/06/17 - Bug 26357158 exchange_out for bitmap indexes
    jjanosik    06/27/17 - Bug 26236931: fix read only if we are merging
                           partitions
    tbhukya     06/12/17 - Bug 26237351: Add support of merge partition option
                           to external partition table
    jjanosik    06/09/17 - Bug 26226131: Handle compression in departition when
                           the partition has deferred storage
    jjanosik    05/24/17 - Bug 24803693: Make SEGMENT_ATTRIBUTES and
                           TABLE_COMPRESSION_CLAUSE play nice together
    jjanosik    05/11/17 - Bug 25321187: handle properties for PARTITION_NAME
    rapayne     05/20/17 - bug 26042241: ROW ARCHIVAL not propagated during
                           de-partitioning operation.
    tbhukya     05/16/17 - Bug 26036341: Support departition for external 
                           partition table
    sdavidso    03/30/17 - bug25440009 handle user name with apostrophe
    jcarey      03/08/17 - Bug 25254484 aw lockdown
    tbhukya     02/13/17 - Bug 25539885: Memoptimize with deferred segment
    jjanosik    02/01/17 - Bug 25413834: remove hacks, let kumviewl handle
                           cache and parallel
    tbhukya     01/30/17 - Bug 25095866: Generate MEMOPTIMIZE clause
    sdavidso    12/06/16 - bug24702971 extend SHARD_DROP_TEMP to constraints
                           also, for sharding, use constraints_as_alter
    jjanosik    12/06/16 - bug 24482120: generate cellmemory when segment
                           creation is deferred
    rapayne     09/21/16 - bug 23203578: global temp tabs need to support
                           parallel attributes.
    jjanosik    08/19/16 - bug 24387072: fix how/when the collation clause 
                           is output
    tbhukya     08/04/16 - Bug 24313182: Add double quotes to collation name
    tbhukya     07/08/16 - Bug 23738844: Deferred storage for IOT
    jjanosik    06/29/16 - bug 23708351 do not gen partition stuff if the
                           table is cluster-based
    tbhukya     06/09/16 - Bug 22171888: Support CELLMEMORY
    sdavidso    06/03/16 - bug23262571 avoid ORA-054 for move chunk
    sdavidso    04/01/16 - bug-23015822 placement of segment creation
    rapayne     01/30/16 - bug 22611512: fix variable Transportable
    sdavidso    12/21/15 - shard - unconditionally drop temp tables
    sdavidso    12/10/15 - bug22264616 more move chunk subpart
    sogugupt    12/01/15 - Bug 22229581: Reording of GenNestedTableConstraints
                           and DoHiddenConstraint 
    sdavidso    11/17/15 - bug21869037 chunk move w/subpartitions
    jjanosik    11/12/15 - bug 8860231 unconditionalize call to DoParallel
    bwright     10/19/15 - Bug 21279204: Fix lob storage clause output for
                           unpacked anydata column
    tbhukya     10/07/15 - Bug 14696962: Don't generate CHECK_TYPE for 
                           unused column of UDT.
    tbhukya     09/30/15 - Bug 21886016: Generate collation when
                           max_string_size=extended and version >=12.2
    rapayne     09/20/15 - Bug 21147617 - support new inmemory DISTRIBUTION
                           syntax in PARTOBJ.
    rapayne     07/31/15 - bug 21536501/21436670: conditionalize DEFAULT 
                           DIR for external tables.
    rapayne     04/10/15 - support application root objects.
    tbhukya     09/30/15 - Bug 21886016: Generate collation when
                           max_string_size=extended and version >=12.2
    rapayne     07/31/15 - bug 21536501/21436670: conditionalize DEFAULT DIR 
                           for external tables.
    rapayne     04/10/15 - support application root objects.
    sdavidso    08/17/15 - bug-20756759: lobs, indexes, droppped tables
    tbhukya     07/28/15 - Bug 21276592: Partitioned cluster table
    tbhukya     07/14/15 - Bug 21438396: Default collation is not valid for
                           object, xml type table
    sogugupt   07/13/15 - Bug 21312469 - Incorrect ILM policy
    sogugupt    07/13/15 - Bug 21312469 - Incorrect ILM policy
    sdavidso    06/26/15 - bug20864693: read only partition support
    tbhukya     05/23/15 - Bug 21118665: DBC support for object, xml type table
    rapayne     05/20/15 - external table enhancements for partition locations.
    sdavidso    03/17/15 - proj 56220-2 - partition transportable
    aditigu     03/03/15 - Bug 20433683: Unspecified IMC attrs should be null
    tbhukya     02/25/15 - Proj 47173: Data bound collation
    sogugupt    02/19/15 - MAke table as read only
    rapayne     12/22/14 - lrg 14979799 - deferred segment IOTs not getting
                           TABLESPACE clause.
    rapayne     11/07/14 - bug 19976325 - deferred segment support for [P]IOTs.
                           and xmltype tables.
    rapayne     09/22/14 - don't generate COMPRESS clause for MVIEW_LOG
                           objects. 
    tbhukya     10/20/14 - Bug 19688579:Add XMLTOKENSET for xml token set
                           entity
    lbarton     10/14/14 - bug 19164768: temporal validity + row archival
    rapayne     09/21/14 - bug 19631502 - add OMIT_AQ_CLAUSE parameter. 
    rapayne     07/01/14 - bug 18796897 - virtual/hidden cols are valid for 
                           temporal validity cols
    sdavidso    06/02/14 - bug18789078 - default on null for ADT
    tbhukya     05/30/14 - Bug 18852129: Generate indexing clause after 
                           tables physical properties. 
    sdavidso    05/23/14 - backport bug18760457 from MAIN
    apfwkr      05/20/14 - Backport lbarton_bug-18746312 from main
    lbarton     05/14/14 - bug 18746312: don't import view-as-table with
                           transportable params
    lbarton     04/30/14 - bug 18449519: multiple valid time periods
    apfwkr      04/29/14 - backport of sdavidso_bug-18153657 from main
    sdavidso    04/04/14 - bug18385644: new IMC syntax
    sdavidso    03/28/14 - bug18153657: virtual col w/NOT NULL constraint fails
                           on import
    tbhukya     12/04/13 - Bug 13770504: Remove XMLCOL_V10P param
    rapayne     11/24/13 - bug 15916457: refpart tables now contain possible 
                           objgrant nodes.
    bwright     10/18/13 - Bug 17627666: Add COL_SORTKEY for consistent
                           column ordering with stream and exttbl metadata
    sdavidso    08/02/13 - bug16915643: extended inmemory options
    dvekaria    09/04/13 - Bug 16995929: Include Nested output for get_ddl().
    bwright     08/21/13 - Bug 17312600: Remove hard tabs from DP src code
    tbhukya     07/13/13 - Bug 11769599: Generate ALTER INDEX if IOT top
                           index name is different from constraint.
    lbarton     06/27/13 - bug 16800820: valid-time temporal
    sdavidso    04/05/13 - proj42352: DP In-memory columnar
    lbarton     04/24/13 - bug 16716831: functional index expression as varchar
                           or clob
    lbarton     04/04/13 - bug 11769638: PROJECT COLUMN for ext tables
    dgagne      01/31/13 - add NULL_CONSTRAINT
    sdavidso    01/11/13 - lrg7279605: TSTZ upgrade only for transportable
    sdavidso    01/04/13 - bug15930360 preserve table lock disable
    sdavidso    11/28/12 - bug15930351 - backout bug 14622355
    lbarton     10/04/12 - bug 10350062: ILM compression and storage tiering
    sdavidso    09/21/12 - bug14622355: external table data load for locked
                           tables
    lbarton     09/20/12 - bug 14490476: partitioned xmltype table
    mjangir     09/20/12 - bug 14363143: unused virtual col in tts import
    lbarton     08/29/12 - bug 14506804: typo in HasVirtualColumns
    sdavidso    08/20/12 - bug14472123: preserve 'disable table lock'
    lbarton     06/13/12 - bug 13872190: CONVERT TIMESTAMP WITH TIME ZONE DATA
    sdavidso    03/05/12 - bug 13714302: remove sort of indexes
    lbarton     11/01/11 - 36954_dpump_tabcluster_zonemap
    lbarton     02/09/12 - project 37414: ILM support
    lbarton     12/29/11 - bug 13458665: PARTITION_NAME for composite
                           partitioned table
    rapayne     12/25/11 - proj 37634: Partial Index support.
    ebatbout    10/14/11 - 12781157: Add Alter table statement after Create
                           table if table has an unpacked opaque column.
    gclaborn    10/05/11 - Dont flag ANYDATA/VARRAY columns as possible TSTZ 
                           cols
    mjangir     09/22/11 - bug 13001379: call patchtablemetadata when
                           INTCOL#!=SEGCOL#
    rapayne     08/01/11 - Project 36780: Identity Column support.
    sdavidso    08/08/11 - FORCE_UNIQUE transform support
    spetride    06/25/11 - add REFCOUNT column fro XDB$RRESCONFIG(2)
    sdavidso    06/09/11 - force reproducible order in check_type calls
                           (else, intermitent diff in lrg61a3/cf4imp2 - 
                           maybe others)
    sdavidso    05/19/11 - bug 12545084 export acloid/userid for HET
    rapayne     04/20/11 - proj 30924: support disabling of archive logging
                           for tables.
    lbarton     04/25/11 - bug 10186633: virtual column
    sdavidso    04/22/11 - Make transportable test work for hash partitioned
                           tables
    sdavidso    03/30/11 - support TRANSPORTABLE xml element
    sdavidso    10/21/10 - lrg4901374: nested tables of hash partitioned tables
                           cannot have defaults
    mjangir     07/08/10 - bug 9786142: call patchtablemetadata for blob column
    lbarton     04/27/10 - bug 9650606: more dsc details
    mjangir     09/17/09 - bug 6644244: emit storage for IOT with mapping table
    sdavidso    01/15/10 - bug 8929002: bad column name for mView
    lbarton     11/13/08 - TSTZ support
    lbarton     11/02/09 - deferred segment creation for partitions
    ebatbout    11/11/09 - Bug 8888187: Add space after UNLIMITED keyword.
    tbhukya     08/27/09 - Bug 8787512: Add space after MAPPING TABLE clause
    sdavidso    07/29/09 - bug 7712504: TTS and tables with hierarchy
    dgagne      07/29/09 - add patchdictionary calls
    lbarton     06/17/09 - lrg 3543159: XMLType virtual columns
    lbarton     06/15/09 - remove hybrid columnar noise words
    sdavidso    04/23/09 - bug 7597578: support NT partition properties
    lbarton     11/25/08 - archive level compression
    sdavidso    04/10/09 - bug 7567327: fix import of xmltype col from 10.x
    lbarton     10/07/08 - bug 5661474: network exp/imp of (sub)partitions
    lbarton     02/18/09 - bug 8252494: more deferred segment creation
    rapayne     12/06/09 - handle different BLOCKSIZE paths for CM.
    lbarton     01/21/09 - bug 7831566: SEGMENT CREATION IMMEDIATE
    lbarton     10/23/08 - bug 7503865: GLOBAL keyword in
                           nested_table_col_properties
    lbarton     08/28/08 - bug 7334782: more xmltype virt cols
    lbarton     06/23/08 - bug 6523175: xmltype virtual columns
    lbarton     03/18/08 - deferred segment creation
    dgagne      11/14/07 - add network name transform
    lbarton     11/02/07 - bug 6060058: flashback archived tables
    lbarton     02/01/07 - IMPORT_CONVENTIONAL
    rapayne     04/01/07 - bug 5910237: ensure additional space after
                           RETURN AS VALUE/LOCATOR clause.
    lbarton     09/18/06 - bug 5212908: PARALLEL_HINT
    lbarton     07/17/06 - bug 5386908: XMLTYPE_STREAM_FORMAT param 
    dgagne      05/12/06 - remove transportable requirement to departition a 
                           table 
    weizhang    05/30/06 - proj 19400: enable TABLESPACE for GTT
    cchiappa    04/11/06 - ORGANIZATION CUBE tables 
    cmlim       11/29/05 - support dml error logging 
    lbarton     01/20/06 - partition transportable; split off kutabcon.xsl
                            and kuntab.xsl
    rapayne     01/27/06 - lrg 2035104:ROW MOVEMENT tied to FLAGS not TRIGFLAGS
    lbarton     01/20/06 - fix test for ext tbl 
    htseng      12/16/05 - add transform param PARTITIONING 
    lbarton     12/29/05 - REMAP_COLUMN_NAME
    sdavidso    11/02/05 - fix inconsistent stylesheet format 
    htseng      10/19/05 - fix bug 4120481:add MVIEW_LOG param to DoParallel 
    sdavidso    09/20/05 - fix compressed keys in partioned IOT 
    htseng      08/05/05 - bug 3560220: get correct behavior from processor
    lbarton     05/04/05 - bug 4347010: exclude unused columns
    htseng      02/10/05 - bug 3966743: enable row movement
    htseng      01/18/05 - fix bug 4128169 : setup correct filter for 
                           tablespace 
    lbarton     01/04/05 - bug 4017065: SUBSTITUTABLE on object table 
    rpfau       12/01/04 - Fix problem if system generated column name for 
                           object attr. Put out XMLschema info if needed for
                           attributes in object tables.
    rpfau       11/22/04 - Do not put out check_type calls for transportable 
                           classic. 
    rpfau       10/25/04 - More on bug 3599656 - remove just added owner_name 
                           and name from ku_subcoltype_t and do versioning. 
    rpfau       10/15/04 - bug 3599656 - call check_type before creating 
                           tables for transportable import.
    lbarton     08/17/04 - lrg1728547/bug 3047454: ADT attr of unused col 
    lbarton     08/05/04 - Bug 3813945: encryption password
    rpfau       06/22/04 - Pretty up alignment in template match "PLOBMD".
    htseng      07/12/04 - fix default value for substitutable clause 
    htseng      06/24/04 - bug 3678702: long raw column is not last one 
    lbarton     05/14/04 - Add TRANSPORTABLE_CLASSIC 
    htseng      04/27/04 - bug 3566300 - support subtitutable column
    lbarton     05/11/04 - Bug 3617842: SAMPLE and PCTSPACE 
    htseng      04/15/04 - enhance bug3470826 fix 
    rpfau       04/12/04 - Cleanup based on Lee's review. 
    htseng      03/22/04 - bug 3470826: duplicate column 
    rpfau       03/31/04 - Fix temporary table with name specified for 
                           oidindex - bug 3470762. 
    emagrath    02/10/04 - Transportable OID/SETID constraints/indexes
    lbarton     12/02/03 - Bug 3281574: dataobj# for nested IOTs 
    bmccarth    10/30/03 - get REF correct for XMLSchemas 
    lbarton     09/22/03 - Bug 3149477: SUBPARTITION_NAME param 
    lbarton     09/24/03 - lrg 1572904: define PRS_PATCHTABLEMETADATA 
    dgagne      09/08/03 - add convert parse item for PATCHTABLEMETADATA 
    htseng      08/14/03 - fix bug 3080271 add alter table modify clause 
    lbarton     08/14/03 - Bug 3047175: TTS and unused cols 
    lbarton     07/10/03 - Bug 3045654: nested table tablespace if vsn >= 10
    emagrath    06/06/03 - Correct index info for constraints
    emagrath    05/20/03 - Revamp constraint processing
    lbarton     03/20/03 - Bug 2844132: omit oidindex on temp table
    htseng      02/20/03 - fix CON1_LIST to pass correct $Property value
    lbarton     01/30/03 - primary key for nested IOT
    lbarton     12/31/02 - add plobmd to pcolumn_t for transportable
    htseng      11/01/02 - temp disable nested tablespace
    lbarton     10/11/02 - new parse item: SYSTEM_GENERATED
    htseng      10/28/02 - add tablespace for nested table
    lbarton     08/02/02 - transportable export
    lbarton     07/22/02 - Network export
    htseng      07/29/02 - add more parse params
    lbarton     06/03/02 - data layer and network support
    emagrath    05/17/02 - Stabilize constraint generation order
    lbarton     04/01/02 - xdb fix
    emagrath    01/31/02 - Complete support for REF constraints
    dgagne      11/05/01 - remove row movement from partitions
    lbarton     10/25/01 - xdb support
    lbarton     10/05/01 - Support Ordered Collections in Tables
    dgagne      10/15/01 - add heap segment compression support
    dgagne      06/27/01 - add external table clause
    lbarton     06/01/01 - remove oradb-style imports
    lbarton     04/17/01 - do it again and do it right
    lbarton     04/16/01 - bugfix
    lbarton     01/12/01 - add comments
    lbarton     01/10/01 - nested table referential constraints
    lbarton     12/20/00 - NOT NULL for adt/ref col
    lbarton     12/01/00 - XMLType support
    lbarton     11/01/00 - align table constraints
    lbarton     10/24/00 - sort in views, not xsl
    gclaborn    10/30/00 - Add external imports; change name
    lbarton     10/05/00 - more bugfixes
    lbarton     09/21/00 - bugfixes
    lbarton     08/18/00 - logical standby support
    lbarton     07/24/00 - use uriref in import
    lbarton     06/23/00 - Multinested collections
    lbarton     06/12/00 - constraints in CREATE TABLE
    lbarton     06/01/00 - support parsing
    lbarton     05/15/00 - Params for new API
    lbarton     03/29/00 - More partitioning support
    lbarton     03/17/00 - Multinested collections
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Import required scripts -->
 <xsl:import href="kucommon.xsl"/>
 <xsl:import href="kucolumn.xsl"/>
 <xsl:import href="kustorag.xsl"/>
 <xsl:import href="kuprtobj.xsl"/>
 <xsl:import href="kuconstr.xsl"/>
 <xsl:import href="kuobjtbl.xsl"/>
 <xsl:import href="kuiot.xsl"/>
 <xsl:import href="kucot.xsl"/>
 <xsl:import href="kulob.xsl"/>
 <xsl:import href="kuidxwrk.xsl"/>
 <xsl:import href="kuexttbl.xsl"/>
 <xsl:import href="kutabcon.xsl"/>
 <xsl:import href="kuntab.xsl"/>
 <xsl:import href="kuilm.xsl"/>
 <xsl:import href="kuclzm.xsl"/>
 <xsl:import href="kugrant.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="STORAGE">1</xsl:param>
 <xsl:param name="TABLESPACE">1</xsl:param>
 <xsl:param name="NULL_CONSTRAINTS">1</xsl:param>
 <xsl:param name="REF_CONSTRAINTS">1</xsl:param>
 <xsl:param name="CONSTRAINTS_AS_ALTER">0</xsl:param>
 <xsl:param name="SEGMENT_CREATION">1</xsl:param>
 <xsl:param name="FORCE_UNIQUE">0</xsl:param>
 <xsl:param name="LOB_SEGNAME">1</xsl:param>
 <xsl:param name="OID">0</xsl:param>
 <xsl:param name="SIZE_BYTE_KEYWORD">0</xsl:param>
 <xsl:param name="EXPORT">0</xsl:param>
 <xsl:param name="INDEX_BY_NAME">0</xsl:param>
 <xsl:param name="SHARING_CLAUSE" select="''"/>
 <xsl:param name="TRANSPORTABLE">0</xsl:param>
 <!-- Determine whether the current object is be moved TRANSPORTABLEy or not.
      Possible values and their meaning:
        0 - no objects move transportabley (i.e., not a transportable job).
        1 - all objects move transportabley (e.g., transportable tablespace)
        2 - transportable objects are identified by the presence  of TRANSPORTABLE
            element in the xml metadata. (e.g.,full transportable)
            note: VATs can never go transportable.
 -->
 <xsl:variable name="Transportable">
  <xsl:choose>
   <xsl:when test="$TRANSPORTABLE = 0">0</xsl:when>
   <xsl:when test="$TRANSPORTABLE = 1">1</xsl:when>
   <xsl:when test='$TRANSPORTABLE = 2 and 
              not(/ROWSET/ROW/TABLE_T/VIEW_AS_TABLE) and 
              .//TRANSPORTABLE="1"'>1</xsl:when>
   <xsl:otherwise>0</xsl:otherwise>
  </xsl:choose>
 </xsl:variable>
 <xsl:param name="TRANSPORTABLE_CLASSIC">0</xsl:param>
 <xsl:param name="PCTSPACE">100</xsl:param>
 <xsl:param name="OMIT_AQ_CLAUSE">0</xsl:param>
 <xsl:param name="UNIQUE_NAME" select="''"/>
 <!-- for SHARD 'MOVE CHUNK' shard_drop_tmep is
   0 - don't drop temp tables
   1 - drop temp tables if alter-exchange is successful
   2 - drop temp tables unconditionally-->
 <xsl:param name="SHARD_DROP_TEMP" select="2"/>
 <!-- params for Logical Standby -->
 <xsl:param name="INSERT">0</xsl:param>
 <xsl:param name="DBLINK">0</xsl:param>
 <!-- params for load/unload and network -->
 <xsl:param name="OPERATION_TYPE">CREATE</xsl:param>
 <xsl:param name="EXT_TABLE_NAME" select="''"/>
 <xsl:param name="EXT_TABLE_SCHEMA" select="''"/>
 <xsl:param name="EXT_TABLE_CLAUSE" select="''"/>
 <xsl:param name="SCN">0</xsl:param>
 <xsl:param name="DATAOBJ_NUM" select="''"/>
 <xsl:param name="NETWORK_LINK" select="''"/>
 <xsl:param name="NETWORK_SCHEMA" select="''"/>
 <xsl:param name="NETWORK_NAME" select="''"/>
 <!-- QUERY is the old param. Now we also pass
 (a) QUERY_WHERE -  WHERE clause minus the WHERE keyword
 (b) QUERY_ORDER_BY - ORDER BY clause
 -->
 <xsl:param name="QUERY" select="''"/>
 <xsl:param name="QUERY_WHERE" select="''"/>
 <xsl:param name="QUERY_ORDER_BY" select="''"/>
 <xsl:param name="DROP">0</xsl:param>
 <xsl:param name="SAMPLE" select="''"/>
 <xsl:param name="ENCRYPTION_PASSWORD" select="''"/>
 <xsl:param name="PARTITIONING">1</xsl:param>
 <xsl:param name="DML_ERROR_LOGGING_CLAUSE" select="''"/>
 <xsl:param name="USE_DML_APPEND_HINT">1</xsl:param>
 <xsl:param name="XMLTYPE_STREAM_FORMAT" select="''"/>
 <xsl:param name="PARALLEL_HINT" select="''"/>
 <xsl:param name="CONVERT_TSTZ_COLS">0</xsl:param>
 <xsl:param name="FORCE_VIRTUAL_COLUMNS">0</xsl:param>
 <xsl:param name="WILL_MAKE_TBS_RW">0</xsl:param>
 <!-- params for parse -->
 <xsl:param name="PRS_DDL">0</xsl:param>
 <xsl:param name="PRS_DELIM">\{]`</xsl:param>
 <xsl:param name="PRS_VERB">0</xsl:param>
 <xsl:param name="PRS_OBJECT_TYPE">0</xsl:param>
 <xsl:param name="PRS_SCHEMA">0</xsl:param>
 <xsl:param name="PRS_TABLESPACE">0</xsl:param>
 <xsl:param name="PRS_GRANTEE">0</xsl:param>
 <xsl:param name="PRS_GRANTOR">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_SCHEMA">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_NAME">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_TYPE">0</xsl:param>
 <xsl:param name="PRS_SYSTEM_GENERATED">0</xsl:param>
 <xsl:param name="PRS_BIND_PATTERN">0</xsl:param>
 <xsl:param name="PRS_ALT_CONNECT_TYPE">0</xsl:param>
 <xsl:param name="PRS_LONG_POSITION">0</xsl:param>
 <xsl:param name="PRS_HAS_TSTZ_COLS">0</xsl:param>
 <xsl:param name="PRS_HAS_VIRTUAL_COLUMNS">0</xsl:param>
 <xsl:param name="PRS_NO_TABLE_LOCK">0</xsl:param>
 <xsl:param name="PRS_READ_ONLY_TABLE">0</xsl:param>
 <!-- Params for column name remapping -->
 <xsl:param name="REMAP_COLUMN_NAMEO1" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN1" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO2" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN2" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO3" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN3" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO4" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN4" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO5" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN5" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO6" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN6" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO7" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN7" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO8" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN8" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO9" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN9" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEO10" select="''"/>
 <xsl:param name="REMAP_COLUMN_NAMEN10" select="''"/>
 <!-- Templates -->
 <xsl:template match="IDENTITY_COLUMN_T">
  <!-- *******************************************************************
Template: IDENTITY_COLUMN_T - top-level template for tables with
     identity columns.
Description: it returns an alter table stmt which resets the
     highwater mark for the identity column. This is fetch after
     the table_data has been loaded.
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ALTER</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
   <xsl:with-param name="SchemaNode" select="./BASE_OBJ/OWNER_NAME"/>
   <xsl:with-param name="NameNode" select="./BASE_OBJ/NAME"/>
  </xsl:call-template>
  <xsl:text>ALTER TABLE </xsl:text>
  <xsl:apply-templates select="BASE_OBJ"/>
  <xsl:text>MODIFY (</xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="./IDENTITY_COL/NAME"/>
  </xsl:call-template>
  <xsl:call-template name="DoIdentityColumn">
   <xsl:with-param name="ColumnNode" select="./IDENTITY_COL"/>
   <xsl:with-param name="LimitValue">1</xsl:with-param>
  </xsl:call-template>
  <xsl:text>)</xsl:text>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
   <!-- Terminate the SQL statement -->
  </xsl:if>
 </xsl:template>
 <xsl:template match="TABLE_T">
  <!--Naming... Normally, the object (table) name is simply the
schema_obj/name. 
However, for sharding 'chunk move', we import a [sub]partition(s) as table(s). 
These are subsequently be exchanged into an existing table. The temorary table 
is then dropped. 
In stylesheets, we take care to create sufficiently unique names for the 
temporary table, and any associated objects (constraints, indexes). The 
'UNIQUE_NAME' transform parameter both indicates we are creating temporary 
objects, and gives a unique string for the import datapump job. We may import 
multiple [sub]partitions in a job, so additonal uniqueness is required. 
Including the bas table name can help in debug.-->
  <xsl:variable name="FullName">
   <xsl:choose>
    <xsl:when test="string-length($UNIQUE_NAME) > 0">
     <xsl:variable name="FName">
      <xsl:text>KU$_</xsl:text>
      <xsl:value-of select="$UNIQUE_NAME"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="OBJ_NUM"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="TABPART/PHYPART_NUM"/>
      <!-- phypart_num is not unique for subpartitions - use subpart obj# -->
      <xsl:value-of select="SUBPART/OBJ_NUM"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="SCHEMA_OBJ/NAME"/>
     </xsl:variable>
     <xsl:value-of select="substring($FName,1,128)"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="SCHEMA_OBJ/NAME"/>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <!-- *******************************************************************
Template: TABLE_T - top-level template for tables.
  Depending on OPERATION_TYPE this template calls
   CreateDBTable (in this module) for CREATE
   LoadTableFromNetwork (in kuexttbl.xsl) for NETWORK
   CreExtTable (in kuexttbl.xsl) for EXPORT or IMPORT
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="$DISABLE_ARCHIVE_LOGGING = '1' and
                               $RESTORE_ARCHIVE_LOGGING = '0'">
    <xsl:call-template name="DisableArchiveLogging">
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$RESTORE_ARCHIVE_LOGGING = '1'">
    <xsl:call-template name="RestoreArchiveLogging">
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='MODIFY_VIRTUAL_COLUMNS'">
    <xsl:call-template name="ModifyVirtualColumns"/>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='CREATE'">
    <xsl:call-template name="CreateDBTable">
     <xsl:with-param name="FullName" select="$FullName"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='NETWORK'">
    <xsl:call-template name="LoadTableFromNetwork">
     <xsl:with-param name="DBlinkName" select="$NETWORK_LINK"/>
     <xsl:with-param name="RemoteSchema" select="$NETWORK_SCHEMA"/>
     <xsl:with-param name="RemoteName" select="$NETWORK_NAME"/>
     <xsl:with-param name="PartitionName" select="$PARTITION_NAME"/>
     <xsl:with-param name="SubpartitionName" select="$SUBPARTITION_NAME"/>
     <xsl:with-param name="DataobjNum" select="$DATAOBJ_NUM"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='IMPORT' or
                   $OPERATION_TYPE='IMPORT_CONVENTIONAL'">
    <xsl:call-template name="CreateExtTable"/>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='EXPORT'">
    <xsl:call-template name="CreateExtTable">
     <xsl:with-param name="DBlinkName" select="$NETWORK_LINK"/>
     <xsl:with-param name="RemoteSchema" select="$NETWORK_SCHEMA"/>
     <xsl:with-param name="RemoteName" select="$NETWORK_NAME"/>
     <xsl:with-param name="PartitionName" select="$PARTITION_NAME"/>
     <xsl:with-param name="SubpartitionName" select="$SUBPARTITION_NAME"/>
     <xsl:with-param name="DataobjNum" select="$DATAOBJ_NUM"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='CHUNK_EXCH'">
    <xsl:call-template name="CHUNK_PARTITION_EXCH">
     <xsl:with-param name="FullName" select="$FullName"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='CHUNK_CONSTRAINT'">
    <xsl:call-template name="CHUNK_PARTITION_CONSTRAINT">
     <xsl:with-param name="FullName" select="$FullName"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="$OPERATION_TYPE='CHUNK_DROP'">
    <xsl:call-template name="CHUNK_PARTITION_DROP">
     <xsl:with-param name="FullName" select="$FullName"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text>***ERROR: UNEXPECTED OPERATION_TYPE: </xsl:text>
    <xsl:value-of select="$OPERATION_TYPE"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="DisableArchiveLogging">
  <!-- *******************************************************************
Template: DisableArchiveLogging:
 Description: If disable archive logging was requested then this transform
     will only generate an ALTER TABLE to disable the logging attributes.
     A subsequent transform will be made later to generate the appropriate
     alter table to restore the logging attributes to their original state.
 Current node: TABLE_T
 Parameters:
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ALTER</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</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>
  <!-- Generate ALTER table stmt to disable logging for the table if 
        appropriate.
        Note: Altering table properties by default will propagate through all
              of the partitions attributes.
 -->
  <!-- Alter base table properties if needed -->
  <xsl:variable name="LogFlag">
   <xsl:choose>
    <!-- if there are partitions then we are always going to alter the table
          NOLOGGING. This is because its possible to have partitions which
         are LOGGING while the table level properties are NOLOGGING. 
         Note: when the table is altered the partitions will inherit the table 
                    level properties.
-->
    <xsl:when test="PARTOBJ/DEFLOGGING">1</xsl:when>
    <xsl:otherwise>
     <xsl:choose>
      <xsl:when test=" ((FLAGS mod 64) &lt; 32)">1</xsl:when>
      <xsl:otherwise>0</xsl:otherwise>
     </xsl:choose>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:if test="$LogFlag = '1'">
   <xsl:text>ALTER TABLE </xsl:text>
   <xsl:apply-templates select="SCHEMA_OBJ"/>
   <xsl:text> NOLOGGING</xsl:text>
  </xsl:if>
  <!-- although partitions inherit the base table properties we still need to
         process the logging properties for each nested table if present.
  -->
  <xsl:for-each select="NT/NTS/NTS_ITEM">
   <!-- note: we need to call DoParse for each ALTER stmt otherwise Data Pump
                  gets 'confused'!
-->
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ALTER</xsl:with-param>
    <xsl:with-param name="ObjectType">TABLE</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:variable name="NTFlags" select="(HNT | IONT)/FLAGS"/>
   <xsl:if test="(($NTFlags mod 64) &lt; 32)">
    <xsl:text>ALTER TABLE </xsl:text>
    <xsl:apply-templates select="SCHEMA_OBJ"/>
    <xsl:text> NOLOGGING</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="RestoreArchiveLogging">
  <!-- *******************************************************************
Template: RestoreArchiveLogging:
 Description: If disable archive logging was requested then a transform
     was made to generate an ALTER TABLE to disable the logging attributes.
     Now we need to generate an additional ALTER to restore the logging
     attributes to their original state.
 Current node: TABLE_T
 Parameters:
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ALTER</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</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>
  <!-- Generate Alter stmt to restore logging for the table if appropriate.-->
  <xsl:variable name="LogFlag">
   <xsl:choose>
    <xsl:when test="PART_OBJ/PARTOBJ/DEFLOGGING">
     <xsl:choose>
      <xsl:when test="PART_OBJ/PARTOBJ/DEFLOGGING='2'">0</xsl:when>
      <xsl:otherwise>1</xsl:otherwise>
     </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
     <xsl:choose>
      <xsl:when test=" ((FLAGS mod 64) &lt; 32)">1</xsl:when>
      <xsl:otherwise>0</xsl:otherwise>
     </xsl:choose>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="TableSchemaNode" select="SCHEMA_OBJ"/>
  <xsl:if test="$LogFlag='1'">
   <xsl:text>ALTER TABLE </xsl:text>
   <xsl:apply-templates select="SCHEMA_OBJ"/>
   <xsl:text>LOGGING</xsl:text>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>;</xsl:text>
   </xsl:if>
   <xsl:text>&#xa;  </xsl:text>
  </xsl:if>
  <!-- Now we need to restore the logging property for each partition -->
  <xsl:for-each select="PART_OBJ/PART_LIST/PART_LIST_ITEM[(FLAGS mod 8) >=4]">
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ALTER</xsl:with-param>
    <xsl:with-param name="ObjectType">TABLE</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:text>ALTER TABLE </xsl:text>
   <xsl:apply-templates select="$TableSchemaNode"/>
   <xsl:text> MODIFY PARTITION </xsl:text>
   <xsl:value-of select="./SCHEMA_OBJ/SUBNAME"/>
   <xsl:text> NOLOGGING</xsl:text>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>;</xsl:text>
   </xsl:if>
   <xsl:text>&#xa;  </xsl:text>
  </xsl:for-each>
  <!-- Additionally we need to process the logging properties for each nested
       table if present.  
  -->
  <xsl:for-each select="NT/NTS/NTS_ITEM">
   <xsl:variable name="NTFlags" select="(HNT | IONT)/FLAGS"/>
   <xsl:if test="(($NTFlags mod 64) &lt; 32)">
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">ALTER</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</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:text>ALTER TABLE </xsl:text>
    <xsl:apply-templates select="SCHEMA_OBJ"/>
    <xsl:text> LOGGING</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="CreateDBTable">
  <xsl:param name="FullName" select="'KU$_UniqueName'"/>
  <!-- *******************************************************************
Template: CreateDBTable
******************************************************************** -->
  <xsl:if test="$Transportable=1 and $TRANSPORTABLE_CLASSIC=0 and
                PROPERTY mod 4 > 0">
   <!-- This ddl statement needs a bind variable of the xml clob.  This is
        defined as a bind_pattern of 2.  So set bind_pattern=2 -->
   <xsl:if test="$PRS_BIND_PATTERN=1">
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>ABIND_PATTERN</xsl:text>
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>B2</xsl:text>
   </xsl:if>
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">DELETE_INSERT</xsl:with-param>
    <xsl:with-param name="ObjectType">TABLE</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:text>BEGIN </xsl:text>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:text>DELETE FROM sys.expimp_tts_ct$ WHERE </xsl:text>
   <xsl:call-template name="EscapeString">
    <xsl:with-param name="OrigStr" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="Leading">owner = '</xsl:with-param>
    <xsl:with-param name="Trailing">'</xsl:with-param>
   </xsl:call-template>
   <xsl:call-template name="EscapeString">
    <xsl:with-param name="OrigStr" select="$FullName"/>
    <xsl:with-param name="Leading"> AND tablename = '</xsl:with-param>
    <xsl:with-param name="Trailing">'; </xsl:with-param>
   </xsl:call-template>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:text>INSERT INTO sys.expimp_tts_ct$ values(</xsl:text>
   <xsl:call-template name="EscapeString">
    <xsl:with-param name="OrigStr" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="Leading">'</xsl:with-param>
    <xsl:with-param name="Trailing">',</xsl:with-param>
   </xsl:call-template>
   <xsl:call-template name="EscapeString">
    <xsl:with-param name="OrigStr" select="$FullName"/>
    <xsl:with-param name="Leading">'</xsl:with-param>
    <xsl:with-param name="Trailing">',:1,SYSDATE); </xsl:with-param>
   </xsl:call-template>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:text>COMMIT; </xsl:text>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:text>END;</xsl:text>
   <!-- Terminate the SQL statement -->
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>
/
</xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- Ref partitioned tables in which the parent table is owned by a different
        schema than the child require granted access before the child table can
        be create. Therefore, TABLE_T docs can now have a OBJGRANT_T node
        to allow the grant to be created/executed before the child table is created.
        To ensure the grants get issued with the correct grantor a hard connect
        as the grantor of the grant is required
-->
  <xsl:if test="$EXPORT=1 and OBJGRANT_LIST">
   <xsl:for-each select="OBJGRANT_LIST/OBJGRANT_LIST_ITEM">
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>AALT_CONNECT_TYPE</xsl:text>
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>BHARD</xsl:text>
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>AGRANTOR</xsl:text>
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:text>B</xsl:text>
    <xsl:value-of select="./GRANTOR"/>
    <xsl:call-template name="doObjGrant">
     <xsl:with-param name="objGrant" select="."/>
    </xsl:call-template>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;</xsl:text>
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
  <!--
    If we have remapped the table name, we may need to generate a unique name
    for nested tables. The FORCE_UNIQUE transform parameter triggers this.
-->
  <xsl:if test="$FORCE_UNIQUE=1">
   <xsl:for-each select="NT/NTS/NTS_ITEM">
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:value-of select='"F"'/>
    <xsl:value-of select="SCHEMA_OBJ/NAME"/>
    <xsl:value-of select="$PRS_DELIM"/>
    <xsl:value-of select='"GKU$"'/>
    <xsl:value-of select="NTAB_NUM"/>
    <xsl:value-of select='"NT"'/>
    <xsl:value-of select="INTCOL_NUM"/>
   </xsl:for-each>
  </xsl:if>
  <!-- Add check_type calls for object types used directly by the table.
      Do this first, so the parse parameters defined right after this are
      create table parse items, not check_type parse items.
   -->
  <xsl:call-template name="CheckTypes"/>
  <!-- If transportable and property has types then need to drop info from
       sys.expimp_tts_ct$ and then reload it for this table -->
  <!--
    Generate parse items for CREATE TABLE
    If the table has xmlschema columns, then the table needs to be created
    as if connected as the table owner.  Create a bind variable
    ALT_CONNECT_TYPE=HARD
   -->
  <xsl:if test="$PRS_ALT_CONNECT_TYPE=1 and XMLSCHEMACOLS='Y'">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AALT_CONNECT_TYPE</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>BHARD</xsl:text>
  </xsl:if>
  <!-- Check for 'disable table lock' (disabled if 0x2 or 0x4 are set)
    If table lock is disabled, and we are asked for the NO_TABLE_LOCK parse
    item, return 'Y'  -->
  <xsl:if test="$PRS_NO_TABLE_LOCK=1 and ((FLAGS mod 8) > 1)">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>ANO_TABLE_LOCK</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>BY</xsl:text>
  </xsl:if>
  <xsl:if test="$PRS_READ_ONLY_TABLE=1 and ((TRIGFLAG mod 4194304) >= 2097152)">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AREAD_ONLY_TABLE</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>BY</xsl:text>
  </xsl:if>
  <xsl:if test="$PRS_TABLESPACE=1">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>ATABLESPACE</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>B</xsl:text>
   <xsl:choose>
    <xsl:when test="(PART_OBJ)">
     <xsl:value-of select="PART_OBJ/PARTOBJ/DEFTS_NAME"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="TS_NAME"/>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
  <xsl:variable name="NumTstzCols" select='count(//COL_LIST_ITEM[TYPE_NUM="179" or TYPE_NUM="181" or TYPE_NUM="186" or TYPE_NUM="123" or TYPE_NUM="188"])'/>
  <!--This provides import time information on the existence of TSTZ columns 
  in a table.  TSTZ scalar columns have a datatype of 179, 181, 186, or 188.
  VARRAY (type 123) columns or anydata columns (type 58,
  opaque type other than 1) may contain TSTZ data - this cannot be 
  determined from available metadata and are assumed that they may
  contain TSTZ data.   -->
  <!--For 12.1 Beta1, we remove ANYDATA and VARRAY cols from the TSTZ
       suspect list as we will be failing *all* suspected TSTZ tables
       since we dont have the list right. We can take ANYDATA off the
       list because doc. says that no conversions are ever done on
       ANYDATA cols during TTS operations... its up to the app.
       and user that created them. Data is totally opaque to Oracle -
       the TSTZ timezone conversion routines can't handle ANYDATA cols at all.
       We take VARRAYs off the list because it just fails too many tables.
       We will release note that any tables known to have TSTZ data
       embedded within a VARRAY column should be deleted after the
        transportable import and move via a conventional
        table mode export / import operation.
 or TYPE_NUM="123"
 or (TYPE_NUM="58" and OPQMD/TYPE!=1)])'/>
     -->
  <xsl:if test="$PRS_HAS_TSTZ_COLS=1">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AHAS_TSTZ_COLS</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>B</xsl:text>
   <xsl:value-of select="$NumTstzCols"/>
  </xsl:if>
  <xsl:if test="$PRS_HAS_VIRTUAL_COLUMNS=1">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AHAS_VIRTUAL_COLUMNS</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>B</xsl:text>
   <xsl:variable name="HasVirtCols">
    <xsl:call-template name="HasVirtualColumns"/>
   </xsl:variable>
   <xsl:if test="string-length($HasVirtCols)=0">N</xsl:if>
   <xsl:if test="string-length($HasVirtCols)!=0">Y</xsl:if>
  </xsl:if>
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">CREATE</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</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>
  <!-- 
      CREATE [ GLOBAL TEMPORARY ] TABLE foo.bar
  -->
  <xsl:text>CREATE </xsl:text>
  <xsl:if test="(PROPERTY mod 8388608)>=4194304">
   <xsl:text>GLOBAL TEMPORARY </xsl:text>
  </xsl:if>
  <xsl:text>TABLE </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
   <xsl:with-param name="Object" select="$FullName"/>
   <xsl:with-param name="TrailingBlank" select='"1"'/>
  </xsl:call-template>
  <!-- Generated Application Root sharing clause if appropriate -->
  <xsl:call-template name="DoSharing">
   <xsl:with-param name="Flags" select="SCHEMA_OBJ/FLAGS"/>
  </xsl:call-template>
  <!-- get useful variables -->
  <xsl:variable name="Nested">0</xsl:variable>
  <xsl:variable name="IsObjectTable">
   <xsl:call-template name="fnIsObjectTable">
    <xsl:with-param name="Property" select="PROPERTY"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="IsIOT">
   <xsl:call-template name="fnIsIOT">
    <xsl:with-param name="Property" select="PROPERTY"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasPkOID">
   <xsl:call-template name="fnHasPkOID">
    <xsl:with-param name="Property" select="PROPERTY"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasNotNull">
   <xsl:call-template name="fnHasNotNull">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasNonZeroPkRef">
   <xsl:call-template name="fnHasNonZeroPkRef">
    <xsl:with-param name="ListParent" select="current()"/>
    <xsl:with-param name="InColList">1</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="IsRefPartitioned">
   <xsl:call-template name="fnIsRefPartitioned">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasRefPartitionedChildren">
   <xsl:call-template name="fnHasRefPartitionedChildren">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="IsDimensionTarget">
   <xsl:call-template name="fnIsDimensionTarget">
    <xsl:with-param name="Property2" select="PROPERTY2"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasCON0Constraints">
   <xsl:call-template name="fnHasCON0Constraints">
    <xsl:with-param name="ListParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasCON1Constraints">
   <xsl:call-template name="fnHasCON1Constraints">
    <xsl:with-param name="ListParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasCON2Constraints">
   <xsl:call-template name="fnHasCON2Constraints">
    <xsl:with-param name="ListParent" select="current()"/>
   </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="HasTableProperties">
   <xsl:call-template name="fnHasTableProperties">
    <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
    <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
    <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
    <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
    <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
    <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
    <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
    <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
    <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:variable>
  <!--
       Dispatch to processing template for relational/object/XMLtype table
-->
  <xsl:choose>
   <xsl:when test="$IsObjectTable=0">
    <!-- relational table -->
    <xsl:call-template name="CreRelTable">
     <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
     <xsl:with-param name="IsIOT" select="$IsIOT"/>
     <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
     <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
     <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
     <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
     <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
     <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
     <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
     <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
     <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="HasTableProperties" select="$HasTableProperties"/>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE'
              or 
      COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/NAME='XMLTYPE'">
    <!-- xmltype table -->
    <xsl:call-template name="CreXMLTypeTable">
     <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
     <xsl:with-param name="IsIOT" select="$IsIOT"/>
     <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
     <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
     <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
     <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
     <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
     <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
     <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
     <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
     <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="HasTableProperties" select="$HasTableProperties"/>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <!-- object table -->
    <xsl:call-template name="CreObjTable">
     <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
     <xsl:with-param name="IsIOT" select="$IsIOT"/>
     <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
     <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
     <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
     <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
     <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
     <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
     <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
     <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
     <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
     <xsl:with-param name="Nested" select="$Nested"/>
     <xsl:with-param name="HasTableProperties" select="$HasTableProperties"/>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="$SQLTERMINATOR=1">
   <!-- Terminate the SQL statement -->
   <xsl:text>;</xsl:text>
  </xsl:if>
  <!-- For Index organized table -->
  <xsl:if test="(PROPERTY mod 128)>=64 and $DWCS_CVT_IOTS = 0">
   <xsl:for-each select="CON1_LIST/CON1_LIST_ITEM">
    <!-- Generate ALTER INDEX when following conditions are true :
         Primary key constraint type
         and IOT top index
         and Index is created by constraint
         and Constraint, index names are different -->
    <xsl:if test="(CONTYPE = 2 and
                   (IND and
                    (IND/TYPE_NUM mod 8) >= 4 and
                    (IND/PROPERTY mod 8192) >= 4096) and
                   string(NAME) != string(IND/SCHEMA_OBJ/NAME))">
     <xsl:call-template name="DoIotCntIdx">
      <xsl:with-param name="Oname" select="IND/SCHEMA_OBJ/OWNER_NAME"/>
      <xsl:with-param name="Cname" select="NAME"/>
      <xsl:with-param name="Iname" select="IND/SCHEMA_OBJ/NAME"/>
     </xsl:call-template>
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
  <!-- For v12 import or pre-v12 transportable, 
        may need to deal with hierarchy enable for xmltype tables -->
  <xsl:if test=" (($EXPORT=1 and  $VERSION>=1200000000) or 
        ($TRANSPORTABLE=1 and $TRANSPORTABLE_CLASSIC=0)) and
  (COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE'
   or COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/NAME='XMLTYPE') and
  COL_LIST/COL_LIST_ITEM[NAME='ACLOID'] and
  COL_LIST/COL_LIST_ITEM[NAME='OWNERID']">
   <!-- xmltype table -->
   <xsl:call-template name="GenHierarchy">
    <xsl:with-param name="Enable" select='"ENABLE_HIERARCHY"'/>
   </xsl:call-template>
   <xsl:call-template name="GenHierarchy">
    <xsl:with-param name="Enable" select='"DISABLE_HIERARCHY"'/>
   </xsl:call-template>
  </xsl:if>
  <!-- For v12 or later import, the XDB$RESCONFIG table requires a
       REFCOUNT column.  This is a special requirement of the XDB repository.
  -->
  <xsl:if test=" ($EXPORT=1 and  $VERSION>=1200000000) and
  (COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE'
   or COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/NAME='XMLTYPE') and
    SCHEMA_OBJ[OWNER_NAME='XDB']  and COL_LIST/COL_LIST_ITEM[NAME='REFCOUNT'] and
    (SCHEMA_OBJ[NAME = 'XDB$RESCONFIG'] or SCHEMA_OBJ[NAME = 'XDB$RESCONFIG2'])">
   <xsl:call-template name="GenRefCount">
   </xsl:call-template>
  </xsl:if>
  <!-- bug 26847241 do alter for clustered with collation clause -->
  <xsl:if test="$VERSION>=1202000000 and 
                SCHEMA_OBJ and SCHEMA_OBJ/DFLCOLLNAME and
                CLST">
   <xsl:call-template name="GenCollForCluster"/>
  </xsl:if>
  <!-- ALTER TABLE statement[as] for temporal validity-->
  <xsl:if test="$VERSION>=1200000000">
   <!-- bug 18449519: modified FBA_PERIOD to a list of periods;
         at most one of these will be present 
Note - this adds columns with storage - must preceed dictionary patching-->
   <xsl:apply-templates select="FBA_PERIOD">
    <xsl:with-param name="SchemaObj" select="SCHEMA_OBJ"/>
    <xsl:with-param name="ColList" select="COL_LIST"/>
   </xsl:apply-templates>
   <xsl:apply-templates select="FBA_PERIODS">
    <xsl:with-param name="SchemaObj" select="SCHEMA_OBJ"/>
    <xsl:with-param name="ColList" select="COL_LIST"/>
   </xsl:apply-templates>
  </xsl:if>
  <!-- For datapump transportable, patch distionary-->
  <xsl:variable name="HasNonZeroPkRef1">
   <xsl:call-template name="fnHasNonZeroPkRef">
    <xsl:with-param name="ListParent" select="current()"/>
    <xsl:with-param name="InColList">0</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:variable>
  <!-- patch dictionary for datapump transportable - column number must be patched before constraints-->
  <xsl:if test="$Transportable=1 and $TRANSPORTABLE_CLASSIC=0">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:if test="PROPERTY mod 4 > 0">
    <!-- If transportable and property has types then need to drop info from
        sys.expimp_tts_ct$ that was loaded above -->
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">DELETE</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
     <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="NameNode" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>DELETE FROM sys.expimp_tts_ct$ WHERE </xsl:text>
    <xsl:call-template name="EscapeString">
     <xsl:with-param name="OrigStr" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="Leading">owner = '</xsl:with-param>
     <xsl:with-param name="Trailing">'</xsl:with-param>
    </xsl:call-template>
    <xsl:call-template name="EscapeString">
     <xsl:with-param name="OrigStr" select="$FullName"/>
     <xsl:with-param name="Leading"> AND tablename = '</xsl:with-param>
     <xsl:with-param name="Trailing">'</xsl:with-param>
    </xsl:call-template>
    <xsl:if test="$SQLTERMINATOR=1">
     <!-- Terminate the SQL statement -->
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:if>
   <!-- If any of these bits are set, then call patchtablemetadata -->
   <xsl:if test="(COL_LIST/COL_LIST_ITEM[TYPE_NUM=112] or           
 COL_LIST/COL_LIST_ITEM[TYPE_NUM=113] or
 COL_LIST/COL_LIST_ITEM[(PROPERTY mod 65536)>=32768] or
 ((PROPERTY mod 2)=0 and 
  COL_LIST/COL_LIST_ITEM[SEGCOL_NUM!=INTCOL_NUM]) or
  (COL_LIST/COL_LIST_ITEM[TYPE_NUM=8] and
   COL_LIST/COL_LIST_ITEM[last()]/TYPE_NUM!=8) or
  (COL_LIST/COL_LIST_ITEM[TYPE_NUM=24] and
   COL_LIST/COL_LIST_ITEM[last()]/TYPE_NUM!=24))">
    <!-- Patchtablemetadata needs to pass in some bind varables. Set
         bind_pattern=1 -->
    <xsl:if test="$PRS_BIND_PATTERN=1">
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>ABIND_PATTERN</xsl:text>
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>B1</xsl:text>
    </xsl:if>
    <!-- Calls to dbms_plugtsp need to be connected as the schema running
          the import job.  So set ALT_CONNECT_TYPE = NONE -->
    <xsl:if test="$PRS_ALT_CONNECT_TYPE=1">
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>AALT_CONNECT_TYPE</xsl:text>
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>BNONE</xsl:text>
    </xsl:if>
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">DBMS_PLUGTSP.PATCHTABLEMETADATA</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
     <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="NameNode" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>BEGIN </xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;  </xsl:text>
    </xsl:if>
    <xsl:text>SYS.DBMS_PLUGTSP.PATCHTABLEMETADATA('</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="SCHEMA_OBJ/OWNER_NAME"/>
    </xsl:call-template>
    <xsl:text>','</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>',:1,:2,:3);</xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;</xsl:text>
    </xsl:if>
    <xsl:text>END;</xsl:text>
    <!-- Terminate the SQL statement -->
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>
/
</xsl:text>
    </xsl:if>
   </xsl:if>
   <!-- Call PATCHDICTIONARY for the PDML if property is not null. -->
   <xsl:if test="PROPERTY">
    <!-- Calls to dbms_plugtsp need to be connected as the schema running
          the import job.  So set ALT_CONNECT_TYPE = NONE -->
    <xsl:if test="$PRS_ALT_CONNECT_TYPE=1">
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>AALT_CONNECT_TYPE</xsl:text>
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>BNONE</xsl:text>
    </xsl:if>
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">DBMS_PLUGTSP.PATCHDICTIONARY</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
     <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="NameNode" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>BEGIN </xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;  </xsl:text>
    </xsl:if>
    <xsl:text>SYS.DBMS_PLUGTSP.PATCHDICTIONARY('</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="SCHEMA_OBJ/OWNER_NAME"/>
    </xsl:call-template>
    <xsl:text>','</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>',</xsl:text>
    <xsl:value-of select="PROPERTY"/>
    <xsl:text>,'unused','unused','unused','unused',2);</xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;</xsl:text>
    </xsl:if>
    <xsl:text>END;</xsl:text>
    <!-- Terminate the SQL statement -->
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>
/
</xsl:text>
    </xsl:if>
   </xsl:if>
   <xsl:for-each select="CON1_LIST/CON1_LIST_ITEM[OID_OR_SETID!=0]">
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;  </xsl:text>
    </xsl:if>
    <xsl:call-template name="DoHiddenConstraint">
     <xsl:with-param name="SchemaObjParent" select="../.."/>
     <xsl:with-param name="ConstraintNode" select="current()"/>
    </xsl:call-template>
   </xsl:for-each>
  </xsl:if>
  <!--
       For transportable, generate ALTER TABLE SET UNUSED for unused cols
      (prop bit 0x8000) that are not ADT attributes (prop bit 0x01)
       Bug 14363143: skip ALTER TABLE SET UNUSED for unused  virtual cols
       (prop bit 0x8008). see more comment in kucolumn.xsl

       Bug 14696962: Generate ALTER TABLE SET UNUSED for unused attribute
       cols (prop bit 0x8001) as Unused UDT attributes added as columns
       in table DDL in tts mode.
-->
  <xsl:if test="$Transportable=1">
   <xsl:for-each select="COL_LIST/COL_LIST_ITEM[(PROPERTY mod 65536)>=32768
                                           and (PROPERTY mod 16)&lt;8]">
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">ALTER</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</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:text>
  ALTER TABLE </xsl:text>
    <xsl:apply-templates select="../../SCHEMA_OBJ">
     <xsl:with-param name="DoP2T" select="'1'"/>
    </xsl:apply-templates>
    <xsl:text>SET UNUSED ("</xsl:text>
    <xsl:value-of select="NAME"/>
    <xsl:text>")</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
     <!-- Terminate the SQL statement -->
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
  <!--constraints added by contraints_as_alter-->
  <xsl:call-template name="GenTableConstraints">
   <xsl:with-param name="SchemaObjParent" select="current()"/>
   <xsl:with-param name="ListParent" select="current()"/>
   <xsl:with-param name="InColList">0</xsl:with-param>
   <xsl:with-param name="CommaNeeded">0</xsl:with-param>
   <xsl:with-param name="Property" select="PROPERTY"/>
   <xsl:with-param name="Nested" select="$Nested"/>
   <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
   <xsl:with-param name="IsIOT" select="$IsIOT"/>
   <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
   <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
   <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef1"/>
   <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
   <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
   <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
   <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
   <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
   <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
   <xsl:with-param name="FullName" select="$FullName"/>
  </xsl:call-template>
  <!-- patch dictionary for datapump transportable - Hakan factor (must be patched after adding constriants)-->
  <xsl:if test="$Transportable=1 and $TRANSPORTABLE_CLASSIC=0">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <!-- Call PATCHDICTIONARY for the HAKAN factor if SPARE1 is not null. -->
   <xsl:if test="SPARE1">
    <!-- Calls to dbms_plugtsp need to be connected as the schema running
          the import job.  So set ALT_CONNECT_TYPE = NONE -->
    <xsl:if test="$PRS_ALT_CONNECT_TYPE=1">
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>AALT_CONNECT_TYPE</xsl:text>
     <xsl:value-of select="$PRS_DELIM"/>
     <xsl:text>BNONE</xsl:text>
    </xsl:if>
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">DBMS_PLUGTSP.PATCHDICTIONARY</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
     <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="NameNode" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>BEGIN </xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;  </xsl:text>
    </xsl:if>
    <xsl:text>SYS.DBMS_PLUGTSP.PATCHDICTIONARY('</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="SCHEMA_OBJ/OWNER_NAME"/>
    </xsl:call-template>
    <xsl:text>','</xsl:text>
    <xsl:call-template name="EnQuote">
     <xsl:with-param name="String" select="$FullName"/>
    </xsl:call-template>
    <xsl:text>',</xsl:text>
    <xsl:value-of select="SPARE1"/>
    <xsl:text>,'unused','unused','unused','unused',3);</xsl:text>
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;</xsl:text>
    </xsl:if>
    <xsl:text>END;</xsl:text>
    <!-- Terminate the SQL statement -->
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>
/
</xsl:text>
    </xsl:if>
   </xsl:if>
  </xsl:if>
  <!-- ALTER TABLE modify statement to get object default value -->
  <xsl:call-template name="GenObjDefValue">
   <xsl:with-param name="SchemaObjParent" select="current()"/>
   <xsl:with-param name="Property" select="PROPERTY"/>
  </xsl:call-template>
  <!-- ALTER TABLE modify statement for unpacked ANYDATA columns that are 
       not UNUSED -->
  <!-- bug 26636020: skip unused columns (PROPERTY bit 0x8000 32768) -->
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM[(TYPE_NUM = 58)
                    and (32768 > (PROPERTY mod 65536))
                    and (TYPEMD/SCHEMA_OBJ/OWNER_NAME='SYS')
                    and (TYPEMD/SCHEMA_OBJ/NAME='ANYDATA')
                    and ((TYPEMD/FLAGS mod 262144)>=131072)]">
   <xsl:for-each select="TYPEMD/ANYDATA_LIST/ANYDATA_LIST_ITEM">
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">ALTER</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</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:text>&#xa;</xsl:text>
    <xsl:text> ALTER TABLE </xsl:text>
    <xsl:apply-templates select="../../../../../SCHEMA_OBJ"/>
    <xsl:text> MODIFY OPAQUE TYPE </xsl:text>
    <xsl:call-template name="QuoteObject">
     <xsl:with-param name="Object" select="../../../NAME"/>
    </xsl:call-template>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>  STORE (</xsl:text>
    <xsl:value-of select="."/>
    <xsl:text>)</xsl:text>
    <xsl:text> UNPACKED</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:for-each>
  </xsl:for-each>
  <!-- ALTER TABLE [MODIFY PARTITION] statement for ILM policies  -->
  <xsl:if test="$VERSION>=1200000000 and $UNIQUE_NAME = ''">
   <xsl:call-template name="DoILMPolicies"/>
   <xsl:for-each select="PART_OBJ/PART_LIST/PART_LIST_ITEM">
    <xsl:call-template name="DoILMPolicies">
     <xsl:with-param name="SubType">PARTITION</xsl:with-param>
    </xsl:call-template>
   </xsl:for-each>
   <xsl:for-each select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
    <xsl:call-template name="DoILMPolicies">
     <xsl:with-param name="SubType">PARTITION</xsl:with-param>
    </xsl:call-template>
   </xsl:for-each>
   <xsl:for-each select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
    <xsl:for-each select="SUBPARTS/SUBPARTS_ITEM">
     <xsl:call-template name="DoILMPolicies">
      <xsl:with-param name="SubType">SUBPARTITION</xsl:with-param>
     </xsl:call-template>
    </xsl:for-each>
   </xsl:for-each>
  </xsl:if>
  <!--Name mapping for move chunk with domain indexes-->
  <xsl:if test="string-length($UNIQUE_NAME)>0">
   <xsl:call-template name="DoNameMap">
    <xsl:with-param name="FullName" select="$FullName"/>
   </xsl:call-template>
  </xsl:if>
  <!-- Generate INSERT SELECT for logical standby -->
  <xsl:if test="$INSERT=1">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:call-template name="LoadTableFromNetwork">
    <xsl:with-param name="DBlinkName" select="$DBLINK"/>
   </xsl:call-template>
  </xsl:if>
  <!-- For transportable, ENABLE Hidden (OID or SETID) constraints -->
  <!-- (implicit part of CREATE TABLE for modes other than transportable) -->
  <!-- Not needed for original exp/imp (which has its own way of doing this)-->
  <!-- Add any nested table constraints needed as ALTER TABLE statements -->
  <xsl:if test="(PROPERTY mod 8)>=4">
   <!-- has nested-TABLE columns -->
   <xsl:call-template name="GenNestedTableConstraints">
    <xsl:with-param name="FullName" select="$FullName"/>
    <xsl:with-param name="ListParent" select="NT/NTS"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="CreRelTable">
  <xsl:param name="IsObjectTable">0</xsl:param>
  <xsl:param name="IsIOT">0</xsl:param>
  <xsl:param name="HasPkOID">0</xsl:param>
  <xsl:param name="HasNotNull">0</xsl:param>
  <xsl:param name="HasNonZeroPkRef">0</xsl:param>
  <xsl:param name="IsRefPartitioned">0</xsl:param>
  <xsl:param name="HasRefPartitionedChildren">0</xsl:param>
  <xsl:param name="IsDimensionTarget">0</xsl:param>
  <xsl:param name="HasCON0Constraints">0</xsl:param>
  <xsl:param name="HasCON1Constraints">0</xsl:param>
  <xsl:param name="HasCON2Constraints">0</xsl:param>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="HasTableProperties">0</xsl:param>
  <xsl:param name="NumTstzCols">0</xsl:param>
  <!-- *******************************************************************
Template: CreRelTable - syntax for relational tables
Parameters:
  IsObjectTable - 1 = table is object table
  IsIOT - 1 = table is IOT
  HasPkOID - 1 = table has primary key-based OID$ column
  HasNotNull - 1 = table has NOT NULL constraint on non-hidden column
  HasNonZeroPkRef - 1 = constraint list has a PkRef constraint with
                         REFTYP not=0
  IsRefPartitioned - 1 = table is reference partitioned.
  HasRefPartitionedChildren - 1 = table has reference partitioned children
  IsDimensionTarget - 1 = table appears as a dimension in one or more
                          clustering clauses
  HasCON0Constraints - 1 = table has CON0 constraints
  HasCON1Constraints - 1 = table has CON1 constraints
  HasCON2Constraints - 1 = table has CON2 constraints
  Nested - 1 = generating DDL for a nested table
  HasTableProperties - 1 = there are table properties
******************************************************************** -->
  <xsl:variable name="ViewAsTable">
   <xsl:choose>
    <xsl:when test="VIEW_AS_TABLE">1</xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa; </xsl:text>
  </xsl:if>
  <xsl:if test="$HasTableProperties=1">
   <!-- Begin any CREATE TABLE properties with open paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">1</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
   <!-- column list -->
   <xsl:apply-templates select="COL_LIST">
    <xsl:with-param name="InColDef">1</xsl:with-param>
    <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
    <xsl:with-param name="Partobj" select="PART_OBJ"/>
   </xsl:apply-templates>
   <!-- Add any table constraints needed in CREATE TABLE properties -->
   <xsl:call-template name="GenTableConstraints">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
    <xsl:with-param name="ListParent" select="current()"/>
    <xsl:with-param name="InColList">1</xsl:with-param>
    <xsl:with-param name="CommaNeeded">1</xsl:with-param>
    <xsl:with-param name="Property" select="PROPERTY"/>
    <xsl:with-param name="Nested" select="$Nested"/>
    <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
    <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
    <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
    <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
    <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
    <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
    <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
    <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
    <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
   </xsl:call-template>
   <!-- End any CREATE TABLE properties with close paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">0</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:if>
  <!-- Add collation clause when version is 12.2 or higher and dflcollname -->
  <!-- bug 26847241 if not clustered -->
  <xsl:if test="$VERSION>=1202000000 and 
                SCHEMA_OBJ and SCHEMA_OBJ/DFLCOLLNAME and
                not (CLST)">
   <xsl:call-template name="DoCollation">
    <xsl:with-param name="IsDefault">1</xsl:with-param>
    <xsl:with-param name="Name" select="SCHEMA_OBJ/DFLCOLLNAME"/>
   </xsl:call-template>
  </xsl:if>
  <!-- if temp table emit ON COMMIT... -->
  <xsl:call-template name="GenOnCommitAction"/>
  <xsl:choose>
   <xsl:when test="(PROPERTY mod 262144)>=131072 and $OMIT_AQ_CLAUSE=0">
    <!-- AQ -->
    <xsl:text>USAGE QUEUE </xsl:text>
   </xsl:when>
   <xsl:when test="(PROPERTY3 mod 64) >= 32">
    <!-- AW -->
    <xsl:text>USAGE AW </xsl:text>
   </xsl:when>
   <xsl:otherwise/>
  </xsl:choose>
  <xsl:if test="(PROPERTY mod 128)>=64 and $DWCS_CVT_IOTS = 0">
   <!-- IOT -->
   <xsl:call-template name="OrgIndex"/>
  </xsl:if>
  <!-- physical properties -->
  <xsl:call-template name="PhysicalProperties">
   <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
   <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
  </xsl:call-template>
  <!-- processing default partial indexing attribute: Indexing defaults to ON.
       So, rather than perturbing numberous logfiles we are only going to 
       generate this clause if the default has been changed.  
  -->
  <xsl:if test="$PARTITIONING = 1 and 
                string-length($PARTITION_NAME)=0 and
                string-length($SUBPARTITION_NAME)=0 and
                PART_OBJ and 
                      (PART_OBJ/PARTOBJ/FLAGS mod 16384) >= 8192">
   <xsl:text>INDEXING OFF </xsl:text>
  </xsl:if>
  <!-- table properties
       special treatment needed if departitioning a composite partition
  -->
  <xsl:choose>
   <xsl:when test="string-length($SUBPARTITION_NAME)!=0"/>
   <xsl:when test="string-length($PARTITION_NAME)!=0">
    <xsl:if test="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
     <xsl:call-template name="doCvtTableProperties">
      <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     </xsl:call-template>
    </xsl:if>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="TableProperties">
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
     <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="CreObjTable">
  <xsl:param name="IsObjectTable">0</xsl:param>
  <xsl:param name="IsIOT">0</xsl:param>
  <xsl:param name="HasPkOID">0</xsl:param>
  <xsl:param name="HasNotNull">0</xsl:param>
  <xsl:param name="HasNonZeroPkRef">0</xsl:param>
  <xsl:param name="IsRefPartitioned">0</xsl:param>
  <xsl:param name="HasRefPartitionedChildren">0</xsl:param>
  <xsl:param name="IsDimensionTarget">0</xsl:param>
  <xsl:param name="HasCON0Constraints">0</xsl:param>
  <xsl:param name="HasCON1Constraints">0</xsl:param>
  <xsl:param name="HasCON2Constraints">0</xsl:param>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="HasTableProperties">0</xsl:param>
  <xsl:param name="NumTstzCols">0</xsl:param>
  <!-- *******************************************************************
Template: CreObjTable - syntax for object tables and XMLTYPE tables
Parameters:
  IsObjectTable - 1 = table is object table
  IsIOT - 1 = table is IOT
  HasPkOID - 1 = table has primary key-based OID$ column
  HasNotNull - 1 = table has NOT NULL constraint on non-hidden column
  HasNonZeroPkRef - 1 = constraint list has a PkRef constraint with
                         REFTYP not=0
  IsRefPartitioned - 1 = table is reference partitioned.
  HasRefPartitionedChildren - 1 = table has reference partitioned children
  IsDimensionTarget - 1 = table appears as a dimension in one or more
                          clustering clauses
  HasCON0Constraints - 1 = table has CON0 constraints
  HasCON1Constraints - 1 = table has CON1 constraints
  HasCON2Constraints - 1 = table has CON2 constraints
  Nested - 1 = generating DDL for a nested table
  HasTableProperties - 1 = there are table properties
******************************************************************** -->
  <!-- OF TYPE foo.bar + object_table_substitution -->
  <xsl:call-template name="ObjTable"/>
  <xsl:if test="$HasTableProperties=1">
   <!-- Begin any CREATE TABLE properties with open paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">1</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
   <!-- Add any table constraints needed in CREATE TABLE properties -->
   <!--  (No initial comma for object tables) -->
   <xsl:call-template name="GenTableConstraints">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
    <xsl:with-param name="ListParent" select="current()"/>
    <xsl:with-param name="InColList">1</xsl:with-param>
    <xsl:with-param name="CommaNeeded">0</xsl:with-param>
    <xsl:with-param name="Property" select="PROPERTY"/>
    <xsl:with-param name="Nested" select="$Nested"/>
    <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
    <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
    <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
    <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
    <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
    <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
    <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
    <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
    <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
   </xsl:call-template>
   <!-- End any CREATE TABLE properties with close paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">0</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:if>
  <!-- if temp table emit ON COMMIT... -->
  <xsl:call-template name="GenOnCommitAction"/>
  <xsl:if test="(PROPERTY mod 8192)>=4096">
   <!-- has primary-key OID -->
   <xsl:text>OBJECT IDENTIFIER IS PRIMARY KEY </xsl:text>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;   </xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- OIDINDEX  -->
  <xsl:call-template name="DoOidindex"/>
  <xsl:if test="(PROPERTY mod 262144)>=131072">
   <!-- AQ -->
   <xsl:text>USAGE QUEUE </xsl:text>
  </xsl:if>
  <xsl:if test="(PROPERTY mod 128)>=64 and $DWCS_CVT_IOTS = 0">
   <!-- IOT -->
   <xsl:call-template name="OrgIndex"/>
  </xsl:if>
  <!-- physical properties -->
  <xsl:call-template name="PhysicalProperties">
   <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
  </xsl:call-template>
  <!-- table properties -->
  <xsl:choose>
   <!-- Don't generate partition clauses with departition -->
   <xsl:when test="string-length($PARTITION_NAME)!=0 or 
                   string-length($SUBPARTITION_NAME)!=0"/>
   <xsl:otherwise>
    <xsl:call-template name="TableProperties">
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="CreXMLTypeTable">
  <xsl:param name="IsObjectTable">0</xsl:param>
  <xsl:param name="IsIOT">0</xsl:param>
  <xsl:param name="HasPkOID">0</xsl:param>
  <xsl:param name="HasNotNull">0</xsl:param>
  <xsl:param name="HasNonZeroPkRef">0</xsl:param>
  <xsl:param name="IsRefPartitioned">0</xsl:param>
  <xsl:param name="HasRefPartitionedChildren">0</xsl:param>
  <xsl:param name="IsDimensionTarget">0</xsl:param>
  <xsl:param name="HasCON0Constraints">0</xsl:param>
  <xsl:param name="HasCON1Constraints">0</xsl:param>
  <xsl:param name="HasCON2Constraints">0</xsl:param>
  <xsl:param name="Nested">0</xsl:param>
  <xsl:param name="HasTableProperties">0</xsl:param>
  <xsl:param name="NumTstzCols">0</xsl:param>
  <!-- *******************************************************************
Template: CreXMLTypeTable - syntax for XMLType tables
Parameters:
  IsObjectTable - 1 = table is object table
  IsIOT - 1 = table is IOT
  HasPkOID - 1 = table has primary key-based OID$ column
  HasNotNull - 1 = table has NOT NULL constraint on non-hidden column
  HasNonZeroPkRef - 1 = constraint list has a PkRef constraint with
                         REFTYP not=0
  IsRefPartitioned - 1 = table is reference partitioned.
  HasRefPartitionedChildren - 1 = table has reference partitioned children
  IsDimensionTarget - 1 = table appears as a dimension in one or more
                          clustering clauses
  HasCON0Constraints - 1 = table has CON0 constraints
  HasCON1Constraints - 1 = table has CON1 constraints
  HasCON2Constraints - 1 = table has CON2 constraints
  Nested - 1 = generating DDL for a nested table
  HasTableProperties - 1 = there are table properties
******************************************************************** -->
  <xsl:text>OF XMLTYPE </xsl:text>
  <!-- Begin any CREATE TABLE properties with open paren -->
  <xsl:if test="$OID=1">
   <!-- Emit the undocumented OID clause using the table's OID -->
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
   </xsl:if>
   <xsl:text> OID &apos;</xsl:text>
   <xsl:value-of select="SCHEMA_OBJ/OID"/>
   <xsl:text>&apos; </xsl:text>
  </xsl:if>
  <xsl:if test="$HasTableProperties=1">
   <!-- Begin any CREATE TABLE properties with open paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">1</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
   <!-- Add any table constraints needed in CREATE TABLE properties -->
   <!--  (No initial comma for object tables) -->
   <xsl:call-template name="GenTableConstraints">
    <xsl:with-param name="SchemaObjParent" select="current()"/>
    <xsl:with-param name="ListParent" select="current()"/>
    <xsl:with-param name="InColList">1</xsl:with-param>
    <xsl:with-param name="CommaNeeded">0</xsl:with-param>
    <xsl:with-param name="Property" select="PROPERTY"/>
    <xsl:with-param name="Nested" select="$Nested"/>
    <xsl:with-param name="IsObjectTable" select="$IsObjectTable"/>
    <xsl:with-param name="IsIOT" select="$IsIOT"/>
    <xsl:with-param name="HasPkOID" select="$HasPkOID"/>
    <xsl:with-param name="HasNotNull" select="$HasNotNull"/>
    <xsl:with-param name="HasNonZeroPkRef" select="$HasNonZeroPkRef"/>
    <xsl:with-param name="IsRefPartitioned" select="$IsRefPartitioned"/>
    <xsl:with-param name="HasRefPartitionedChildren" select="$HasRefPartitionedChildren"/>
    <xsl:with-param name="IsDimensionTarget" select="$IsDimensionTarget"/>
    <xsl:with-param name="HasCON0Constraints" select="$HasCON0Constraints"/>
    <xsl:with-param name="HasCON1Constraints" select="$HasCON1Constraints"/>
    <xsl:with-param name="HasCON2Constraints" select="$HasCON2Constraints"/>
   </xsl:call-template>
   <!-- End any CREATE TABLE properties with close paren -->
   <xsl:call-template name="TablePropertyParen">
    <xsl:with-param name="OpenParen">0</xsl:with-param>
    <xsl:with-param name="Nested" select="$Nested"/>
   </xsl:call-template>
  </xsl:if>
  <!-- Note: deferred segment creation is now supported for xmltype tables
             in 12.2.
   -->
  <xsl:if test="local-name(.)='TABLE_T' and
                      $SEGMENT_ATTRIBUTES=1 and
                      $VERSION >= 1202000000">
   <xsl:call-template name="DeferredSegmentCreationClause">
    <xsl:with-param name="TableNode" select="."/>
    <xsl:with-param name="isXMLType">1</xsl:with-param>
   </xsl:call-template>
  </xsl:if>
  <!-- XMLType storage -->
  <xsl:variable name="TabBlocksize" select="BLOCKSIZE"/>
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/LOBMD">
   <xsl:choose>
    <xsl:when test="../PLOBMD">
     <xsl:apply-templates select="../PLOBMD">
      <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
      <xsl:with-param name="XMLType_storage">1</xsl:with-param>
     </xsl:apply-templates>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="DoLOBStoreAs">
      <xsl:with-param name="ColList" select="../.."/>
      <xsl:with-param name="Intcolnum" select="../INTCOL_NUM"/>
      <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
      <xsl:with-param name="XMLType_storage">1</xsl:with-param>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
  </xsl:for-each>
  <!-- XMLSchema_spec, if any -->
  <xsl:if test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/OPQMD/SCHEMA_ELMT">
   <xsl:choose>
    <xsl:when test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/LOBMD"/>
    <xsl:when test="$PRETTY=1">
     <xsl:text>&#xa; </xsl:text>
    </xsl:when>
   </xsl:choose>
   <xsl:call-template name="DoSchemaElmt">
    <xsl:with-param name="SchemaElmt" select="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/OPQMD/SCHEMA_ELMT"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:if test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/OPQMD">
   <xsl:call-template name="DoAllowDisallow">
    <xsl:with-param name="OpqmdElmt" select="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/OPQMD"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:call-template name="XMLTypeVirtualColumns"/>
  <!-- OID index seems to be invalid -->
  <xsl:choose>
   <xsl:when test="true()"/>
   <xsl:otherwise>
    <xsl:call-template name="DoOidindex"/>
   </xsl:otherwise>
  </xsl:choose>
  <!-- physical properties -->
  <xsl:call-template name="PhysicalProperties">
   <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
  </xsl:call-template>
  <!-- table properties -->
  <xsl:choose>
   <!-- Don't generate partition clauses with departition -->
   <xsl:when test="string-length($PARTITION_NAME)!=0 or
                   string-length($SUBPARTITION_NAME)!=0"/>
   <xsl:otherwise>
    <xsl:call-template name="TableProperties">
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     <xsl:with-param name="XMLType_table">1</xsl:with-param>
     <xsl:with-param name="NumTstzCols" select="$NumTstzCols"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="OrgIndex">
  <!-- *******************************************************************
Template: OrgIndex - ORGANIZATION INDEX ( COMPRESS n | NOCOMPRESS )
******************************************************************** -->
  <!-- Deferred segment creation is now supported for xmltype tables,
       object type tables, iot and piot.
   -->
  <xsl:if test="local-name(.)='TABLE_T' and
                      $SEGMENT_ATTRIBUTES=1 and
                      $VERSION >= 1202000000">
   <xsl:call-template name="DeferredSegmentCreationClause">
    <xsl:with-param name="TableNode" select="."/>
   </xsl:call-template>
  </xsl:if>
  <xsl:text>ORGANIZATION INDEX </xsl:text>
  <!-- 
      If departitionin don't generate COMPRESS
      value will come from partition
-->
  <xsl:if test="string-length($PARTITION_NAME)=0 and
                string-length($SUBPARTITION_NAME)=0">
   <xsl:choose>
    <xsl:when test="NUMKEYCOLS>0">
     <xsl:text>COMPRESS </xsl:text>
     <xsl:value-of select="NUMKEYCOLS"/>
     <xsl:text> </xsl:text>
    </xsl:when>
    <xsl:otherwise>NOCOMPRESS </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template name="PhysicalProperties">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: PhysicalProperties:
 Current node: TABLE_T or MVIEW_TAB
 Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:choose>
   <!-- Don't generate external table clauses here when partition_options 
        is departition.
        Generate inmemory clause for non-partitioned external table 
        irrespecttive partition_options, departition or merge -->
   <xsl:when test="PROPERTY>=2147483648 and ((string-length($PARTITION_NAME)=0 and
                                              string-length($SUBPARTITION_NAME)=0) or
                                             not(PART_OBJ))">
    <!-- External table -->
    <xsl:call-template name="GenExtTableClauses"/>
   </xsl:when>
   <xsl:when test="(PROPERTY2 mod 2)=1">
    <!-- CUBE table -->
    <xsl:call-template name="GenCubeTableClauses">
     <xsl:with-param name="CubeTab" select="CUBETAB"/>
     <xsl:with-param name="PrettyCR">1</xsl:with-param>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="(PROPERTY mod 2048)>=1024">
    <!-- clustered table -->
    <xsl:apply-templates select="TABCLUSTER"/>
    <xsl:if test="$Transportable=1">
     <xsl:text> STORAGE (TABNO </xsl:text>
     <xsl:value-of select="TAB_NUM"/>
     <xsl:text>)</xsl:text>
    </xsl:if>
   </xsl:when>
   <xsl:when test="4194304>(PROPERTY mod 8388608)">
    <!-- non-temporary table: generate the physical attributes -->
    <xsl:call-template name="GenTablePhysicalAttrs">
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
     <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="(PROPERTY mod 8388608)>=4194304">
    <!-- global temporary table: generate the tablespace clause -->
    <xsl:if test="$TABLESPACE=1">
     <!-- only handle GTT with explicitly specified tablespace -->
     <xsl:if test="(current()/TS_NAME)!='SYSTEM'">
      <xsl:apply-templates select="current()/TS_NAME"/>
     </xsl:if>
    </xsl:if>
   </xsl:when>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="doCvtTableProperties">
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: doCvtTableProperties:- convert table properties when 
  departitioning a composite partitioned table
Parameters:
  Pctspace: percentage by which space allocation is to be modified
           defaults to 100 (no modification)
******************************************************************** -->
  <xsl:if test="(PART_OBJ) and ($PARTITIONING=1)">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
   </xsl:if>
   <xsl:call-template name="DoCvtPartitionClause">
    <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
    <xsl:with-param name="TableNode" select="."/>
    <xsl:with-param name="Part_objNode" select="PART_OBJ"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="TableProperties">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="XMLType_table">0</xsl:param>
  <xsl:param name="NumTstzCols">0</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: TableProperties:
  column properties
  XMLType_virtual_columns
  clustering
  table partitioning clauses
  CONVERT TIMESTAMP WITH TIME ZONE DATA (undocumented)
  CACHE/NOCACHE
  result cache
  parallel
  rowdependencies
  enable_disable
  row movement
  flashback archive
 Current node: TABLE_T or MVIEW_TAB
 Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
  XMLType_table - 1 = generate properties for xmltype table
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:variable name="ClusterTable" select="(PROPERTY mod 2048)>=1024"/>
  <xsl:variable name="PartClusterTable" select="(PROPERTY mod 2048)>=1024 and (PROPERTY mod 64)>=32"/>
  <xsl:variable name="TempTable" select="(PROPERTY mod 8388608)>=4194304"/>
  <!-- skip if cluster table and not partitioned cluster table-->
  <xsl:if test="(not ($ClusterTable) or $PartClusterTable)">
   <xsl:call-template name="ColumnProperties">
    <xsl:with-param name="Pctspace" select="$Pctspace"/>
    <xsl:with-param name="XMLType_table" select="$XMLType_table"/>
    <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
   </xsl:call-template>
   <xsl:if test="$XMLType_table=0">
    <xsl:call-template name="XMLTypeVirtualColumns"/>
   </xsl:if>
   <!-- Data pump does clustering as a separate step -->
   <xsl:if test="$EXPORT=0">
    <xsl:apply-templates select="CLST"/>
   </xsl:if>
   <!-- PARTITION BY... NOTE: partitions and clusters do not mix -->
   <xsl:if test="(not ($ClusterTable)) and (PART_OBJ) and ($PARTITIONING=1)">
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa; </xsl:text>
    </xsl:if>
    <xsl:choose>
     <xsl:when test="(PROPERTY mod 128)>=64">
      <xsl:call-template name="DoPIOTPartitionClause">
       <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
       <xsl:with-param name="PartCompress" select="NUMKEYCOLS>0"/>
      </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="DoPartitionClause">
       <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:if>
   <!-- emit undocumented syntax if (a) the table has TSTZ columns and
        (b) the worker will later make the tablespace read write
        and fix up the columns -->
   <xsl:if test="$NumTstzCols!=0 and $WILL_MAKE_TBS_RW!=0 and $Transportable=1">
    <xsl:if test="$PRETTY=1">
     <xsl:text>&#xa;</xsl:text>
    </xsl:if>
    <xsl:text>  CONVERT TIMESTAMP WITH TIME ZONE DATA </xsl:text>
   </xsl:if>
   <!-- Row archival -->
   <xsl:if test="$VERSION>=1200000000">
    <xsl:call-template name="DoILMClause"/>
   </xsl:if>
   <xsl:if test="(FLAGS mod 262144) >= 131072">
    <!-- row movement -->
    <xsl:text> ENABLE ROW MOVEMENT </xsl:text>
   </xsl:if>
   <!-- flashback archive (no data pump support yet) -->
   <xsl:if test="$EXPORT=0">
    <xsl:apply-templates select="FBA"/>
   </xsl:if>
  </xsl:if>
  <xsl:if test="$ClusterTable">
   <xsl:if test="$VERSION>=1200000000">
    <xsl:call-template name="DoILMClause"/>
   </xsl:if>
  </xsl:if>
  <!-- DoParallel in kustorag.xsl does
         ROWDEPENDENCIES
         RESULT_CACHE
         CACHE
         MONITORING
         PARALLEL
       Note: this needs to be done for all types of tables except
             cluster tabs (ie, including GLOBAL TEMP tabs)
   -->
  <xsl:if test="not($ClusterTable)">
   <xsl:call-template name="DoParallel">
    <xsl:with-param name="FlagsParent" select="current()"/>
    <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
   </xsl:call-template>
  </xsl:if>
  <!-- Bug 16995929 Special case to output NESTED information for a cluster 
       table having nested table columns: 
       PROPERTY = 1024 - Clustered Table
       PROPERTY = 4    - Has nested-TABLE columns
  -->
  <xsl:if test="$ClusterTable and ((PROPERTY mod 8)>=4)">
   <xsl:apply-templates select="NT">
    <xsl:with-param name="Pctspace" select="$Pctspace"/>
    <xsl:with-param name="ParentProperty" select="PROPERTY"/>
    <xsl:with-param name="DoingTable">1</xsl:with-param>
    <xsl:with-param name="Parttype" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
   </xsl:apply-templates>
  </xsl:if>
  <!--Check for read-only table-->
  <xsl:if test="(TRIGFLAG mod (2097152*2)) >= 2097152 and
                $SOURCE_VERSION>=1102000000">
   <xsl:text> READ ONLY </xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template name="ColumnProperties">
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="XMLType_table">0</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: ColumnProperties:
  object_type_col_properties
  nested_table_col_properties
  varray_col_properties
  LOB_storage_clause
  XMLType_column_properties
 Current node: TABLE_T
 Parameters:
  Pctspace - value of the PCTSPACE param; defaults to 100
  XMLType_table - 1 = generate properties for xmltype table
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:call-template name="ObjectTypeColProperties"/>
  <xsl:if test="(PROPERTY mod 8)>=4">
   <!--has nested-TABLE columns: template "NT" is in kuntab.xsl -->
   <xsl:apply-templates select="NT">
    <xsl:with-param name="Pctspace" select="$Pctspace"/>
    <xsl:with-param name="ParentProperty" select="PROPERTY"/>
    <xsl:with-param name="DoingTable">1</xsl:with-param>
    <xsl:with-param name="Parttype" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
   </xsl:apply-templates>
  </xsl:if>
  <!-- LOB, VARRAY AS LOB -->
  <xsl:call-template name="DoLobColsIf">
   <xsl:with-param name="XMLType_table" select="$XMLType_table"/>
   <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
  </xsl:call-template>
  <xsl:call-template name="XMLSchemaBasedCols"/>
 </xsl:template>
 <xsl:template name="ObjectTypeColProperties">
  <!-- *******************************************************************
Template: ObjectTypeColProperties:
  substitutable
 Current node: TABLE_T
******************************************************************** -->
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM[TYPE_NUM=121]">
   <xsl:choose>
    <!-- bug 4347010: skip all of this if column is unused -->
    <xsl:when test="(PROPERTY mod 65536)>=32768"/>
    <!-- skip SYS_NC_ROWINFO$ -->
    <xsl:when test="NAME='SYS_NC_ROWINFO$'"/>
    <!--  0x800 - SUBSTITUTABLE specified explicitly -->
    <xsl:when test="(TYPEMD/FLAGS mod 4096)>= 2048">
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;  </xsl:text>
     </xsl:if>
     <xsl:text>COLUMN </xsl:text>
     <xsl:value-of select="NAME"/>
     <xsl:text> SUBSTITUTABLE AT ALL LEVELS </xsl:text>
    </xsl:when>
    <!--  0x400 - NOT SUBSTITUTABLE specified explicitly -->
    <xsl:when test="(TYPEMD/FLAGS mod 2048)>=1024">
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;  </xsl:text>
     </xsl:if>
     <xsl:text>COLUMN </xsl:text>
     <xsl:value-of select="NAME"/>
     <xsl:text> NOT SUBSTITUTABLE AT ALL LEVELS </xsl:text>
    </xsl:when>
    <xsl:when test="(TYPEMD/SUBTYPE_LIST/SUBTYPE_LIST_ITEM/FLAGS mod 4) =3">
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;  </xsl:text>
     </xsl:if>
     <xsl:text>COLUMN </xsl:text>
     <xsl:value-of select="NAME"/>
     <xsl:text> IS OF TYPE (ONLY </xsl:text>
     <xsl:apply-templates select="TYPEMD/SUBTYPE_LIST/SUBTYPE_LIST_ITEM/SCHEMA_OBJ"/>
     <xsl:text>) </xsl:text>
    </xsl:when>
   </xsl:choose>
  </xsl:for-each>
 </xsl:template>
 <xsl:template match="PLOBMD">
  <xsl:param name="MetaType">Lob</xsl:param>
  <xsl:param name="TabBlocksize">0</xsl:param>
  <xsl:param name="XMLType_storage">0</xsl:param>
  <!-- *******************************************************************
Template: PLOBMD
Parameters:
  MetaType
     Lob         - lob column metadata in non-partitioned table
     PartLob     - table level defaults
     LobFrag     - actual partition- or subpartition-level lob attributes
     LobComppart - partition-level defaults
  TabBlocksize - Table blocksize value
  XMLType_storage - 1 = emit xmltype storage syntax for xmltype table
                   (i.e., not for column)
******************************************************************** -->
  <xsl:call-template name="DoLOBStoreAs">
   <xsl:with-param name="MetaType" select="$MetaType"/>
   <xsl:with-param name="ColList" select="../.."/>
   <xsl:with-param name="Intcolnum" select="../INTCOL_NUM"/>
   <xsl:with-param name="TabBlocksize" select="$TabBlocksize"/>
   <xsl:with-param name="XMLType_storage" select="$XMLType_storage"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="XMLSchemaBasedCols">
  <!-- *******************************************************************
Template: XMLSchemaBasedCols
******************************************************************** -->
  <!-- XML schema-based columns in relational tables and XML schema-based
      attributes in object tables. But don't put anything out for table
      level for an object table (already done above). Table level for an
      object table is indicated by NAME='SYS_NC_ROWINFO$'.  -->
  <!-- bug 4347010: skip unused columns (PROPERTY bit 0x8000 32768) -->
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM[NAME!='SYS_NC_ROWINFO$' and
                       (32768 > (PROPERTY mod 65536)) and
                       TYPE_NUM=58 and
                       TYPEMD/SCHEMA_OBJ/OWNER_NAME='SYS' and
                       TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE' and
                       OPQMD/SCHEMA_ELMT]">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
   </xsl:if>
   <!-- Add optional "COLUMN" -->
   <xsl:text> XMLTYPE COLUMN </xsl:text>
   <!-- Fix problem if system generated column name for an object
       attribute. Use attribute name instead of system generated name. -->
   <xsl:call-template name="ColNameOrAttr">
    <xsl:with-param name="ColItem" select="current()"/>
   </xsl:call-template>
   <xsl:apply-templates select="OPQMD/SCHEMA_ELMT"/>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="XMLTypeVirtualColumns">
  <!-- *******************************************************************
Template: XMLTypeVirtualColumns
Current node: TABLE_T
******************************************************************** -->
  <!-- XMLType virtual columns
       If this is an XMLTYPE table...  -->
  <xsl:if test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE'">
   <!-- look for columns with the following property bits:
               /* 0x0008 =       8 = virtual column                         */
               /* 0x0020 =      32 = hidden column                          */
           /* 0x00010000 =   65536 = virtual column                         */
        but the following bits must be clear
                /* 0x0100 =     256 = system-generated column                */
                /* 0x0200 =     512 = rowinfo column of typed table/view     */
                /* 0x4000 =   16384 = dropped column                         */
        Note: virtual columns are inserted in reverse order, so we must sort.
   -->
   <xsl:for-each select="COL_LIST/COL_LIST_ITEM[(PROPERTY mod 16 >= 8) and
           (PROPERTY mod 64 >= 32) and
           (PROPERTY mod 131052 >= 65536) and
           (256 > (PROPERTY mod 512)) and
           (512 > (PROPERTY mod 1024)) and
           (16384 > (PROPERTY mod 32768))]">
    <xsl:sort select="INTCOL_NUM" data-type="number" order="descending"/>
    <xsl:if test="position()=1">
     <xsl:text> VIRTUAL COLUMNS (</xsl:text>
    </xsl:if>
    <xsl:text>"</xsl:text>
    <xsl:value-of select="NAME"/>
    <xsl:text>" AS (</xsl:text>
    <!--either DEFAULT_VAL or DEFAULT_VALC will be present but not both-->
    <xsl:value-of select="DEFAULT_VAL"/>
    <xsl:value-of select="DEFAULT_VALC"/>
    <xsl:text>)</xsl:text>
    <xsl:choose>
     <xsl:when test="position()!=last()">
      <xsl:text>,</xsl:text>
      <xsl:if test="$PRETTY=1">
       <xsl:text>&#xa;</xsl:text>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
      <xsl:text>) </xsl:text>
      <xsl:if test="$PRETTY=1 and $SEGMENT_ATTRIBUTES=1">
       <xsl:text>&#xa;  </xsl:text>
      </xsl:if>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:for-each>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenExtTableClauses">
  <xsl:param name="IsExtPartConv" select="false()"/>
  <xsl:param name="partNode" select="''"/>
  <!-- *******************************************************************
Template: GenExtTableClauses - generate clauses for external table   
   Parameters:
       IsExtPartConv - True when partition_options is departition
       partNode      - External partition node
******************************************************************** -->
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;   </xsl:text>
  </xsl:if>
  <xsl:text>ORGANIZATION EXTERNAL </xsl:text>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;    </xsl:text>
  </xsl:if>
  <xsl:text>( TYPE </xsl:text>
  <xsl:value-of select="EXTTAB/TYPE"/>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;     </xsl:text>
  </xsl:if>
  <xsl:if test="EXTTAB/DEFAULT_DIR">
   <xsl:text> DEFAULT DIRECTORY </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="EXTTAB/DEFAULT_DIR"/>
    <xsl:with-param name="TrailingBlank">0</xsl:with-param>
   </xsl:call-template>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;     </xsl:text>
   </xsl:if>
  </xsl:if>
  <xsl:if test="EXTTAB/PARAM_CLOB">
   <xsl:text> ACCESS PARAMETERS</xsl:text>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;     </xsl:text>
   </xsl:if>
   <xsl:text> ( </xsl:text>
   <xsl:value-of select="EXTTAB/PARAM_CLOB"/>
   <xsl:text>    )</xsl:text>
  </xsl:if>
  <xsl:choose>
   <xsl:when test="$IsExtPartConv">
    <xsl:call-template name="GenExtTableLoc">
     <xsl:with-param name="Loc" select="$partNode/EXT_LOCATION/LOCATION"/>
     <xsl:with-param name="IsExtPartConv" select="$IsExtPartConv"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:choose>
     <!-- When partition_options is merge then generate all the partitions
          location files at table level -->
     <xsl:when test="PART_OBJ and $PARTITIONING=0">
      <xsl:choose>
       <!-- Handle location files of partition table -->
       <xsl:when test="PART_OBJ/PART_LIST/PART_LIST_ITEM">
        <xsl:call-template name="GenExtTableLoc">
         <xsl:with-param name="Loc" select="PART_OBJ/PART_LIST/PART_LIST_ITEM"/>
         <xsl:with-param name="FPos" select="true()"/>
         <xsl:with-param name="LPos" select="true()"/>
        </xsl:call-template>
       </xsl:when>
       <!-- Handle location files of composite partition table -->
       <xsl:when test="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
        <xsl:for-each select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
         <xsl:call-template name="GenExtTableLoc">
          <xsl:with-param name="Loc" select="SUBPARTS/SUBPARTS_ITEM"/>
          <xsl:with-param name="FPos" select="position()=1"/>
          <xsl:with-param name="LPos" select="position()=last()"/>
         </xsl:call-template>
        </xsl:for-each>
       </xsl:when>
      </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
      <xsl:call-template name="GenExtTableLoc">
       <xsl:with-param name="Loc" select="EXTTAB/LOCATION"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;   </xsl:text>
  </xsl:if>
  <xsl:text> )</xsl:text>
  <xsl:if test="EXTTAB/REJECT_LIMIT > 0">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;  </xsl:text>
   </xsl:if>
   <xsl:text> REJECT LIMIT </xsl:text>
   <xsl:choose>
    <xsl:when test="EXTTAB/REJECT_LIMIT = 2147483647">
     <xsl:text>UNLIMITED</xsl:text>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="EXTTAB/REJECT_LIMIT"/>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:text> </xsl:text>
  </xsl:if>
  <xsl:variable name="imflgs" select="floor(EXTTAB/PROPERTY div 32)"/>
  <xsl:if test="$VERSION>=1800000000 and ($imflgs &gt; 0 or
             ($INMEMORY_CLAUSE and ($PARTITIONING=0 or not(PART_OBJ))))">
   <xsl:call-template name="DoInMemory">
   <xsl:with-param name="InMemory">1</xsl:with-param>
    <xsl:with-param name="Priority">7</xsl:with-param>
    <xsl:with-param name="Distribute">0</xsl:with-param>
    <xsl:with-param name="Duplicate">0</xsl:with-param>
    <xsl:with-param name="Compression" select="$imflgs"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenObjDefValue">
  <xsl:param name="SchemaObjParent" select="''"/>
  <xsl:param name="Property">0</xsl:param>
  <!-- *******************************************************************
Template: GenObjDefValue - get object table column default value 
Parameters:
  SchemaObjParent - parent of SCHEMA_OBJ name
  Property - Table PROPERTY
******************************************************************** -->
  <xsl:if test="($Property mod 2)=1">
   <!-- object table -->
   <xsl:for-each select="COL_LIST/COL_LIST_ITEM">
    <xsl:if test="DEFLENGTH != 0  
                and (32 > (PROPERTY mod 64))   
                and (1024 > (PROPERTY mod 1024))">
     <xsl:call-template name="DoParse">
      <xsl:with-param name="Verb">ALTER</xsl:with-param>
      <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
      <xsl:with-param name="SchemaNode" select="$SchemaObjParent/SCHEMA_OBJ/OWNER_NAME"/>
      <xsl:with-param name="NameNode" select="$SchemaObjParent/SCHEMA_OBJ/NAME"/>
     </xsl:call-template>
     <xsl:text>&#xa;  </xsl:text>
     <xsl:text>ALTER TABLE </xsl:text>
     <xsl:apply-templates select="$SchemaObjParent/SCHEMA_OBJ"/>
     <xsl:text>MODIFY ( </xsl:text>
     <xsl:value-of select="NAME"/>
     <xsl:text> DEFAULT </xsl:text>
     <xsl:if test="(PROPERTY2 mod 32)>=16 and $VERSION >= 1200000000">ON NULL </xsl:if>
     <!--either DEFAULT_VAL or DEFAULT_VALC will be present but not both-->
     <xsl:value-of select="DEFAULT_VAL"/>
     <xsl:value-of select="DEFAULT_VALC"/>
     <xsl:text>)</xsl:text>
     <xsl:if test="$SQLTERMINATOR=1">
      <xsl:text>;</xsl:text>
      <!-- Terminate the SQL statement -->
     </xsl:if>
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenHierarchy">
  <xsl:param name="Enable" select="''"/>
  <!-- *******************************************************************
Template: GenHierarchy - enable/disable hierarchy for xmltype tables
Hierarchy enabled tables have hidden columns. Data in those columns is
likely invalid on import, but in transportable, the data will be imported.
The solumtion is to enable hierarchy, creating metadata for hidden columns,
the disable hierarchy as the data is not valid (but column metadata remains).
******************************************************************** -->
  <xsl:if test="$PRS_ALT_CONNECT_TYPE=1">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AALT_CONNECT_TYPE</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>BHARD</xsl:text>
  </xsl:if>
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="$Enable"/>
   <xsl:with-param name="ObjectType">TABLE</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:text>BEGIN DBMS_XDBZ.</xsl:text>
  <xsl:value-of select="$Enable"/>
  <xsl:text>('"</xsl:text>
  <xsl:value-of select="SCHEMA_OBJ/OWNER_NAME"/>
  <xsl:text>"','"</xsl:text>
  <xsl:value-of select="SCHEMA_OBJ/NAME"/>
  <xsl:text>"'); END;</xsl:text>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
  <xsl:text>&#xa;</xsl:text>
 </xsl:template>
 <xsl:template name="GenRefCount">
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ADD_REFCOUNT</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</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:text>ALTER TABLE </xsl:text>
  <xsl:text>"</xsl:text>
  <xsl:value-of select="SCHEMA_OBJ/OWNER_NAME"/>
  <xsl:text>"."</xsl:text>
  <xsl:value-of select="SCHEMA_OBJ/NAME"/>
  <!-- For transportable, we cannot specify a default value for 
  the added REFCOUNT column as that would attempt to modify a
  read-only tablespace.-->
  <xsl:choose>
   <xsl:when test="$Transportable=1">
    <xsl:text>" ADD (REFCOUNT NUMBER)</xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text>" ADD (REFCOUNT NUMBER DEFAULT 0)</xsl:text>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
  <xsl:text>&#xa;</xsl:text>
 </xsl:template>
 <xsl:template name="GenCollForCluster">
  <!-- *******************************************************************
Template: GenCollForCluster
Generate something like:
   ALTER TABLE "SCOTT"."TAB1" DEFAULT COLLATION "xyzzy"
If this is a clustered table with a default collation clause
******************************************************************** -->
  <!-- figure out if we have a collation clause -->
  <xsl:variable name="CollationClause">
   <xsl:call-template name="DoCollation">
    <xsl:with-param name="IsDefault">1</xsl:with-param>
    <xsl:with-param name="Name" select="SCHEMA_OBJ/DFLCOLLNAME"/>
   </xsl:call-template>
  </xsl:variable>
  <!-- if we have a collation clause, generate the alter statement -->
  <xsl:if test="string-length($CollationClause)!=0">
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ADD_REFCOUNT</xsl:with-param>
    <xsl:with-param name="ObjectType">TABLE</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:text>&#xa;</xsl:text>
   <xsl:text>ALTER TABLE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="Object" select="SCHEMA_OBJ/NAME"/>
   </xsl:call-template>  
   <xsl:value-of select="$CollationClause"/>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>;</xsl:text>
   </xsl:if>
   <xsl:text>&#xa;</xsl:text>
  </xsl:if>
 </xsl:template>
 <!-- ALTER TABLE [EXCHANGE PARTITION] for partition exportable (sharding)-->
 <xsl:template name="CHUNK_PARTITION_EXCH">
  <xsl:param name="FullName" select="'KU$_UniqueName'"/>
  <!-- *******************************************************************
Template: CHUNK_PARTITION_EXCH
We generate something like:
   alter table scott.tab1
     exchange partition P1 with table scott.tab1_p1 including indexes; 
  temporarily, we drop the temp table here (on an error from exchange,
     the table will remain)
   drop table scott.tab_1_p1 purge; 
Note, we do not use "cascade" as we deal with each table separately. 
******************************************************************** -->
  <!-- alter session "_partition_read_only"=FALSE-->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="'ALTER session _partition_read_only'"/>
   <xsl:with-param name="ObjectType">TABLE</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 session set "_partition_read_only" = FALSE</xsl:text>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
  <!-- ***************************************************** -->
  <!-- alter table <table_name>
         exchange partition <partition_name> with table <temp table>-->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="'EXCHANGE PARTITION'"/>
   <xsl:with-param name="ObjectType">TABLE</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 TABLE </xsl:text>
  <xsl:apply-templates select="SCHEMA_OBJ"/>
  <xsl:choose>
   <xsl:when test="TABPART">
    <!--We are moving a partition-->
    <xsl:text>EXCHANGE PARTITION </xsl:text>
    <xsl:call-template name="QuoteObject">
     <xsl:with-param name="Object" select="TABPART/SCHEMA_OBJ/SUBNAME"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <!--We are moving a subpartition-->
    <xsl:text>EXCHANGE SUBPARTITION </xsl:text>
    <xsl:call-template name="QuoteObject">
     <xsl:with-param name="Object" select="SUBPART/SCHEMA_OBJ/SUBNAME"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:text> WITH TABLE </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
   <xsl:with-param name="Object" select="$FullName"/>
  </xsl:call-template>
  <xsl:text> INCLUDING INDEXES WITHOUT VALIDATION </xsl:text>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
  <!-- ***************************************************** -->
  <!--while debugging, drop the temporary table after (successful) exchange-->
  <xsl:if test="$SHARD_DROP_TEMP=1">
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb" select="'DROP'"/>
    <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
    <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="NameNode" select="$FullName"/>
   </xsl:call-template>
   <xsl:text>DROP TABLE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="Object" select="$FullName"/>
   </xsl:call-template>
   <xsl:text> PURGE </xsl:text>
   <xsl:call-template name="DoTerminator">
    <xsl:with-param name="Text"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="CHUNK_PARTITION_CONSTRAINT">
  <xsl:param name="FullName" select="'KU$_UniqueName'"/>
  <xsl:param name="Table">
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
    <xsl:with-param name="Object" select="$FullName"/>
   </xsl:call-template>
  </xsl:param>
  <!-- *******************************************************************
Template: CHUNK_PARTITION_CONSTRAINT 
We generate something like:
  BEGIN NULL;
   for eack FK constraint, <DROP CONSTRAINT constraint-name>
   END;
The "NULL:" above makes this valid PLSQL, even if tere are no FK constraints.
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="'DROP_FK_CONSTRAINT'"/>
   <xsl:with-param name="ObjectType">TABLE</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:text>BEGIN NULL; </xsl:text>
  <xsl:text>&#xa;  </xsl:text>
  <xsl:choose>
   <xsl:when test="$SHARD_DROP_TEMP=2">
    <!--Now, drop the constraints-->
    <xsl:for-each select="CON2_LIST/CON2_LIST_ITEM">
     <xsl:variable name="FName">
      <xsl:if test="string-length($UNIQUE_NAME) > 0">
       <xsl:text>KU$_</xsl:text>
       <xsl:value-of select="$UNIQUE_NAME"/>
       <xsl:text>_</xsl:text>
       <xsl:value-of select="CON_NUM"/>
       <xsl:text>_</xsl:text>
       <xsl:value-of select="ancestor::TABLE_T/TABPART/PHYPART_NUM"/>
       <xsl:value-of select="ancestor::TABLE_T/SUBPART/PHYPART_NUM"/>
       <xsl:text>_</xsl:text>
      </xsl:if>
      <xsl:value-of select="NAME"/>
     </xsl:variable>
     <xsl:variable name="ConstrFullName">
      <xsl:value-of select="substring($FName,1,128)"/>
     </xsl:variable>
     <xsl:text> execute immediate 'ALTER TABLE </xsl:text>
     <xsl:value-of select="$Table"/>
     <xsl:text> DROP CONSTRAINT </xsl:text>
     <xsl:value-of select="$ConstrFullName"/>
     <xsl:text>';&#xa;  </xsl:text>
    </xsl:for-each>
   </xsl:when>
  </xsl:choose>
  <xsl:text>END; </xsl:text>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="CHUNK_PARTITION_DROP">
  <xsl:param name="FullName" select="'KU$_UniqueName'"/>
  <!--*******************************************************************
Template: CHUNK_PARTITION_DROP
Here, we unconditionally drop the temporary table for chunk move, generating something like:
   drop table scott.tab_1_p1 purge; 
Note: temporarily, we drop the temp table above (on an error from exchange, the table will remain)
      so here, we do nothing.
******************************************************************** -->
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;  </xsl:text>
  </xsl:if>
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="'DROP'"/>
   <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
   <xsl:with-param name="SchemaNode" select="SCHEMA_OBJ/OWNER_NAME"/>
   <xsl:with-param name="NameNode" select="$FullName"/>
  </xsl:call-template>
  <xsl:choose>
   <xsl:when test="$SHARD_DROP_TEMP=2">
    <!--Now, drop the temporary table-->
    <xsl:text>DROP TABLE </xsl:text>
    <xsl:call-template name="QuoteObject">
     <xsl:with-param name="Schema" select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="Object" select="$FullName"/>
    </xsl:call-template>
    <xsl:text> PURGE </xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text> begin null; end</xsl:text>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template name="DoNameMap">
  <xsl:param name="FullName" select="'KU$_UniqueName'"/>
  <!-- ***************************************************** -->
  <!--insert into name mapping table-->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb" select="'NameMapInsert'"/>
   <xsl:with-param name="ObjectType">TABLE</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>BEGIN </xsl:text>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa;  </xsl:text>
  </xsl:if>
  <xsl:text>INSERT INTO sys.ku$_shard_domidx_namemap (owner, source_name, target_name,type_name,part_name) values (</xsl:text>
  <xsl:call-template name="EnQuote">
   <xsl:with-param name="Enclose" select="'1'"/>
   <xsl:with-param name="String" select="SCHEMA_OBJ/OWNER_NAME"/>
  </xsl:call-template>
  <xsl:text>,</xsl:text>
  <xsl:call-template name="EnQuote">
   <xsl:with-param name="Enclose" select="'1'"/>
   <xsl:with-param name="String" select="SCHEMA_OBJ/NAME"/>
  </xsl:call-template>
  <xsl:text>,</xsl:text>
  <xsl:call-template name="EnQuote">
   <xsl:with-param name="Enclose" select="'1'"/>
   <xsl:with-param name="String" select="$FullName"/>
  </xsl:call-template>
  <xsl:text>,</xsl:text>
  <xsl:call-template name="EnQuote">
   <xsl:with-param name="Enclose" select="'1'"/>
   <xsl:with-param name="String" select="'TABLE'"/>
  </xsl:call-template>
  <xsl:text>,</xsl:text>
  <xsl:call-template name="EnQuote">
   <xsl:with-param name="Enclose" select="'1'"/>
   <xsl:with-param name="String" select="TABPART/SCHEMA_OBJ/SUBNAME"/>
  </xsl:call-template>
  <xsl:text>); COMMIT; END;</xsl:text>
  <xsl:call-template name="DoTerminator">
   <xsl:with-param name="Text"/>
  </xsl:call-template>
 </xsl:template>
 <xsl:template match="TABCLUSTER">
  <!-- *******************************************************************
Template: TABCLUSTER - for cluster tables
******************************************************************** -->
  <xsl:text>CLUSTER </xsl:text>
  <xsl:apply-templates select="SCHEMA_OBJ"/>
  <xsl:text>(</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>
 </xsl:template>
 <xsl:template match="FBA">
  <!-- *******************************************************************
Template: FBA - for flashback archive enabled tables
******************************************************************** -->
  <xsl:text>FLASHBACK ARCHIVE "</xsl:text>
  <xsl:value-of select="FA_NAME"/>
  <xsl:text>"</xsl:text>
 </xsl:template>
 <xsl:template name="GenOnCommitAction">
  <!-- *******************************************************************
Template: GenOnCommitAction - generate ON COMMIT action for temp tables
******************************************************************** -->
  <xsl:if test="(PROPERTY mod 8388608)>=4194304">
   <!-- temporary table -->
   <xsl:choose>
    <xsl:when test="(PROPERTY mod 16777216)>=8388608">
     <xsl:text>ON COMMIT PRESERVE ROWS </xsl:text>
    </xsl:when>
    <xsl:otherwise>
     <xsl:text>ON COMMIT DELETE ROWS </xsl:text>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenTablePhysicalAttrs">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: GenTablePhysicalAttrs - dispatch to a processing template
  depending on table characteristics:
  non-partitioned heap table - GenHTablePhysicalAttrs
  non-partition IOT - GenIOTPhysicalAttrs
  partitioned heap table - GenPHTablePhysicalAttrs
  partition IOT - GenPIOTPhysicalAttrs
      *new for 11.1*
  heap partition converted to non-part table - CvtHPartToTable
  PIOT partition converted to non-part IOT - CvtPIOTPartToTable
Current node: TABLE_T
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="(PART_OBJ)">
    <!-- partitioned -->
    <xsl:choose>
     <xsl:when test="(string-length($PARTITION_NAME)!=0 or
                      string-length($SUBPARTITION_NAME)!=0)">
      <xsl:choose>
       <xsl:when test="(PROPERTY mod 128)>=64">
        <!-- convert PIOT partition to non-partitioned IOT -->
        <xsl:call-template name="CvtPIOTPartToTable">
         <xsl:with-param name="Pctspace" select="$Pctspace"/>
        </xsl:call-template>
       </xsl:when>
       <!-- Convert External partition to non-partitioned external table -->
       <xsl:when test="(PROPERTY mod 4294967296)>=2147483648">
        <xsl:choose>
         <xsl:when test="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM">
          <xsl:call-template name="GenExtTableClauses">
           <xsl:with-param name="IsExtPartConv" select="true()"/>
           <xsl:with-param name="partNode" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]"/>
          </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
          <xsl:call-template name="GenExtTableClauses">
           <xsl:with-param name="IsExtPartConv" select="true()"/>
           <xsl:with-param name="partNode" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]"/>
          </xsl:call-template>
         </xsl:otherwise>
        </xsl:choose>
        <!-- Generate inmemory clause in departitioned external table -->
        <xsl:if test="$INMEMORY_CLAUSE">
         <xsl:call-template name="DoInMemory"/>
        </xsl:if>
       </xsl:when>
       <xsl:otherwise>
        <!-- convert heap partition to non-partitioned heap table -->
        <xsl:call-template name="CvtHPartToTable">
         <xsl:with-param name="Pctspace" select="$Pctspace"/>
        </xsl:call-template>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
      <xsl:choose>
       <xsl:when test="(PROPERTY mod 128)>=64">
        <!-- PIOT -->
        <xsl:if test="$DWCS_CVT_IOTS = 0">
         <xsl:call-template name="GenPIOTPhysicalAttrs">
          <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
          <xsl:with-param name="Pctspace" select="$Pctspace"/>
         </xsl:call-template>
        </xsl:if>
       </xsl:when>
       <xsl:otherwise>
        <!-- Partitioned heap table -->
        <xsl:call-template name="GenPHTablePhysicalAttrs">
         <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
         <xsl:with-param name="Pctspace" select="$Pctspace"/>
        </xsl:call-template>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:otherwise>
    <!-- non-partitioned -->
    <xsl:choose>
     <xsl:when test="(PROPERTY mod 128)>=64">
      <!-- IOT -->
      <xsl:if test="$DWCS_CVT_IOTS = 0">
       <xsl:call-template name="GenIOTPhysicalAttrs">
        <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
        <xsl:with-param name="Pctspace" select="$Pctspace"/>
       </xsl:call-template>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
      <!-- Non-partitioned heap table -->
      <xsl:call-template name="GenHTablePhysicalAttrs">
       <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
       <xsl:with-param name="Pctspace" select="$Pctspace"/>
       <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
      </xsl:call-template>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="GenHTablePhysicalAttrs">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: GenHTablePhysicalAttrs - Physical attrs for non-partitioned
                heap table
Current node: TABLE_T, MVIEW_TAB or MVIEWLOG_TAB
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:variable name="flagArch1">33554432</xsl:variable>
  <!-- Do only if SEGMENT_ATTRIBUTES is true or there is a -->
  <!-- table compression clause NOTE: $Table_Compression_Clause comes -->
  <!-- from kucommon.xsl and takes into account TRANSPORTABLE -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1 or string-length($Table_Compression_Clause) != 0">
   <!-- table physical attributes (PCTFREE, PCTUSED, INITRANS, MAXTRANS) -->
   <xsl:if test="local-name(.)='TABLE_T' and
   not(COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE')">
    <xsl:call-template name="DeferredSegmentCreationClause">
     <xsl:with-param name="TableNode" select="."/>
    </xsl:call-template>
   </xsl:if>
   <!-- Xml token set entity -->
   <xsl:if test="local-name(.)='TABLE_T'">
    <xsl:if test="(PROPERTY3 mod 4)>=2">
     <xsl:text> XMLTOKENSET </xsl:text>
    </xsl:if>
   </xsl:if>
   <!-- if deferred segment creation, storage params are in DEFERRED_STG -->
   <!-- PCTFREE, PCTUSED, INITRANS, MAXTRANS treated the same as -->
   <!--  non-deferred storage tables; use the values in tab$ -->
   <!-- get the other storage data from deferred_stg$ -->
   <xsl:choose>
    <xsl:when test="(PROPERTY2 mod 8)>=4">
     <xsl:if test="DEFERRED_STG">
      <xsl:variable name="CMCompress" select="DEFERRED_STG/CCFLAG_STG"/>
      <!-- 8194  - CELLMEMORY enabled
           8196  - MEMCOMPRESS FOR QUERY
           8200  - MEMCOMPRESS FOR CAPACITY
          16384  - NO CELLMEMORY -->
      <xsl:variable name="flagNoCMemory">16384</xsl:variable>
      <xsl:variable name="flagCMemory">8192</xsl:variable>
      <xsl:variable name="flagCMCompressQuery">4</xsl:variable>
      <xsl:variable name="flagCMCompressCapacity">8</xsl:variable>
      <xsl:variable name="isCMemory" select="($CMCompress mod ($flagCMemory*2)>=$flagCMemory)"/>
      <xsl:call-template name="DoCMemoryCompressSyntax">
       <xsl:with-param name="isNoCMemory" select="($CMCompress mod ($flagNoCMemory*2)>=$flagNoCMemory)"/>
       <xsl:with-param name="isCMemory" select="$isCMemory"/>
       <xsl:with-param name="isCMCompressQuery" select="$isCMemory and ($CMCompress mod ($flagCMCompressQuery*2)>=4)"/>
       <xsl:with-param name="isCMCompressCapacity" select="$isCMemory and ($CMCompress mod ($flagCMCompressCapacity*2)>=8)"/>
       <xsl:with-param name="doPretty" select="false()"/>
      </xsl:call-template>
     </xsl:if>
     <xsl:apply-templates select="PCT_FREE"/>
     <!-- Memoptimize clause with deferred segment -->
     <xsl:variable name="MemoptRead">134217728</xsl:variable>
     <xsl:variable name="MemoptWrite">268435456</xsl:variable>
     <xsl:call-template name="DoMemoptimizeSyntax">
      <xsl:with-param name="isMemoptRead" select="(PROPERTY3 mod ($MemoptRead*2)>=$MemoptRead)"/>
      <xsl:with-param name="isMemoptWrite" select="(PROPERTY3 mod ($MemoptWrite*2)>=$MemoptWrite)"/>
     </xsl:call-template>
     <!-- Compression clause is NOT valid for MVIEW_LOG  objects. -->
     <xsl:variable name="doCompression">
      <xsl:choose>
       <xsl:when test="$MVIEW_LOG = 1">0</xsl:when>
       <xsl:otherwise>1</xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
     <xsl:call-template name="DoDeferredStg">
      <xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
      <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
      <xsl:with-param name="doCompression" select="$doCompression"/>
     </xsl:call-template>
     <xsl:if test="$TABLESPACE=1">
      <xsl:apply-templates select="TS_NAME"/>
     </xsl:if>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="GenHTablePhysicalAttrs1">
      <xsl:with-param name="MVIEW_LOG" select="$MVIEW_LOG"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
      <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
  <!--inmemory columnar - do only if we are actually process a table-->
  <xsl:if test="local-name(.)='TABLE_T' or local-name(.)='MVIEW_TAB'">
   <!--inmemory columnar -from DEFERRED_STG/IMCFLAG_STG or STORAGE/FLAGS -->
   <xsl:call-template name="DoSegInMemory">
    <xsl:with-param name="Root" select="current()"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenHTablePhysicalAttrs1">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <xsl:param name="ViewAsTable">0</xsl:param>
  <!-- *******************************************************************
Template: GenHTablePhysicalAttrs1 - Physical attrs for non-partitioned
                heap table without deferred segment creation
Current node: TABLE_T, MVIEW_TAB or MVIEWLOG_TAB
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
  ViewAsTable - 1 = table XML for view-as-table
******************************************************************** -->
  <xsl:apply-templates select="PCT_FREE"/>
  <xsl:if test="$MVIEW_LOG=0">
   <xsl:variable name="MemoptRead">134217728</xsl:variable>
   <xsl:variable name="MemoptWrite">268435456</xsl:variable>
   <xsl:call-template name="DoMemoptimizeSyntax">
    <xsl:with-param name="isMemoptRead" select="(PROPERTY3 mod ($MemoptRead*2)>=$MemoptRead)"/>
    <xsl:with-param name="isMemoptWrite" select="(PROPERTY3 mod ($MemoptWrite*2)>=$MemoptWrite)"/>
   </xsl:call-template>
   <xsl:call-template name="DoCMemoryCompress">
    <xsl:with-param name="CMCompress" select="STORAGE/FLAGS2"/>
   </xsl:call-template>
   <xsl:call-template name="DoSegCompress">
    <xsl:with-param name="Compress" select="STORAGE/FLAGS"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:call-template name="DoLogging">
   <xsl:with-param name="FlagsNode" select="FLAGS"/>
  </xsl:call-template>
  <xsl:apply-templates select="STORAGE">
   <xsl:with-param name="BlkSize" select="../BLOCKSIZE | BLOCKSIZE"/>
   <xsl:with-param name="Dataobjnum" select="DATAOBJ_NUM"/>
   <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
   <xsl:with-param name="ViewAsTable" select="$ViewAsTable"/>
  </xsl:apply-templates>
  <!-- hack: if deferred segment creation, the STORAGE template will not
        be called (because there will be no STORAGE element;
        so do tablespace here -->
  <xsl:if test="(PROPERTY2 mod 8)>=4">
   <xsl:if test="$TABLESPACE=1">
    <xsl:apply-templates select="TS_NAME"/>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenIOTPhysicalAttrs">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: GenIOTPhysicalAttrs - Physical attrs for non-partitioned IOT
Current node: TABLE_T
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <!-- Xml token set entity -->
  <xsl:if test="local-name(.)='TABLE_T'">
   <xsl:if test="(PROPERTY3 mod 4)>=2">
    <xsl:text> XMLTOKENSET </xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- Do only if SEGMENT_ATTRIBUTES is true -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1">
   <!-- Memoptimize clause with deferred segment -->
   <xsl:variable name="MemoptRead">134217728</xsl:variable>
   <xsl:variable name="MemoptWrite">268435456</xsl:variable>
   <xsl:call-template name="DoMemoptimizeSyntax">
    <xsl:with-param name="isMemoptRead" select="(PROPERTY3 mod ($MemoptRead*2)>=$MemoptRead)"/>
    <xsl:with-param name="isMemoptWrite" select="(PROPERTY3 mod ($MemoptWrite*2)>=$MemoptWrite)"/>
   </xsl:call-template>
   <!-- table physical attributes (PCTFREE, PCTUSED, INITRANS, MAXTRANS) -->
   <xsl:apply-templates select="PCT_FREE">
    <xsl:with-param name="ADT_type">INDEX</xsl:with-param>
   </xsl:apply-templates>
   <xsl:call-template name="DoLogging">
    <xsl:with-param name="FlagsNode" select="FLAGS"/>
   </xsl:call-template>
   <xsl:choose>
    <xsl:when test="(PROPERTY2 mod 8)>=4">
     <xsl:call-template name="DoDeferredStg">
      <xsl:with-param name="DeferredStg" select="DEFERRED_STG"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
      <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
      <xsl:with-param name="doCompression">0</xsl:with-param>
      <xsl:with-param name="doLogging">0</xsl:with-param>
     </xsl:call-template>
     <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="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:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <xsl:text> PCTTHRESHOLD </xsl:text>
   <xsl:value-of select="PCT_THRESH"/>
  </xsl:if>
  <!-- Do unconditionally -->
  <xsl:if test="(FLAGS mod 536870912) >= 268435456">
   <xsl:text> MAPPING TABLE </xsl:text>
   <xsl:if test="$Transportable=1">
    <xsl:apply-templates select="MAPTAB/PCT_FREE"/>
    <xsl:apply-templates select="MAPTAB/STORAGE">
     <xsl:with-param name="BlkSize" select="MAPTAB/BLOCKSIZE"/>
     <xsl:with-param name="Dataobjnum" select="MAPTAB/DATAOBJ_NUM"/>
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
    </xsl:apply-templates>
   </xsl:if>
  </xsl:if>
  <xsl:if test="(PROPERTY mod 256)>=128 and $DWCS_CVT_IOTS = 0">
   <!-- IOV -->
   <xsl:call-template name="DoIOV">
    <xsl:with-param name="Node" select="current()"/>
    <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenPHTablePhysicalAttrs">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: GenPHTablePhysicalAttrs - Physical attrs for partitioned heap table
Current node: TABLE_T
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <xsl:variable name="BYTE4" select="4294967296"/>
  <xsl:variable name="flagArch1">8</xsl:variable>
  <!-- Xml token set entity -->
  <xsl:if test="local-name(.)='TABLE_T'">
   <xsl:if test="(PROPERTY3 mod 4)>=2">
    <xsl:text> XMLTOKENSET </xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- Do only if SEGMENT_ATTRIBUTES is true or if a compression clause has 
       been specified -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1 or string-length($Table_Compression_Clause) != 0">
   <xsl:if test="$MVIEW_LOG=0">
    <xsl:call-template name="DeferredSegmentCreationClause">
     <xsl:with-param name="TableNode" select="."/>
    </xsl:call-template>
    <xsl:call-template name="DoPartObjCMemoryCompress">
     <xsl:with-param name="CMCompress" select="PART_OBJ/PARTOBJ/SPARE3"/>
    </xsl:call-template>
   </xsl:if>
   <xsl:call-template name="DoPartObjSegAttrs">
    <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
   </xsl:call-template>
   <!-- Generate memoptimize clause at table level for partitioned table and
        with merge partition_options -->
   <xsl:variable name="MemoptRead">134217728</xsl:variable>
   <xsl:variable name="MemoptWrite">268435456</xsl:variable>
   <xsl:call-template name="DoMemoptimizeSyntax">
    <xsl:with-param name="isMemoptRead" select="(PROPERTY3 mod ($MemoptRead*2)>=$MemoptRead)"/>
    <xsl:with-param name="isMemoptWrite" select="(PROPERTY3 mod ($MemoptWrite*2)>=$MemoptWrite)"/>
   </xsl:call-template>
   <xsl:if test="$MVIEW_LOG=0">
    <xsl:call-template name="DoPartOBJCompress">
     <xsl:with-param name="Compress" select="(floor((PART_OBJ/PARTOBJ/SPARE2) div $BYTE4) mod  256)"/>
    </xsl:call-template>
   </xsl:if>
   <xsl:call-template name="DoPartObjLogging"/>
   <xsl:call-template name="DoPartObjStorage">
    <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
   </xsl:call-template>
   <xsl:call-template name="DoPartObjTablespace"/>
  </xsl:if>
  <!-- Do partobj read-only, well only if we are partitioning -->
  <xsl:if test="$PARTITIONING=1">
   <xsl:call-template name="DoPartObjReadOnly"/>
  </xsl:if>
  <!--inmemory columnar - do only if we are actually process a table-->
  <xsl:if test="local-name(.)='TABLE_T' or local-name(.)='MVIEW_TAB'">
   <!-- inmemory columnar - definitions from dcore.bsq
 the bits in spare2 line up with KKPACOCD_IMC_xxxx symbols in kkpac.h:
  stored in partobj$.spare2, byte 5/6   : inmemory columnar attributes            
  /* byte 5   : inmemory columnar attributes            */
  /*            00000000 : imc not specified            */ 
  /*            00000001 : imc explicitly enabled       */ 1
  /*            00000010 : imc explicitly not enabled   */ 2
  /*            00000100 : imc_mirrormap */                4
  /*            00001000 : imc level 1 */                  8
  /*            00010000 : imc_preload  */                16
  /*            00100000 : imc_mapby1  */                 32
  /*            01000000 : imc_mapby2  */
  /*            10000000 : imc level        */           128
  /* byte 6:    00000001 : imc level 3    */            
  /*            00000010 : imc level 4*/
  /*            00000100 : duplicate1  */               1024
  /*            00001000 : duplicate2  */
  /*            IMC preload priority levels */
  /*            00010000 : priority NONE */             4096
  /*            00100000 : priority LOW */
  /*            01000000 : priority MEDIUM */
  /*            10000000 : priority HIGH */
  /* byte 7:    00000001 : priority CRITICAL */-->
   <xsl:variable name="IMCsegflag">
    <xsl:choose>
     <xsl:when test="PART_OBJ/PARTOBJ/IMC_FLAGS">
      <xsl:value-of select="PART_OBJ/PARTOBJ/IMC_FLAGS"/>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="floor(PART_OBJ/PARTOBJ/SPARE2 div 1099511627776)"/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>
   <xsl:variable name="Enabled" select="($IMCsegflag) mod 2"/>
   <xsl:variable name="Disabled" select="floor($IMCsegflag div 2) mod 2"/>
   <xsl:variable name="MirrorMap" select="floor($IMCsegflag div 4) mod 2"/>
   <xsl:variable name="Level1" select="floor($IMCsegflag div 8) mod 2"/>
   <xsl:variable name="Preload" select="floor($IMCsegflag div 16) mod 2"/>
   <xsl:variable name="MapBy12" select="floor($IMCsegflag div 32) mod 4"/>
   <xsl:variable name="Level234" select="floor($IMCsegflag div 128) mod 8"/>
   <xsl:variable name="Priority" select="floor($IMCsegflag div 4096) mod 8"/>
   <xsl:call-template name="DoInMemory">
    <xsl:with-param name="InMemory">
     <xsl:choose>
      <xsl:when test="$Enabled = 1">
       <xsl:text>1</xsl:text>
      </xsl:when>
      <xsl:when test="$Disabled = 1">
       <xsl:text>2</xsl:text>
      </xsl:when>
      <xsl:otherwise>
       <xsl:text>0</xsl:text>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="Priority">
     <xsl:choose>
      <xsl:when test="$Preload=1">
       <xsl:choose>
        <xsl:when test="$Priority=0">
         <xsl:text>0</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=1">
         <xsl:text>1</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=2">
         <xsl:text>2</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=3">
         <xsl:text>4</xsl:text>
        </xsl:when>
        <xsl:when test="$Priority=4">
         <xsl:text>6</xsl:text>
        </xsl:when>
        <xsl:otherwise>
         <xsl:text>5</xsl:text>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:when>
      <xsl:when test="$Preload=0">
       <xsl:choose>
        <xsl:when test="$Priority=5">
         <xsl:text>7</xsl:text>
        </xsl:when>
        <xsl:otherwise>
         <xsl:text>0</xsl:text>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:when>
     </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="Compression" select="($Level234*2)+$Level1"/>
    <xsl:with-param name="Distribute" select="($MapBy12*2)+$MirrorMap"/>
    <xsl:with-param name="Duplicate" select="floor($IMCsegflag div 1024) mod 4"/>
    <xsl:with-param name="ServiceName">
     <xsl:if test="PART_OBJ/PARTOBJ/SPARE3 and 
                  (PART_OBJ/PARTOBJ/SPARE3 mod (16777216*2))>=16777216">
      <xsl:choose>
       <xsl:when test="PART_OBJ/PARTOBJ/SVCFLAGS=1">
        <xsl:text>DEFAULT</xsl:text>
       </xsl:when>
       <xsl:when test="PART_OBJ/PARTOBJ/SVCFLAGS=2">
        <xsl:text>NONE</xsl:text>
       </xsl:when>
       <xsl:when test="PART_OBJ/PARTOBJ/SVCFLAGS=3">
        <xsl:text>ALL</xsl:text>
       </xsl:when>
       <xsl:when test="PART_OBJ/PARTOBJ/SVCFLAGS=4">
        <xsl:value-of select="PART_OBJ/PARTOBJ/SVCNAME"/>
       </xsl:when>
       <xsl:otherwise>DEFAULT</xsl:otherwise>
      </xsl:choose>
     </xsl:if>
    </xsl:with-param>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="GenPIOTPhysicalAttrs">
  <xsl:param name="MVIEW_LOG">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: GenPIOTPhysicalAttrs - Physical attrs for partitioned IOT
Current node: TABLE_T
Parameters:
  MVIEW_LOG - 1 = generate attributes for materialized view log
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <!-- Xml token set entity -->
  <xsl:if test="local-name(.)='TABLE_T'">
   <xsl:if test="(PROPERTY3 mod 4)>=2">
    <xsl:text> XMLTOKENSET </xsl:text>
   </xsl:if>
  </xsl:if>
  <!-- Do only if SEGMENT_ATTRIBUTES is true -->
  <xsl:if test="$SEGMENT_ATTRIBUTES=1">
   <xsl:if test="$PARTITIONING=1">
    <xsl:call-template name="DoPIOTSegAttrs">
     <xsl:with-param name="Node" select="PART_OBJ/INDPARTOBJ"/>
    </xsl:call-template>
   </xsl:if>
   <xsl:call-template name="DoPIOTLogging">
    <!-- also does storage -->
    <xsl:with-param name="Node" select="PART_OBJ/INDPARTOBJ"/>
   </xsl:call-template>
   <xsl:call-template name="DoPartObjTablespace"/>
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <xsl:text> PCTTHRESHOLD </xsl:text>
   <xsl:value-of select="PCT_THRESH"/>
  </xsl:if>
  <xsl:if test="(FLAGS mod 536870912) >= 268435456">
   <xsl:text> MAPPING TABLE </xsl:text>
  </xsl:if>
  <xsl:if test="(PROPERTY mod 256)>=128 and $DWCS_CVT_IOTS = 0">
   <!-- IOV -->
   <xsl:call-template name="DoIOV">
    <xsl:with-param name="Node" select="current()"/>
    <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 <xsl:template name="CvtHPartToTable">
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: CvtHPartToTable
Current node: TABLE_T
Parameters:
  Pctspace - value of the PCTSPACE param; defaults to 100
Implicit parameters:
  PARTITION_NAME or SUBPARTITION_NAME
   (sub)partition that is the source of storage information
******************************************************************** -->
  <xsl:if test="$VERSION>=1200000000">
   <xsl:call-template name="DoILMClause"/>
  </xsl:if>
  <xsl:choose>
   <xsl:when test="string-length($PARTITION_NAME)!=0">
    <!--
         convert partition to table
 -->
    <xsl:choose>
     <xsl:when test="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]">
      <xsl:call-template name="doCvtHPartToTable">
       <xsl:with-param name="partNode" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]"/>
       <xsl:with-param name="partType" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
       <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
      </xsl:call-template>
     </xsl:when>
     <xsl:when test="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]">
      <!--
         convert composite partition to table
 -->
      <xsl:call-template name="doCvtHPartToTable">
       <xsl:with-param name="partNode" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]"/>
       <xsl:with-param name="partType" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
       <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
      </xsl:call-template>
     </xsl:when>
    </xsl:choose>
   </xsl:when>
   <xsl:otherwise>
    <!--
         convert subpartition to table
 -->
    <xsl:variable name="SubPartsItem" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]"/>
    <xsl:call-template name="doCvtHPartToTable">
     <xsl:with-param name="partNode" select="$SubPartsItem"/>
     <xsl:with-param name="partType" select="PART_OBJ/PARTOBJ/PARTTYPE"/>
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
    </xsl:call-template>
    <xsl:apply-templates select="$SubPartsItem/LOBS">
     <xsl:with-param name="PartListItem">SUBPARTS_ITEM</xsl:with-param>
     <xsl:with-param name="Parttype" select="PART_OBJ/PARTOBJ/SPARE2 mod 256"/>
     <xsl:with-param name="Subpartition">1</xsl:with-param>
    </xsl:apply-templates>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="doCvtHPartToTable">
  <xsl:param name="partNode" select="''"/>
  <xsl:param name="partType">0</xsl:param>
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: doCvtHPartToTable
Parameters:
  partNode: partition node
  partType: partitioning type
  Pctspace - value of the PCTSPACE param; defaults to 100
******************************************************************** -->
  <!-- emit SEGMENT CREATION ... for versions greater than 11.2 -->
  <xsl:if test="$VERSION>=1102000000">
   <xsl:choose>
    <xsl:when test="(($partNode/SPARE2) mod 512)>=256">
     <xsl:text>SEGMENT CREATION DEFERRED </xsl:text>
    </xsl:when>
    <xsl:when test="(($partNode/SPARE2) mod 1024)>=512">
     <xsl:text>SEGMENT CREATION IMMEDIATE </xsl:text>
    </xsl:when>
   </xsl:choose>
  </xsl:if>
  <xsl:call-template name="DoSegInMemory">
   <xsl:with-param name="Root" select="$partNode"/>
  </xsl:call-template>
  <xsl:call-template name="DoPartCellMemory">
   <xsl:with-param name="TableNode" select="current()"/>
   <xsl:with-param name="PartNode" select="$partNode"/>
  </xsl:call-template>
  <xsl:variable name="flagMemoptRead">1073741824</xsl:variable>
  <xsl:variable name="flagMemoptWrite">2147483648</xsl:variable>
  <xsl:call-template name="DoMemoptimizeSyntax">
   <xsl:with-param name="isMemoptRead" select="($partNode/FLAGS mod ($flagMemoptRead*2)>=$flagMemoptRead)"/>
   <xsl:with-param name="isMemoptWrite" select="($partNode/FLAGS mod ($flagMemoptWrite*2)>=$flagMemoptWrite)"/>
  </xsl:call-template>
  <xsl:apply-templates select="$partNode/PCT_FREE"/>
  <xsl:apply-templates select="$partNode/DEFPCTFREE"/>
  <!-- handle storage, either deferred or immediate -->
  <xsl:choose>
   <xsl:when test="$partNode/DEFERRED_STG">
    <xsl:call-template name="DoDeferredStg">
     <xsl:with-param name="DeferredStg" select="$partNode/DEFERRED_STG"/>
     <xsl:with-param name="Pctspace" select="$Pctspace"/>
     <xsl:with-param name="ADT_type">TABLE</xsl:with-param>
     <xsl:with-param name="doCompression">1</xsl:with-param>
     <xsl:with-param name="doLogging">1</xsl:with-param>
    </xsl:call-template>
    <xsl:if test="$TABLESPACE=1">
     <xsl:apply-templates select="$partNode/TS_NAME"/>
    </xsl:if>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="DoSegCompress">
     <xsl:with-param name="Compress" select="$partNode/STORAGE/FLAGS"/>
    </xsl:call-template>
    <xsl:call-template name="DoLogging">
     <xsl:with-param name="FlagsNode" select="$partNode/FLAGS"/>
    </xsl:call-template>
    <xsl:apply-templates select="$partNode/STORAGE">
     <xsl:with-param name="BlkSize" select="$partNode/BLOCKSIZE"/>
     <xsl:with-param name="Dataobjnum" select="$partNode/DATAOBJ_NUM"/>
     <xsl:with-param name="Pctspace" select="$Pctspace"/>
    </xsl:apply-templates>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:choose>
   <!-- In case of XMLType partitioned table departition, generation of lob storage of partition
        is not needed as storage is available at table level -->
   <xsl:when test="COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/SCHEMA_OBJ/NAME='XMLTYPE'
                   or
                   COL_LIST/COL_LIST_ITEM[NAME='SYS_NC_ROWINFO$']/TYPEMD/NAME='XMLTYPE'"/>
   <xsl:otherwise>
    <xsl:apply-templates select="$partNode/LOBS">
     <xsl:with-param name="PartListItem">PART_LIST_ITEM</xsl:with-param>
     <xsl:with-param name="Parttype" select="$partType"/>
     <xsl:with-param name="Subpartition">0</xsl:with-param>
    </xsl:apply-templates>
   </xsl:otherwise>
  </xsl:choose>
  <!-- 
Placeholder for equipartitioned nested tables.
If a table's nested tables are not equipartitioned with the partition,
partition transportable should fail.
-->
  <!-- The parallel stuff is defined at the table level so it should
 be preserved from that, not try to get it from the partition -->
  <xsl:call-template name="DoParallel">
   <xsl:with-param name="FlagsParent" select="current()"/>
  </xsl:call-template>
  <!-- if the partition was read only, the table should be now -->
  <xsl:if test="($partNode/FLAGS mod (67108864*2)) >= 67108864">
   <xsl:text> READ ONLY </xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template name="CvtPIOTPartToTable">
  <xsl:param name="Pctspace">100</xsl:param>
  <!-- *******************************************************************
Template: CvtPIOTPartToTable
Current node: TABLE_T
Parameters:
  Pctspace - value of the PCTSPACE param; defaults to 100
Implicit parameters:
  PARTITION_NAME or SUBPARTITION_NAME
   (sub)partition that is the source of storage information
******************************************************************** -->
  <xsl:choose>
   <xsl:when test="string-length($PARTITION_NAME)!=0">
    <!--
         convert partition to table
 -->
    <xsl:apply-templates select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/PCT_FREE">
     <xsl:with-param name="ADT_type">INDEX</xsl:with-param>
    </xsl:apply-templates>
    <xsl:call-template name="DoSegCompress">
     <xsl:with-param name="Compress" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/STORAGE/FLAGS"/>
    </xsl:call-template>
    <xsl:call-template name="DoLogging">
     <xsl:with-param name="FlagsNode" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/FLAGS"/>
    </xsl:call-template>
    <xsl:apply-templates select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/STORAGE">
     <xsl:with-param name="BlkSize" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/BLOCKSIZE"/>
     <xsl:with-param name="Dataobjnum" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/DATAOBJ_NUM"/>
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/LOBS">
     <xsl:with-param name="PartListItem">PART_LIST_ITEM</xsl:with-param>
     <xsl:with-param name="Parttype" select="PART_OBJ/TABPARTOBJ/PARTTYPE"/>
     <xsl:with-param name="Subpartition">0</xsl:with-param>
    </xsl:apply-templates>
    <!-- 
Placeholder for equipartitioned nested tables.
If a table's nested tables are not equipartitioned with the partition,
partition transportable should fail.
-->
    <xsl:if test="$DWCS_CVT_IOTS = 0">
     <xsl:call-template name="DoIOVList">
      <xsl:with-param name="List" select="PART_OBJ/IOV_LIST"/>
      <xsl:with-param name="PNUM" select="PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/PART_NUM"/>
      <xsl:with-param name="Pctspace" select="$Pctspace"/>
     </xsl:call-template>
    </xsl:if>
    <xsl:call-template name="DoParallel">
     <xsl:with-param name="FlagsParent" select="current()"/>
    </xsl:call-template>
    <!-- if the partition was read only, the table should be now -->
    <xsl:if test="(PART_OBJ/PART_LIST/PART_LIST_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/TP_FLAGS mod (67108864*2)) >= 67108864">
     <xsl:text> READ ONLY </xsl:text>
    </xsl:if>
   </xsl:when>
   <xsl:otherwise>
    <!--
         convert subpartition to table
         (Placeholder: composite partitioned IOTs will be added in 11g)
 -->
    <xsl:apply-templates select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/PCT_FREE"/>
    <xsl:call-template name="DoSegCompress">
     <xsl:with-param name="Compress" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$PARTITION_NAME]/STORAGE/FLAGS"/>
    </xsl:call-template>
    <xsl:call-template name="DoLogging">
     <xsl:with-param name="FlagsNode" select="
PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/FLAGS"/>
    </xsl:call-template>
    <xsl:apply-templates select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/STORAGE">
     <xsl:with-param name="BlkSize" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/BLOCKSIZE"/>
     <xsl:with-param name="Dataobjnum" select="PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/DATAOBJ_NUM"/>
     <xsl:with-param name="Pctspace" select="$PCTSPACE"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="
PART_OBJ/COMPART_LIST/COMPART_LIST_ITEM/SUBPARTS/SUBPARTS_ITEM[SCHEMA_OBJ/SUBNAME=$SUBPARTITION_NAME]/LOBS">
     <xsl:with-param name="PartListItem">SUBPARTS_ITEM</xsl:with-param>
     <xsl:with-param name="Parttype" select="PART_OBJ/TABPARTOBJ/SPARE2 mod 256"/>
     <xsl:with-param name="Subpartition">1</xsl:with-param>
    </xsl:apply-templates>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="CheckTypes">
  <!-- *******************************************************************
Template: CheckTypes
 Add check_type calls for all object types used directly by the table

      If transportable tablespace import and not classic export and VERS_MAJOR
      is at least 2 and VERS_MINOR is at least 2, insert check_type calls for
      object types. For this check to work, the major and minor versions were
      all given the same values in all table views that can contain object
      types (the 4 non-heap table views ku$_fhtable_view, ku$_iotable_view,
      ku$_pfhtable_view, and ku$_piotable_view).

      Do not do this for classic because it does things differently and it
      does its own type checking. Check for not classic export is for parameter
      TRANSPORTABLE_CLASSIC=0.

      Bug 14696962: Exclude CHECK_TYPE for unused UDT cols. Once column is
      marked as unused then it corresponding UDT type may not exists. So,
      avoid CHECK_TYPE for unused columns.

******************************************************************** -->
  <xsl:if test="$Transportable=1 and $TRANSPORTABLE_CLASSIC=0 and
              (VERS_MAJOR>=3 or (VERS_MAJOR=2 and VERS_MINOR>=2))">
   <xsl:for-each select="COL_LIST/COL_LIST_ITEM[TYPE_NUM=121 and not((PROPERTY mod 65536)>=32768)]">
    <!-- Create one begin...end block for all the calls. Also, call DoParse
        once for the begin...end block. -->
    <xsl:if test="position()=1">
     <xsl:call-template name="DoParse">
      <xsl:with-param name="Verb">SYS.DBMS_METADATA.CHECK_TYPE</xsl:with-param>
      <xsl:with-param name="ObjectType">TABLE</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:text>BEGIN </xsl:text>
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;</xsl:text>
     </xsl:if>
    </xsl:if>
    <!-- If there are no subtypes, then there is 1 check_type call for the 
        type. If there are subtypes, the parent type is included at the
        TYPEMD level and again in the SUBTYPE_LIST. In that case, create
        1 call for each item in the SUBTYPE_LIST, which will include the
        top level type and each subtype. -->
    <xsl:if test="not(TYPEMD/SUBTYPE_LIST/SUBTYPE_LIST_ITEM)">
     <xsl:text>SYS.DBMS_METADATA.CHECK_TYPE('</xsl:text>
     <xsl:call-template name="EnQuote">
      <xsl:with-param name="String" select="TYPEMD/SCHEMA_OBJ/OWNER_NAME"/>
     </xsl:call-template>
     <xsl:text>','</xsl:text>
     <xsl:call-template name="EnQuote">
      <xsl:with-param name="String" select="TYPEMD/SCHEMA_OBJ/NAME"/>
     </xsl:call-template>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="TYPEMD/VERSION"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="TYPEMD/HASHCODE"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="TYPEMD/TYPEID"/>
     <xsl:text>'); </xsl:text>
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;</xsl:text>
     </xsl:if>
    </xsl:if>
    <xsl:for-each select="TYPEMD/SUBTYPE_LIST/SUBTYPE_LIST_ITEM">
     <xsl:sort select="SCHEMA_OBJ/NAME" order="ascending"/>
     <xsl:text>SYS.DBMS_METADATA.CHECK_TYPE('</xsl:text>
     <xsl:value-of select="SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="SCHEMA_OBJ/NAME"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="VERSION"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="HASHCODE"/>
     <xsl:text>','</xsl:text>
     <xsl:value-of select="TYPEID"/>
     <xsl:text>'); </xsl:text>
     <xsl:if test="$PRETTY=1">
      <xsl:text>&#xa;</xsl:text>
     </xsl:if>
    </xsl:for-each>
    <xsl:if test="position()=last()">
     <xsl:text>END;</xsl:text>
     <xsl:choose>
      <xsl:when test="$SQLTERMINATOR=1">
       <xsl:text>
/
      </xsl:text>
       <!-- Terminate the SQL statement with a CR and a "/" -->
      </xsl:when>
      <xsl:otherwise>
       <xsl:if test="$PRETTY=1">
        <xsl:text>&#xa;</xsl:text>
       </xsl:if>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:if>
   </xsl:for-each>
  </xsl:if>
 </xsl:template>
 <xsl:template name="ModifyVirtualColumns">
  <!-- *******************************************************************
Template: ModifyVirtualColumns
  Generate ALTER TABLE tab MODIFY for virtual columns
    virtual column                               - prop bit 0x010000
    with column expression                       - deflength != 0
    not system-generated column                  - prop bit 0x000100
    not hidden                                   - prop bit 0x000020
    not unused                                   - prop bit 0x008000
    not (sub)partitioning column
******************************************************************** -->
  <xsl:variable name="Partobj" select="PART_OBJ"/>
  <xsl:variable name="ThisTab" select="current()"/>
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM">
   <xsl:variable name="IsVirtCol">
    <xsl:call-template name="IsDeferVirtualColumn">
     <xsl:with-param name="Partobj" select="$Partobj"/>
    </xsl:call-template>
   </xsl:variable>
   <xsl:if test="$IsVirtCol='Y'">
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">ALTER</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
     <xsl:with-param name="SchemaNode" select="$ThisTab/SCHEMA_OBJ/OWNER_NAME"/>
     <xsl:with-param name="NameNode" select="$ThisTab/SCHEMA_OBJ/NAME"/>
    </xsl:call-template>
    <xsl:text>ALTER TABLE </xsl:text>
    <xsl:apply-templates select="$ThisTab/SCHEMA_OBJ"/>
    <xsl:text> MODIFY (</xsl:text>
    <xsl:call-template name="DoCOL">
     <xsl:with-param name="DoLF">0</xsl:with-param>
     <xsl:with-param name="Virtcol">1</xsl:with-param>
    </xsl:call-template>
    <xsl:text>)</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="HasVirtualColumns">
  <!-- *******************************************************************
Template: HasVirtualColumns - determines if deferred virtual column processing
  is required. Calls template IsDeferVirtualColumn (in kucolumn.xsl)
Current node:
  COL_LIST_ITEM
Returns:  empty string = no virtual columns whose definition should be deferred
          string of Y = there are virtual columns
******************************************************************** -->
  <xsl:variable name="Partobj" select="PART_OBJ"/>
  <xsl:for-each select="COL_LIST/COL_LIST_ITEM">
   <xsl:variable name="IsVirtCol">
    <xsl:call-template name="IsDeferVirtualColumn">
     <xsl:with-param name="Partobj" select="$Partobj"/>
    </xsl:call-template>
   </xsl:variable>
   <xsl:if test="$IsVirtCol='Y'">Y</xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="DoProjectColumn">
  <!-- *******************************************************************
Template: DoProjectColumn - syntax for external tables
Current node:
  TABLE_T
See Oracle Database Administrator's Guide, "Managing External Tables"
******************************************************************** -->
  <xsl:if test="PROPERTY>=2147483648">
   <!-- External table -->
   <xsl:if test="EXTTAB/PROPERTY=2">
    <!-- project column referenced -->
    <xsl:call-template name="DoParse">
     <xsl:with-param name="Verb">ALTER</xsl:with-param>
     <xsl:with-param name="ObjectType">TABLE</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 TABLE </xsl:text>
    <xsl:apply-templates select="SCHEMA_OBJ"/>
    <xsl:text>PROJECT COLUMN REFERENCED</xsl:text>
    <xsl:if test="$SQLTERMINATOR=1">
     <xsl:text>;</xsl:text>
    </xsl:if>
   </xsl:if>
  </xsl:if>
 </xsl:template>
 <xsl:template match="FBA_PERIODS">
  <xsl:param name="SchemaObj" select="''"/>
  <xsl:param name="ColList" select="''"/>
  <!-- *******************************************************************
Template: FBA_PERIODS
******************************************************************** -->
  <xsl:for-each select="FBA_PERIODS_ITEM">
   <xsl:apply-templates select=".">
    <xsl:with-param name="SchemaObj" select="$SchemaObj"/>
    <xsl:with-param name="ColList" select="$ColList"/>
   </xsl:apply-templates>
  </xsl:for-each>
 </xsl:template>
 <xsl:template match="FBA_PERIOD | FBA_PERIODS_ITEM">
  <xsl:param name="SchemaObj" select="''"/>
  <xsl:param name="ColList" select="''"/>
  <!-- *******************************************************************
Template: FBA_PERIOD | FBA_PERIODS_ITEM
******************************************************************** -->
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">ALTER</xsl:with-param>
   <xsl:with-param name="ObjectType">TABLE</xsl:with-param>
   <xsl:with-param name="SchemaNode" select="$SchemaObj/OWNER_NAME"/>
   <xsl:with-param name="NameNode" select="$SchemaObj/NAME"/>
  </xsl:call-template>
  <xsl:if test="$PRETTY=1">
   <xsl:text>&#xa; </xsl:text>
  </xsl:if>
  <xsl:text> ALTER TABLE </xsl:text>
  <xsl:apply-templates select="$SchemaObj">
   <xsl:with-param name="DoP2T" select="'1'"/>
  </xsl:apply-templates>
  <xsl:text>ADD PERIOD FOR "</xsl:text>
  <xsl:value-of select="PERIODNAME"/>
  <xsl:text>"</xsl:text>
  <!--bug 19164768 - hidden/virtual cols may be valid 
        see qcdl.h for property2 definition
        #define KQLDCOP2_INVC 0x00000004  
                 Invisible Column - user generated hidden col which can be made visible 
  -->
  <xsl:variable name="PeriodStartName" select="PERIODSTART"/>
  <xsl:if test="string-length($ColList)!=0 and (($ColList/COL_LIST_ITEM[NAME=$PeriodStartName]/PROPERTY mod 64) &lt; 32 or
  ($ColList/COL_LIST_ITEM[NAME=$PeriodStartName]/PROPERTY2 mod 8) >= 4)">
   <xsl:text>("</xsl:text>
   <xsl:value-of select="PERIODSTART"/>
   <xsl:text>","</xsl:text>
   <xsl:value-of select="PERIODEND"/>
   <xsl:text>") </xsl:text>
  </xsl:if>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
   <!-- Terminate the SQL statement -->
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO