DB2V9.1 pureXML Creating Unique index with 2 attributes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rajesh Kumar Joshi

    DB2V9.1 pureXML Creating Unique index with 2 attributes

    I have a table with only 1 column as
    Table : profileTable
    //--------------
    profile XML;
    //--------------

    A sample content of XML file is
    <sampleprofil e name="joe" version="A123">
    <phone>12345678 9</phone>
    ...
    ...
    </sampleprofile>
    //------------------------------------

    How can we create a UNIQUE index which includes both the 'name' and
    'version' attributes?
    I was able to create following indexes:
    CREATE INDEX index1 ON profileTable(pr ofile) GENERATE KEY USING
    XMLPATTERN '/sampleprofile/@name' AS VARCHAR(16)
    CREATE INDEX index2 ON profileTable(pr ofile) GENERATE KEY USING
    XMLPATTERN '/sampleprofile/@version' AS VARCHAR(16)

    But although '/sampleprofile/@name | /sampleprofile/@version' is a
    valid PATH expression I was unable to create an index like
    CREATE UNIQUE INDEX index3 ON profileTable(pr ofile) GENERATE KEY
    USING XMLPATTERN 'sampleprofile/@name | /sampleprofile/@version' AS
    VARCHAR(32)

    Regards
    Rajesh





Working...