db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Kam" <moonblade.w...@gmail.com>
Subject Portability issue for 'Like-clause' on non-string types ?
Date Thu, 26 Jun 2008 04:42:52 GMT
Hello again Apache Derby,

I'm currently porting my little webapp from using mysql to apache derby.
One of the issue i'm having right now is the like clause being used for
non-string types.
I tried the ij, issuing simple sql statement like :

ij> select sc.id from sms_command sc where sc.id like '%';
ERROR 42884: No authorized routine named 'LIKE' of type 'FUNCTION' having
compatible arguments was found.

But it works fine for the string type :
ij> select sc.id, sc.dbpool_name from sms_command sc where sc.dbpool_name
like 'd%';
ID         |DBPOOL_NAME
---------------------------
6          |demo
14         |demo
21         |demo
23         |test

I tried describe the table, and here's the output :
ij> describe sms_command;
COLUMN_NAME
|TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
------------------------------------------------------------------------------
ID                                |INTEGER  |0   |10  |10    |NULL
|NULL      |NO
DBPOOL_NAME         |VARCHAR  |NULL|NULL|15    |NULL      |30        |NO
....

I'm quite sure that there's no point in this case to use like-clause for an
integer typed column, but there are several cases that the like clause can
be useful for integer typed column, like when trying to find out an records
that contains such and such part of a number.

When using mysql, using like-clause on non-string types works in my proggie
prior to porting it to derby.

Anyway, is there a configuration that can be use to be 'friendly' for using
like-clause on non-string types ? Or perhaps anything else that i'm missing
out from the docs ? :)

Regards,
Albert Kam

-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

Mime
View raw message