IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQLCODE = -16002 when using XMLEXISTS


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kadhir A

New User


Joined: 25 Jun 2020
Posts: 3
Location: United Kingdom

PostPosted: Thu Aug 26, 2021 7:47 pm
Reply with quote

Hi, I get a SQLCODE = -16002 error for the below query

Code:
---------+---------+---------+---------+---------+---------+---------+---------+
 SELECT XMLQUERY(                                                     
'//Element1'                                                                   
PASSING XML_Column)                                                   
FROM Qualifier.XML_table                                                 
 WHERE XMLEXISTS ('//Element1[@Attribute1="value1"]'           
                                   passing XML_Column )                 
and  XML_TYP = 'O'                                                     
and TRN_TS between '2021-05-26-09.01.01.000001'                       
and '2021-05-26-10.01.01.000001'                                       
with ur ;                                                             
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -16002, ERROR:  AN XQUERY EXPRESSION HAS AN UNEXPECTED
         TOKEN [ FOLLOWING Element1. EXPECTED TOKENS MAY INCLUDE: ( $ /
         // castable union ] * div idiv mod to + - eq ne. ERROR QNAME=err:XPST-
         0003
DSNT418I SQLSTATE   = 10505 SQLSTATE RETURN CODE
DSNT415I SQLERRP    = DSNXQPRS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD    = -300 0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD    = X'FFFFFED4'  X'00000000'  X'00000000'  X'FFFFFFFF'
         X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------+


I do not see anything wrong with the syntax unless I am overlooking something. An example is given in
https://www.ibm.com/docs/en/db2-for-zos/12?topic=predicates-xmlexists-predicate

I did a search in the forum and hit at https://ibmmainframes.com/about40332.html
but the replies did not help.

I would appreciate your observations on this.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 26, 2021 11:01 pm
Reply with quote

Square brackets are NOT standard EBCDIC characters and hence their implementation can vary depending upon the code page. The collating sequence X'BA' and X'BB' can be the square brackets but IBM's C compilers recognize X'AD' and X'BD' as the square brackets. It is possible that your DB2 is looking for the wrong characters to be the square brackets.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
No new posts Getting sqlcode 805 while executing R... DB2 10
No new posts SQLCODE -950 in PREPARE statement ... DB2 2
Search our Forums:

Back to Top