Hi all,

I am experiencing the same problem as Bartek.
Using the numbers for binding the parameters does not solve it.
Is anyone else experiencing this?

(I am using 4.9.0)

Jasper.

From: Bartłomiej Niemienionek [mailto:[email protected]]
Sent: 23 November 2016 21:12
To: [email protected]
Subject: Re: Phoenix LIKE operator with bind parameters question/error


ATTENTION. This message originates from outside BAE Systems.

Hi

Aby other thoughts ideas to get Like operator working with bind parameters ?

Regards
Bartek

18.11.2016 22:20 "Bartłomiej Niemienionek" 
<[email protected]<mailto:[email protected]>> napisał(a):
Thank you for your answer but it seems that your solution is not working in my 
case.
As you can see in my example also :abs is workin fine when using "=" and it is 
not working with LIKE operator.
It seems like parameters passed to LIKE operator are treated in a bit different 
way.

I am using DBeaver to test my queries and when I am using this notation 
:<number> (:1) or wirh parameter name (:abc) query is transleted to use "?" 
sign for bind parameters.


Regards,
Bartek

2016-11-18 17:09 GMT+01:00 James Taylor 
<[email protected]<mailto:[email protected]>>:
Use :<number> instead, like this :1

Thanks,
James

On Fri, Nov 18, 2016 at 5:28 AM Bartłomiej Niemienionek 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

I am trying to use Phoenix and I am facing some problems with LIKE operator 
when used in the prepared statement with bind parameters.
I don’t know if this is some kind of known issue.

CREATE TABLE TEST_TABLE (
       NAME VARCHAR(100) NOT NULL PRIMARY KEY,
       VAL VARCHAR(100)
    );

These are working fine:
SELECT 1 FROM TEST_TABLE WHERE NAME = :abc;
SELECT 1 FROM TEST_TABLE WHERE NAME = 'abc';
SELECT 1 FROM TEST_TABLE WHERE NAME LIKE 'abc';

Here I get error:
SELECT 1 FROM TEST_TABLE WHERE NAME LIKE :abc;

SQL Error [00000]: Error -1 (00000) : while preparing SQL: SELECT 1 FROM 
TEST_TABLE WHERE NAME LIKE ?
  org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : while 
preparing SQL: SELECT 1 FROM TEST_TABLE WHERE NAME LIKE ?

I am using phoenix driver in 4.9.0 version.

Regards,
bjn

Please consider the environment before printing this email. This message should 
be regarded as confidential. If you have received this email in error please 
notify the sender and destroy it immediately. Statements of intent shall only 
become binding when confirmed in hard copy by an authorised signatory. The 
contents of this email may relate to dealings with other companies under the 
control of BAE Systems Applied Intelligence Limited, details of which can be 
found at http://www.baesystems.com/Businesses/index.htm.

Reply via email to