MINI MINI MANI MO
<?xml version="1.0"?>
<!--
Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
NAME
kuatpar.xsl
DESCRIPTION
Convert partition diffs in sxml TABLE diff document to ALTER_XML document
MODIFIED MM/DD/YY
bwright 08/14/15 - Bug 20756134: STORE IN autolist part. table
bwright 02/24/15 - Proj 49143: Add auto-list (sub)partitioning and
range interval subpartitioning
tbhukya 01/05/15 - Bug 20319428: Import needed xsl files for
referred templates
sogugupt 12/04/14 - Bug 9797568:could not alter the partition if the
table has only one part
bwright 08/15/13 - Bug 17312600: Remove hard tabs from DP src code
tbhukya 08/14/13 - Bug 17298672: column properties in partition
rapayne 12/25/11 - proj 37634: partial index support.
rapayne 01/18/11 - bug 11064375: INITIAL diffs on partition storage
is NOT alterable.
rapayne 01/12/11 - bug 11064386: quote (sub)partition names to preserve
mixed case names.
lbarton 11/24/09 - bug 8796742: translatable error messages
lbarton 07/20/09 - bug 8494344: archive compression
rapayne 12/10/08 - fix call params to DropPartitions.
lbarton 07/10/08 - bug 5709159: SQL_LIST_ITEM subelements
lbarton 03/13/08 - Bug 6724820: table compression
htseng 12/21/06 - support materialized view
htseng 11/13/06 - drop subpartition
htseng 11/07/06 - more work
htseng 11/03/06 - add modify partition
lbarton 11/02/06 -
rapayne 09/22/06 - Initial version
-->
<xsl:stylesheet version="1.0" xmlns:sxml="http://xmlns.oracle.com/ku" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Top level imports -->
<xsl:import href="kuacomm.xsl"/>
<xsl:import href="kuspard.xsl"/>
<!-- needed for templates AlterSegmentAttributes, AlterCompress,
AlterPhysicalAttribute -->
<xsl:import href="kuatprop.xsl"/>
<!-- Needed for tamplate AlterLogging -->
<xsl:import href="kuatbls.xsl"/>
<!-- Templates -->
<xsl:template name="AlterTablePartitions">
<xsl:param name="ParentNode" select="''"/>
<!-- *******************************************************************
Template: AlterTablePartitions
Parameters:
ParentNode - Parent node of SCHEMA, NAME
******************************************************************** -->
<!-- useful variables -->
<xsl:variable name="PartitionType">
<xsl:choose>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:RANGE_PARTITIONING">RANGE</xsl:when>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:HASH_PARTITIONING">HASH</xsl:when>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:LIST_PARTITIONING">LIST</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="SubpartitionType">
<xsl:choose>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES//sxml:RANGE_SUBPARTITIONING">RANGE</xsl:when>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES//sxml:HASH_SUBPARTITIONING">HASH</xsl:when>
<xsl:when test="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES//sxml:LIST_SUBPARTITIONING">LIST</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="PartitioningNode" select="$ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:RANGE_PARTITIONING | $ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:LIST_PARTITIONING | $ParentNode/sxml:RELATIONAL_TABLE/sxml:TABLE_PROPERTIES/sxml:HASH_PARTITIONING"/>
<xsl:variable name="AttribParentNode" select="$PartitioningNode/sxml:DEFAULT_PHYSICAL_PROPERTIES/sxml:HEAP_TABLE | $PartitioningNode/sxml:DEFAULT_PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE"/>
<!-- Default tablespace of a partitioned table can be modified with
ALTER TABLE ... MODIFY DEFAULT ATTRIBUTES
Other default physical properties are modified with a simple ALTER TABLE
(see AlterTableProperties in kuatprop.xsl)
-->
<xsl:if test="$AttribParentNode/sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE/@value1">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="ModifyDefaultAttr">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="AttribParentNode" select="$AttribParentNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModifyDefaultAttr">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="AttribParentNode" select="$AttribParentNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:if>
<!-- Interval partitioning? -->
<xsl:if test="$PartitionType='RANGE'">
<xsl:call-template name="AlterIntervalPartitioning">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="ParentNode" select="$PartitioningNode"/>
<xsl:with-param name="SubPartFlag">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- List partitioning? -->
<xsl:if test="$PartitionType='LIST'">
<xsl:call-template name="AlterListPartitioning">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="ParentNode" select="$PartitioningNode"/>
<xsl:with-param name="SubPartFlag">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- Interval subpartitioning? -->
<xsl:if test="$SubpartitionType='RANGE'">
<xsl:call-template name="AlterIntervalPartitioning">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="ParentNode" select="$PartitioningNode/sxml:RANGE_SUBPARTITIONING"/>
<xsl:with-param name="SubPartFlag">1</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- List subpartitioning? -->
<xsl:if test="$SubpartitionType='LIST'">
<xsl:call-template name="AlterListPartitioning">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="ParentNode" select="$PartitioningNode/sxml:LIST_SUBPARTITIONING"/>
<xsl:with-param name="SubPartFlag">1</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- alter partitions -->
<xsl:call-template name="AlterPartitions">
<xsl:with-param name="TableNode" select="$ParentNode"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
<xsl:with-param name="ParentNode" select="$PartitioningNode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="AddPartitions">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="PartNode" select="''"/>
<!-- *******************************************************************
Template: AddPartitions
Parameters:
ParentNode - Parent node of SCHEMA, NAME
PartitionType - RANGE, LIST, or HASH
PartListNode - PARTITION
******************************************************************** -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="AddPartition">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="AddPartition">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="AddPartition">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="PartNode" select="''"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: AddPartition
Parameters:
ParentNode - Parent node of SCHEMA, NAME
PartitionType - RANGE, LIST, or HASH
PartNode - PARTITION_LIST_ITEM
Action = "PARSE" or "SQL"
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$PartNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">ADD_PARTITION</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
</xsl:call-template>
<xsl:text> ADD </xsl:text>
<xsl:call-template name="BeginAddPartition">
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="PartitionItem" select="$PartNode"/>
</xsl:call-template>
<xsl:call-template name="CompleteAddPartition">
<xsl:with-param name="ParentNode" select="$PartNode"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="Punctuate">N</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="DropPartitions">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="PartNode" select="''"/>
<!-- *******************************************************************
Template: DropPartitions
Parameters:
ParentNode - Parent node of SCHEMA, NAME
PartListNode - PARTITION_LIST
******************************************************************** -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="DropPartition">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="DropPartition">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="DropPartition">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="PartNode" select="''"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: DropPartition
Parameters:
ParentNode - Parent node of SCHEMA, NAME
ColNode - PARTITION_LIST_ITEM
Action = "PARSE" or "SQL"
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$PartNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">DROP_PARTITION</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
</xsl:call-template>
<xsl:text> DROP PARTITION </xsl:text>
<xsl:call-template name="SourceName">
<xsl:with-param name="NameNode" select="$PartNode/sxml:NAME"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="AlterPartitions">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="SubpartitionType" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<!-- *******************************************************************
Template: AlterPartitions
Parameters:
ParentNode: RANGE_PARTITIONING
LIST_PARTITIONING
HASH_PARTITIONING
PartitionType: "RANGE", "LIST", "HASH"
SubpartitionType: "RANGE", "LIST", "HASH"
TableNode: TABLE
ObjType: "TABLE" or "MATERIALIZED VIEW"
******************************************************************** -->
<!-- create a new partition variable that stores the number of different partitions in src 1 -->
<xsl:variable name="partition" select="count(//sxml:PARTITION_LIST_ITEM[not(@src='2')])"/>
<xsl:for-each select="$ParentNode/sxml:PARTITION_LIST/sxml:PARTITION_LIST_ITEM">
<xsl:choose>
<xsl:when test="./@src='1'">
<xsl:choose>
<!-- And if there is single partition in src 1 then can not drop it generate NOT ALTERABLE msg -->
<xsl:when test="$partition = 1">
<xsl:call-template name="CommonNotAlterable">
<xsl:with-param name="XpathNode" select="sxml:PARTITION_LIST_ITEM"/>
<xsl:with-param name="NameNode" select="$ParentNode/sxml:NAME"/>
<xsl:with-param name="Reason">SINGLE_PART</xsl:with-param>
<xsl:with-param name="Message" select="$MSG_SINGLE_PART"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="DropPartitions">
<xsl:with-param name="ParentNode" select="$TableNode"/>
<xsl:with-param name="PartNode" select="."/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="./@src='2'">
<xsl:call-template name="AddPartitions">
<xsl:with-param name="ParentNode" select="$TableNode"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="PartNode" select="."/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="ModifyPartition">
<xsl:with-param name="PartNode" select="."/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="ModifyPartition">
<xsl:param name="PartNode" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="SubpartitionType" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<!-- *******************************************************************
Template: ModifyPartition
Parameters:
PartNode: PARTITION_LIST_ITEM
PartitionType: "RANGE", "LIST", "HASH"
SubpartitionType: "RANGE", "LIST", "HASH"
TableNode: TABLE
ObjType: "TABLE" or "MATERIALIZED VIEW"
******************************************************************** -->
<xsl:choose>
<xsl:when test="sxml:SUBPARTITION_LIST">
<xsl:if test="sxml:NAME/@value1">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="RenPartName">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$PartNode"/>
<xsl:with-param name="PartType">PARTITION</xsl:with-param>
<xsl:with-param name="PartName" select="sxml:NAME"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:variable name="AttribParentNode" select="sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE"/>
<xsl:if test="$AttribParentNode/sxml:SEGMENT_ATTRIBUTES//@value1 or
$AttribParentNode/sxml:COMPRESS/@value1 or
$AttribParentNode/sxml:COMPRESS/@src!='1' or
$AttribParentNode/sxml:COMPRESS_LEVEL/@src">
<xsl:element name="ALTER_LIST_ITEM">
<!-- Composite-partitioning (modify_table_default_attrs) -->
<xsl:call-template name="ModifyDefaultAttr">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="AttribParentNode" select="$AttribParentNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModifyDefaultAttr">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartNode" select="$PartNode"/>
<xsl:with-param name="AttribParentNode" select="$AttribParentNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:for-each select="sxml:SUBPARTITION_LIST/sxml:SUBPARTITION_LIST_ITEM">
<xsl:if test="./@src or sxml:NAME/@value1 or sxml:TABLESPACE/@value1 or sxml:VALUES/@value1 or sxml:COMPRESS/@value1 or sxml:COMPRESS_LEVEL/@src">
<xsl:call-template name="ModifyASubpart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartName" select="$PartNode/sxml:NAME"/>
<xsl:with-param name="SubPartItem" select="."/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:when>
<!-- range/list/hash partition -->
<xsl:otherwise>
<xsl:call-template name="ModifyParts">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$PartNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifyDefaultAttr">
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartNode" select="''"/>
<xsl:param name="AttribParentNode" select="''"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: ModifyDefaultAttr
Parameters:
TableNode: TABLE
PartNode: PARTITION_LIST_ITEM
AttribParentNode: parent of SEGMENT_ATTRIBUTES and COMPRESS
Action = "PARSE" or "SQL"
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$AttribParentNode"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="string-length($PartNode)!=0">
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$PartNode/sxml:NAME"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$TableNode/sxml:NAME"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">MODIFY_TABLE_DEFAULT_ATTR</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> MODIFY DEFAULT ATTRIBUTES </xsl:text>
<xsl:if test="string-length($PartNode)!=0">
<xsl:text>FOR PARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="$PartNode/sxml:NAME"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
<!-- Segment_Attributes -->
<xsl:call-template name="AlterSegmentAttributes">
<xsl:with-param name="ParentNode" select="$AttribParentNode/sxml:SEGMENT_ATTRIBUTES"/>
</xsl:call-template>
<!-- table_compression -->
<xsl:call-template name="AlterCompress">
<xsl:with-param name="ParentNode" select="$AttribParentNode"/>
</xsl:call-template>
<!-- PCTTHRESHOLD, index-org only
key_compression, index-org only
alter_overflow_clause, index-org only
Done in AlterIot -->
<!-- LOb,LOB_parameters -->
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifyASubpart">
<xsl:param name="SubPartItem" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartName" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="SubpartitionType" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<!-- *******************************************************************
Template: ModifyASubpart
CurrentNode: SUBPARTITION_LIST_ITEM
Parameters:
SubPartItem: SUBPARTITION_LIST_ITEM
TableNode: TABLE
PartName: partition name
PartitionType: "RANGE", "LIST", "HASH"
SubpartitionType: "RANGE", "LIST", "HASH"
ObjType: TABLE or ??
******************************************************************** -->
<xsl:if test="sxml:NAME/@value1">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="RenPartName">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$SubPartItem"/>
<xsl:with-param name="PartType">SUBPARTITION</xsl:with-param>
<xsl:with-param name="PartName" select="$PartName"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:choose>
<xsl:when test="$SubPartItem/@src='1' and $SubpartitionType='HASH'">
<xsl:call-template name="CommonNotAlterable">
<xsl:with-param name="XpathNode" select="$SubPartItem"/>
<xsl:with-param name="NameNode" select="$SubPartItem/sxml:NAME"/>
<xsl:with-param name="Reason">DROP_HASH_PARTITION</xsl:with-param>
<xsl:with-param name="Message" select="$MSG_DROP_HASH_PARTITION"/>
<xsl:with-param name="Subst" select="$SubPartItem/sxml:NAME"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$SubPartItem/sxml:VALUES/@value1">
<xsl:call-template name="CommonNotAlterable">
<xsl:with-param name="XpathNode" select="$SubPartItem"/>
<xsl:with-param name="NameNode" select="$SubPartItem/sxml:NAME"/>
<xsl:with-param name="Reason">SUBPARTITION_LIST_VALUES</xsl:with-param>
<xsl:with-param name="Message" select="$MSG_SUBPARTITION_LIST_VALUES"/>
<xsl:with-param name="Subst" select="$SubPartItem/sxml:NAME"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="./@src or sxml:TABLESPACE/@value1 or sxml:COMPRESS/@value1 or sxml:COMPRESS_LEVEL/@src">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="ModifySubpart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartName" select="$PartName"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModifySubpart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="PartName" select="$PartName"/>
<xsl:with-param name="PartitionType" select="$PartitionType"/>
<xsl:with-param name="SubpartitionType" select="$SubpartitionType"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifySubpart">
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartName" select="''"/>
<xsl:param name="PartitionType" select="''"/>
<xsl:param name="SubpartitionType" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: ModifySubpart
CurrentNode: SUBPARTITION_LIST_ITEM
Parameters:
TableNode: TABLE
PartName: partition name
PartitionType: "RANGE", "LIST", "HASH"
SubpartitionType: "RANGE", "LIST", "HASH"
ObjType: TABLE or ??
Action: "PARSE" or "SQL"
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_CONSTRAINT_TYPE=1 or
$PRS_CONSTRAINT_STATE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="."/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">MODIFY_TABLE_SUBPARTITION</xsl:with-param>
<xsl:with-param name="Value2">
<xsl:choose>
<xsl:when test="./@src='1'">(DROP SUBPARTITION)</xsl:when>
<xsl:when test="./@src='2'">(ADD SUBPARTITION)</xsl:when>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:choose>
<xsl:when test="./@src='1'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> DROP SUBPARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="sxml:NAME"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:when test="./@src='2'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> MODIFY PARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="$PartName"/>
</xsl:call-template>
<xsl:text> ADD SUBPARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="sxml:NAME"/>
</xsl:call-template>
<xsl:if test="sxml:VALUES">
<xsl:text> VALUES (</xsl:text>
<xsl:value-of select="sxml:VALUES"/>
<xsl:text>) </xsl:text>
</xsl:if>
<xsl:text> TABLESPACE </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="sxml:TABLESPACE"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:if test="sxml:TABLESPACE/@value1 or sxml:COMPRESS/@value1 or sxml:COMPRESS_LEVEL/@src">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> MOVE SUBPARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="sxml:NAME"/>
</xsl:call-template>
<!-- list_values_clause, this is unalteralbe -->
<!-- xsl:if test="sxml:VALUES/@value1" -->
<!-- tablespace -->
<xsl:text> TABLESPACE "</xsl:text>
<xsl:value-of select="sxml:TABLESPACE"/>
<xsl:text>"</xsl:text>
<xsl:call-template name="AlterCompress">
<xsl:with-param name="ParentNode" select="."/>
</xsl:call-template>
<!-- overflow | tablespace -->
<!-- LOB -->
<!-- VARRAY -->
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifyParts">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<!-- *******************************************************************
Template: ModifyParts
ParentNode:sxml:PARTITION_LIST
******************************************************************** -->
<xsl:if test="sxml:NAME/@value1">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="RenPartName">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="PartType">PARTITION</xsl:with-param>
<xsl:with-param name="PartName" select="sxml:NAME"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:choose>
<xsl:when test="sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE/sxml:INITIAL/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE/sxml:INITIAL/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE/sxml:INITIAL/@value1">
<!-- NAME is not alterable-->
<xsl:call-template name="CommonNotAlterable">
<xsl:with-param name="XpathNode" select="sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE/sxml:INITIAL"/>
<xsl:with-param name="NameNode" select="sxml:NAME"/>
<xsl:with-param name="Reason">INITIAL</xsl:with-param>
<xsl:with-param name="Message" select="$MSG_INITIAL"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="sxml:COLUMN_PROPERTIES/@src='1'">
<xsl:call-template name="CommonNotAlterable">
<xsl:with-param name="XpathNode" select="$ParentNode/sxml:COLUMN_PROPERTIES"/>
<xsl:with-param name="NameNode" select="$ParentNode/sxml:NAME"/>
<xsl:with-param name="Reason">PART_VARRAY_COL_PROP</xsl:with-param>
<xsl:with-param name="Message" select="$MSG_PART_VARRAY_COL_PROP"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="sxml:SEGMENT_ATTRIBUTES/sxml:PCTFREE/@value1 or
sxml:SEGMENT_ATTRIBUTES/sxml:INITRANS/@value1 or
sxml:SEGMENT_ATTRIBUTES/sxml:PCTUSED/@value1 or
sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE//@value1 or
sxml:SEGMENT_ATTRIBUTES/sxml:LOGGING/@value1 or
sxml:COMPRESS/@value1 or
sxml:COMPRESS/@src!='1' or
sxml:COMPRESS_LEVEL/@src or
sxml:INDEXING/@src or sxml:INDEXING/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:PCTFREE/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:INITRANS/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:PCTUSED/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE//@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:LOGGING/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:COMPRESS/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:COMPRESS/@src!='1' or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:COMPRESS_LEVEL/@src or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:PCTFREE/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:INITRANS/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:PCTUSED/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:STORAGE//@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:LOGGING/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:COMPRESS/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:COMPRESS/@src!='1' or
sxml:COLUMN_PROPERTIES/@src!='1'">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="ModTabPart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModTabPart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<!-- tablespace diff -->
<xsl:if test="sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE/@value1 or sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE/@value1 or
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE/@value1">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="MoveTabPart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="MoveTabPart">
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="ObjType" select="$ObjType"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template name="MoveTabPart">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: MoveTabPart
ParentNode:sxml:PARTITION_LIST
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_CONSTRAINT_TYPE=1 or
$PRS_CONSTRAINT_STATE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">MOVE_TABLE_PARTITION</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> MOVE PARTITION </xsl:text>
<xsl:call-template name="SourceName">
<xsl:with-param name="NameNode" select="sxml:NAME"/>
</xsl:call-template>
<xsl:text> TABLESPACE "</xsl:text>
<xsl:value-of select="sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE|sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE | sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES/sxml:TABLESPACE"/>
<xsl:text>"</xsl:text>
</xsl:element>
</xsl:element>
</xsl:element>
<!-- table_compression -->
<xsl:call-template name="AlterCompress">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
</xsl:call-template>
<!-- PCTTHRESHOLD, index-org only -->
<!-- key_compression, index-org only -->
<!-- alter_overflow_clause, index-org only -->
<!-- LOb,LOB_parameters -->
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="ModTabPart">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: ModTabPart
ParentNode:sxml:PARTITION_LIST
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_CONSTRAINT_TYPE=1 or
$PRS_CONSTRAINT_STATE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">MODIFY_TABLE_PARTITION</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> MODIFY PARTITION </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="sxml:NAME"/>
</xsl:call-template>
<!-- Physical_Attributes -->
<!-- xsl:call-template name="AlterSegmentAttributes" -->
<xsl:call-template name="AlterPhysicalAttributes">
<xsl:with-param name="ParentNode" select="sxml:SEGMENT_ATTRIBUTES |
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES |
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES"/>
</xsl:call-template>
<!-- INDEXING attribute -->
<xsl:choose>
<xsl:when test="sxml:INDEXING/@src='1'">
<xsl:text> INDEXING ON</xsl:text>
</xsl:when>
<xsl:when test="sxml:INDEXING/@src='2'">
<xsl:text> INDEXING OFF</xsl:text>
</xsl:when>
<xsl:when test="sxml:INDEXING/@value1">
<xsl:text> INDEXING </xsl:text>
<xsl:value-of select="sxml:INDEXING"/>
</xsl:when>
</xsl:choose>
<!-- table_compression -->
<xsl:call-template name="AlterCompress">
<xsl:with-param name="ParentNode" select="sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE"/>
</xsl:call-template>
<!-- logging -->
<xsl:call-template name="AlterLogging">
<xsl:with-param name="ParentNode" select="sxml:SEGMENT_ATTRIBUTES |
sxml:PHYSICAL_PROPERTIES/sxml:HEAP_TABLE/sxml:SEGMENT_ATTRIBUTES |
sxml:PHYSICAL_PROPERTIES/sxml:INDEX_ORGANIZED_TABLE/sxml:SEGMENT_ATTRIBUTES"/>
</xsl:call-template>
<xsl:apply-templates select="$ParentNode/sxml:COLUMN_PROPERTIES"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="RenPartName">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="PartType" select="''"/>
<xsl:param name="PartName" select="''"/>
<xsl:param name="ObjType" select="'TABLE'"/>
<!-- *******************************************************************
Template: RenPartName
Parameters:
ParentNode - Parent node of SCHEMA, NAME
******************************************************************** -->
<xsl:if test="$PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_COLUMN_ATTRIBUTE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1">
<xsl:variable name="Value1Val">
<xsl:choose>
<xsl:when test="$PartType='SUBPARTITION'">RENAME_SUBPARTITION</xsl:when>
<xsl:when test="$PartType='PARTITION'">RENAME_PARTITION</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER </xsl:text>
<xsl:value-of select="$ObjType"/>
<xsl:text> </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> RENAME </xsl:text>
<xsl:choose>
<xsl:when test="$PartType='SUBPARTITION'">
<xsl:text>SUBPARTITION </xsl:text>
</xsl:when>
<xsl:when test="$PartType='PARTITION'">
<xsl:text>PARTITION </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="$ParentNode/sxml:NAME/@value1"/>
</xsl:call-template>
<xsl:text> TO </xsl:text>
<xsl:call-template name="QuotedName">
<xsl:with-param name="NameNode" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="AlterIntervalPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<!-- *******************************************************************
Template: AlterIntervalPartitioning
ParentNode sxml:RANGE_PARTITIONING or sxml:RANGE_SUBPARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
******************************************************************** -->
<xsl:if test="$ParentNode/sxml:INTERVAL">
<xsl:choose>
<xsl:when test="$ParentNode/sxml:INTERVAL/@src">
<!-- interval to/from range -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="EnableDisableIntervalPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="EnableDisableIntervalPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$ParentNode/sxml:INTERVAL/@value1 or
$ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM/@value1">
<!-- modify interval or tablespace storage list -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="ModifyIntervalPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModifyIntervalPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$ParentNode/sxml:STORE_IN/@src='1'">
<!-- delete tablespace storage list -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="DeleteIntervalPartitioningTBSList">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="DeleteIntervalPartitioningTBSList">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="EnableDisableIntervalPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: EnableDisableIntervalPartitioning:
convert table between interval partitioned and range partitioned
ParentNode sxml:RANGE_PARTITIONING or sxml:RANGE_SUBPARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:variable name="Value1Val">
<xsl:choose>
<xsl:when test="$SubPartFlag=0">ENABLE_DISABLE_INTERVAL_PARTITION</xsl:when>
<xsl:when test="$SubPartFlag=1">ENABLE_DISABLE_INTERVAL_SUBPARTITION</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET </xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text>SUBPARTITIONING </xsl:text>
</xsl:if>
<xsl:text>INTERVAL (</xsl:text>
<xsl:value-of select="$ParentNode/sxml:INTERVAL[@src='2']"/>
<xsl:text>)</xsl:text>
</xsl:element>
</xsl:element>
<xsl:if test="$ParentNode/sxml:INTERVAL[@src='2'] and
($ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM[@value1])">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:apply-templates select="$ParentNode/sxml:STORE_IN"/>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifyIntervalPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: ModifyIntervalPartitioning
ParentNode sxml:RANGE_PARTITIONING or sxml:RANGE_SUBPARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:variable name="Value1Val">
<xsl:choose>
<xsl:when test="$SubPartFlag=0">MODIFY_INTERVAL_PARTITION</xsl:when>
<xsl:when test="$SubPartFlag=1">MODIFY_INTERVAL_SUBPARTITION</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<!-- Interval is changing. Need to first drop the interval,
then add the new interval -->
<xsl:if test="$ParentNode/sxml:INTERVAL/@value1">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:text> INTERVAL ()</xsl:text>
</xsl:element>
</xsl:element>
<!-- Now add the new interval-->
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:apply-templates select="$ParentNode/sxml:INTERVAL"/>
</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="$ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM[@value1]">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:apply-templates select="$ParentNode/sxml:STORE_IN"/>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="DeleteIntervalPartitioningTBSList">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: DeleteIntervalPartitioningTBSList
ParentNode sxml:RANGE_PARTITIONING or sxml:RANGE_SUBPARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1">DELETE_TABLESPACE_LIST</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<!-- bug 6890349: to delete the tablespace list, have to turn off
interval partitioning, then turn it on again without the list -->
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:text> INTERVAL ()</xsl:text>
</xsl:element>
</xsl:element>
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text> SUBPARTITIONING</xsl:text>
</xsl:if>
<xsl:apply-templates select="$ParentNode/sxml:INTERVAL"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="AlterListPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<!-- *******************************************************************
Template: AlterListPartitioning
ParentNode sxml:LIST_PARTITIONING or sxml:LIST_SUBPARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
******************************************************************** -->
<!-- we have AUTOMATIC on one or both sides. -->
<xsl:if test="$ParentNode/sxml:AUTOMATIC">
<xsl:choose>
<!-- need to swap settings when different -->
<xsl:when test="$ParentNode/sxml:AUTOMATIC/@src">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="EnableDisableAutomaticListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="EnableDisableAutomaticListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="SubPartFlag" select="$SubPartFlag"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<!-- update the STORE IN options. Not supported for subpartitions -->
<xsl:when test="$SubPartFlag=0 and
($ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM/@value1)">
<!-- modify tablespace storage list -->
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="ModifyStoreInListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ModifyStoreInListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
<!-- If going from AUTOMATIC to MANUAL, then drop the STORE IN clause,
for partitions only. -->
<xsl:when test="$SubPartFlag=0 and
$ParentNode/sxml:STORE_IN/@src='1'">
<xsl:element name="ALTER_LIST_ITEM">
<xsl:call-template name="DeleteStoreInListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="Action">PARSE</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="DeleteStoreInListPartitioning">
<xsl:with-param name="ParentNode" select="$ParentNode"/>
<xsl:with-param name="TableNode" select="$TableNode"/>
<xsl:with-param name="Action">SQL</xsl:with-param>
</xsl:call-template>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="EnableDisableAutomaticListPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="SubPartFlag">0</xsl:param>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: EnableDisableAutomaticListPartitioning:
convert table between automatic and manual list partitioning
ParentNode sxml:LIST_PARTITIONING
TableNode sxml:TABLE
SubPartFlag 0 for PARTITIONs, 1 for SUBPARTITIONs
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:variable name="Value1Val">
<xsl:choose>
<xsl:when test="$SubPartFlag=0">ENABLE_DISABLE_AUTOMATIC_LIST_PARTITION</xsl:when>
<xsl:when test="$SubPartFlag=1">ENABLE_DISABLE_AUTOMATIC_LIST_SUBPARTITION</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET </xsl:text>
<xsl:if test="$SubPartFlag=1">
<xsl:text>SUB</xsl:text>
</xsl:if>
<xsl:text>PARTITIONING </xsl:text>
<xsl:choose>
<xsl:when test="$ParentNode/sxml:AUTOMATIC/@src='2'">
<xsl:text>AUTOMATIC</xsl:text>
</xsl:when>
<xsl:when test="$ParentNode/sxml:AUTOMATIC/@src='1'">
<xsl:text>MANUAL</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:element>
</xsl:element>
<xsl:if test="$SubPartFlag=0 and $ParentNode/sxml:AUTOMATIC/@src='2' and
($ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM[@value1])">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:apply-templates select="$ParentNode/sxml:STORE_IN"/>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="ModifyStoreInListPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: ModifyStoreInListPartitioning
ParentNode sxml:LIST_PARTITIONING
TableNode sxml:TABLE
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:variable name="Value1Val">MODIFY_STORE_IN_LIST_PARTITION</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<xsl:if test="$ParentNode/sxml:STORE_IN/@src='2' or
$ParentNode/sxml:STORE_IN/sxml:STORE_IN_ITEM[@value1]">
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET</xsl:text>
<xsl:apply-templates select="$ParentNode/sxml:STORE_IN"/>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="DeleteStoreInListPartitioning">
<xsl:param name="ParentNode" select="''"/>
<xsl:param name="TableNode" select="''"/>
<xsl:param name="Action" select="''"/>
<!-- *******************************************************************
Template: DeleteStoreInListPartitioning
ParentNode sxml:LIST_PARTITIONING
TableNode sxml:TABLE
Action PARSE or SQL
******************************************************************** -->
<xsl:choose>
<xsl:when test="$Action='PARSE' and ($PRS_NAME=1 or
$PRS_CLAUSE_TYPE=1 or
$PRS_ALTERABLE=1 or
$PRS_XPATH=1)">
<xsl:variable name="Value1Val">DELETE_STORE_IN_LIST_PARTITION</xsl:variable>
<xsl:element name="PARSE_LIST">
<xsl:call-template name="AddXPathParseItem">
<xsl:with-param name="Node" select="$ParentNode"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_NAME"/>
<xsl:with-param name="Item">NAME</xsl:with-param>
<xsl:with-param name="Value1" select="$ParentNode/sxml:NAME"/>
</xsl:call-template>
<xsl:call-template name="AddParseItem">
<xsl:with-param name="ParseIt" select="$PRS_CLAUSE_TYPE"/>
<xsl:with-param name="Item">CLAUSE_TYPE</xsl:with-param>
<xsl:with-param name="Value1" select="$Value1Val"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:when test="$Action='SQL'">
<xsl:element name="SQL_LIST">
<!-- bug 6890349: to delete the tablespace list, have to turn off
automatic list partitioning, then turn it on again without the list -->
<xsl:element name="SQL_LIST_ITEM">
<xsl:element name="TEXT">
<xsl:text>ALTER TABLE </xsl:text>
<xsl:call-template name="SchemaName">
<xsl:with-param name="ParentNode" select="$TableNode"/>
</xsl:call-template>
<xsl:text> SET STORE IN ()</xsl:text>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
OHA YOOOO