phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bartłomiej Niemienionek <b.niemienio...@gmail.com>
Subject Re: Phoenix LIKE operator with bind parameters question/error
Date Wed, 23 Nov 2016 20:12:30 GMT
Hi

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

Regards
Bartek

18.11.2016 22:20 "Bartłomiej Niemienionek" <b.niemienionek@gmail.com>
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 <jamestaylor@apache.org>:
>
>> Use :<number> instead, like this :1
>>
>> Thanks,
>> James
>>
>> On Fri, Nov 18, 2016 at 5:28 AM Bartłomiej Niemienionek <
>> b.niemienionek@gmail.com> 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
>>>
>>
>

Mime
View raw message