Kevin Ho
New User
Joined: 05 May 2009 Posts: 1 Location: San Francisco
|
|
|
|
Hi All,
I am trying to execute the following query and it return with -16002 SQLCODE regading there should not be a ']' after the compare argument. I have look up the syntax of XMLEXISTS in some of the website and all o them seem to use ] with no problem. Maybe there is something else I am missing when coding the query??
Code: |
SELECT * FROM EMPLOYEE
WHERE XMLEXISTS('$D/RESUME/PERSON[NAME = "KEVIN HO"]'
PASSING EMPLOYEE.EMP_CV AS "D") ---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -16002, ERROR: AN XQUERY EXPRESSION HAS AN UNEXPECTED
TOKEN ] FOLLOWING "KEVIN HO". EXPECTED TOKENS MAY INCLUDE: Ý / //
union | * div idiv mod to + - eq ne lt le gt ge = != < <=. ERROR
QNAME=err:XPST0003
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi Kevin,
Welcome to the FORUMS!
I tried something like this, it worked.
Code: |
select * from countries where
xmlexists('$EXTNAME/country/country_name/short[fn:starts-with(.,"Germany")]') |
Try something like this, might work:
Code: |
select * from employee
where xmlexists('$D/RESUME/PERSON[fn:starts-with(.,"KEVIN HO"]') |
I found a link of IBM very interesting one for trying out XML queries, this might help you.
Xquery
For other databases including DB2 you can use this
SQLzoo
Thank You,
Sushanth |
|