Results 1 to 13 of 13

Thread: Xmlvalidate

  1. #1
    Join Date
    Sep 2011
    Posts
    26

    Unanswered: Xmlvalidate

    Hi

    when i am trying to run XMLVALIDATE function while inserting a XML row, i am getting
    SQL0440N No authorized routine named "XMLVALIDATE" of type "FUNCTION" having
    compatible arguments was found. SQLSTATE=42884

    my db2 version is 9.7 , is there any extender needed for XML functions ? or it should come with 9.7?

    Thanks
    Jumsheed

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I think your problem is described by this part of the error message: "having compatible arguments"

  3. #3
    Join Date
    Sep 2011
    Posts
    26
    Thanks, does that mean arguements are not correct or that Function not found ?

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Please publish the definition of your XMLVALIDATE function, at least it's parameters/arguments difinisions
    and how did you invoked(or called) the function.

    Because, the error message(which was provided by you) said ...
    "... No authorized routine named "XMLVALIDATE" of type "FUNCTION" having compatible arguments ..."

  5. #5
    Join Date
    Sep 2011
    Posts
    26
    I am talking about db2 bulit in function XMLVALIDATE
    IBM DB2 9.7 Information Center for Linux, UNIX, and Windows

  6. #6
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    How did you called/invoked the XMLVALIDATE function?
    Please copy/paste the query from which you recieved the SQL0440N messsage.

    Is the parameter really XML-expression?

    XMLVALIDATE - IBM DB2 9.7 for Linux, UNIX, and Windows
    Code:
                       .-DOCUMENT-.                                                                
    >>-XMLVALIDATE--(--+----------+--XML-expression--+--------------------------------------+--)-><
                                                     '-| XML-validate-according-to-clause |-'      
    
    XML-validate-according-to-clause
    
    |--ACCORDING TO XMLSCHEMA--+-ID--XML-schema-name-----------------------+-->
                               '-+-URI--XML-uri1-+--+--------------------+-'   
                                 '-NO NAMESPACE--'  '-LOCATION--XML-uri2-'     
    
    >--+------------------------------+-----------------------------|
       '-| XML-valid-element-clause |-'   
    
    XML-valid-element-clause
    
    |--+---------------------+--ELEMENT--XML-element-name-----------|
       +-NAMESPACE--XML-uri3-+                              
       '-NO NAMESPACE--------'

  7. #7
    Join Date
    Sep 2011
    Posts
    26
    INSERT INTO MP_ATTEST_REC_TB VALUES ('1000078630',1,'2012-05-08 09:39:50', XMLVALIDATE ('<customerinfo xmlns="http://posample.org" Cid="1000"> <name>Kathy Smith</name> <addr country="Canada"> <street>5 Rosewood</street> <city>Toronto</city> <prov-state>Ontario</prov-state> <pcode-zip>M6W 1E6</pcode-zip> </addr> <phone type="work">416-555-1358</phone> </customerinfo>'ACCORDING TO XMLSCHEMA ID MISADEV.EHRATTESTDATA ))
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0440N No authorized routine named "XMLVALIDATE" of type "FUNCTION" having
    compatible arguments was found. SQLSTATE=42884


    db2 "describe table MP_ATTEST_REC_TB "

    Data type Column
    Column name schema Data type name Length Scale Nulls
    ------------------------------- --------- ------------------- ---------- ----- ------
    NLR_REG_NUM SYSIBM CHARACTER 10 0 No
    PMT_YR_NUM SYSIBM SMALLINT 2 0 No
    ATTEST_DT SYSIBM TIMESTAMP 7 0 No
    ATTEST_DATA_XML SYSIBM XML 0 0 Yes

  8. #8
    Join Date
    Sep 2011
    Posts
    26
    I can insert without XMLVALIDATE function

    INSERT INTO MP_ATTEST_REC_TB VALUES ('1000078632',1,'2012-05-08 09:39:50', '<customerinfo xmlns="http://posample.org" Cid="1000"> <name>Kathy Smith</name> <addr country="Canada"> <street>5 Rosewood</street> <city>Toronto</city> <prov-state>Ontario</prov-state> <pcode-zip>M6W 1E6</pcode-zip> </addr> <phone type="work">416-555-1358</phone> </customerinfo>')
    DB20000I The SQL command completed successfully.

  9. #9
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    '<customerinfo xmlns="http://posample.org" Cid="1000"> <name>Kathy Smith</name> <addr country="Canada"> <street>5 Rosewood</street> <city>Toronto</city> <prov-state>Ontario</prov-state> <pcode-zip>M6W 1E6</pcode-zip> </addr> <phone type="work">416-555-1358</phone> </customerinfo>'
    This is not an XML-expression, even if the format looks like XML ducuments.
    It is a (simple) string expression.

    Please see Information Center.
    XML values - IBM DB2 9.7 for Linux, UNIX, and Windows
    XML values

    An XML value represents well-formed XML in the form of an XML document, XML content, or a sequence of XML nodes. An XML value that is stored in a table as a value of a column defined with the XML data type must be a well-formed XML document. XML values are processed in an internal representation that is not comparable to any string value. An XML value can be transformed into a serialized string value representing the XML document using the XMLSERIALIZE function. Similarly, a string value that represents an XML document can be transformed into an XML value using the XMLPARSE function. An XML value can be implicitly parsed or serialized when exchanged with application string and binary data types.

  10. #10
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I guessed that Note 4 in Table 1 might be applied in your INSERT statement without XMLVALIDATE.

    Casting between data types - IBM DB2 9.7 for Linux, UNIX, and Windows
    Notes
    ...
    ...

    4 An XMLPARSE function is implicitly processed to convert a string to XML on assignment (INSERT or UPDATE) of a string to an XML column. The string must be a well-formed XML document for the assignment to succeed.

    ...
    ...

  11. #11
    Join Date
    Sep 2011
    Posts
    26
    I can insert without XMLVALIDATE function

    INSERT INTO MP_ATTEST_REC_TB VALUES ('1000078632',1,'2012-05-08 09:39:50', '<customerinfo xmlns="http://posample.org" Cid="1000"> <name>Kathy Smith</name> <addr country="Canada"> <street>5 Rosewood</street> <city>Toronto</city> <prov-state>Ontario</prov-state> <pcode-zip>M6W 1E6</pcode-zip> </addr> <phone type="work">416-555-1358</phone> </customerinfo>')
    DB20000I The SQL command completed successfully.

  12. #12
    Join Date
    Sep 2011
    Posts
    26
    Thanks tonkuma , now it worked

    INSERT INTO MP_ATTEST_REC_TB VALUES ('1000078655',1,'2012-05-08 09:39:50', XMLVALIDATE (XMLPARSE (DOCUMENT '<customerinfo xmlns="http://posample.org" Cid="1000"> <name>Kathy Smith</name> <addr country="Canada"> <street>5 Rosewood</street> <city>Toronto</city> <prov-state>Ontario</prov-state> <pcode-zip>M6W 1E6</pcode-zip> </addr> <phone type="work">416-555-1358</phone> )</customerinfo>' )ACCORDING TO XMLSCHEMA ID MISADEV.EHRATTESTDATA ))
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL16196N XML document contains an element "customerinfo" that is not
    correctly specified. Reason code = "37" SQLSTATE=2200M

  13. #13
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    SQL16196N XML document contains an element "customerinfo" that is not
    correctly specified. Reason code = "37" SQLSTATE=2200M
    It might be better to review MISADEV.EHRATTESTDATA.

    SQL16196N

    SQL16196N

    XML document contains an element element-name that is not correctly specified. Reason code = reason-code

    Explanation

    While parsing an XML document the parser encountered an error with an element named element-name. Possible reasons given by reason-code are:

    ...
    ...

    37
    The element is not defined.

    ...

    User response

    Correct the XML document and try the operation again.
    Retrieving all components of an XML schema registered with the XSR - IBM DB2 9.7 for Linux, UNIX, and Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •