Query fatal error "no statement or prepared value"

n1ql
query

#1

Query
Prepare Select * From Test2 WHERE cariHesapKodu like "%127000%"
Other tried
Explain Select * From Test2 WHERE cariHesapKodu like “%127000%”

Index
Create Index Siparis On Test2(cariHesapKodu)

Result
{
“requestID”: “c2e1393b-78e1-4021-9834-719b70d68308”,
“errors”: [
{
“code”: 1050,
“msg”: “No statement or prepared value”
}
],
“status”: “fatal”,
“metrics”: {
“elapsedTime”: “0”,
“executionTime”: “0”,
“resultCount”: 0,
“resultSize”: 0,
“errorCount”: 1
}
}


#2

This is not directly related to your error. But FYI, a LIKE predicate cannot use an index effectively if the pattern begins with %.

Will use index effectively:

WHERE cariHesapKodu LIKE "127000%"

Will not use index effectively:

WHERE cariHesapKodu LIKE "%127000%"


#3

unfortunately it didn’t work


#4

Hi Zahid,
typically the query service returns a 1050 error when it cannot find a statement (or prepared) parameter in the REST request it has received.
Example of a correctly formed request:

Luigi:bin marcogreco$ curl “http://localhost:8093/query/service” -d “statement=select 1 from default limit 1”
{
“requestID”: “8217364c-65d3-440a-9765-7d52a801e11b”,
“signature”: {
"$1": “number”
},
“results”: [
{
"$1": 1
}
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “3.96016ms”,
“executionTime”: “3.926249ms”,
“resultCount”: 1,
“resultSize”: 31
}
}

By contrast:

Luigi:bin marcogreco$ curl “http://localhost:8093/query/service” -d “”
{
“requestID”: “25cf0dba-bbce-4ab5-abb7-5159245ebff8”,
“errors”: [
{
“code”: 1050,
“msg”: “No statement or prepared value”
}
],
“status”: “fatal”,
“metrics”: {
“elapsedTime”: “57.781µs”,
“executionTime”: “57.554µs”,
“resultCount”: 0,
“resultSize”: 0,
“errorCount”: 1
}
}

You get a similar error when either (or both) statement or prepared parameter is present, but is null.

It would be interesting to see the exact command you are using to send the request to the n1ql service: if you are using a shell, it could be that the star or the double quotes are playing a dirty trick on you, it could be that the engine is somehow misinterpreting your request.

HTH,
Marco