i am getting this error when i am trying to do a query with xqj.
Exception in thread "main" javax.xml.xquery.XQException:
XQJQS001 - Invalid XQuery syntax, syntax does not pass static validation.
Root Cause:
XQueryParseException: Encountered "$" at line 1, column 36.
Was expecting one of:
"=" ...
"order" ...
public static void Consultar(XQConnection connexio) throws XQException { Scanner sc = new Scanner(System.in);
System.out.println(">>>>Please select a mminim stock :)");
int selec = sc.nextInt();
String squery = "for $prod in /productos/produc"
+ "for $zone in $prod/cod_zona"
+ "let $stock :=$prod/stock_minimo"
+ "let $deno :=$prod/denominacion"
+ "let $codi_prod :=$prod/cod_prod"
+ "let $cod:=/zonas/zona[cod_zona = $zone]/cod_zona"
+ "let $nomzona:=/zonas/zona[cod_zona = $zone]/nombre"
+ "let $direc:=/zonas/zona[cod_zona = $zone]/director"
+ "where $prod/$stock < " + selec + ""
+ "return concat('Denominacio:',$deno,'
' ,"
+ "'Codi producte:',$codi_prod,'
' ,"
+ "'Stock mínim:',$stock,'
' ,"
+ "'Codi zona:',$cod,'
' ,"
+ " 'Nom zona:',$nomzona),'
'";
XQPreparedExpression consulta = connexio.prepareExpression(squery);
XQResultSequence resultat = consulta.executeQuery();
while (resultat.next()) {
System.out.println(resultat.getItemAsString(null));
System.out
.println("...................................................................");
}
connexio.close();
}
Same help .thanks.
The string concatenation expression
will produce the string
You need to add some kind of whitespace between
producandfor, within one of the string literals either side of the+, e.g.: