Subject | COALESCE with parameters gives unexpected errors message. |
---|---|
Author | Mimmo |
Post date | 2004-08-25T19:46:50Z |
Hi, all.
I'm converting a DLL made for SYBASE to Firebird.
Now I'm doing that with IBPP, because the ODBC interfaces I adopted are
someway troublesome.
This simple statement worked ok with ODBC interfaces:
SELECT FIELD_1, FIELD_2, FIELD_3, FIELD_4
FROM TABLE_1
WHERE ( FIELD_2 LIKE COALESCE ( ?, '' ) || '%' ) AND (FIELD_4 <> 'P')
Now results in "feature not supported" error with IBPP and has a
different error message with IBEXPERT (last release).
With IBEXPERT when the parameter is NULL there is no error, viceversa
giving the parameter any not null value IBEXPERT complain with a
"...truncation or transliteration error" (SERVER 1.5.1 charset NONE).
OK: maybe COALESCE is not well understood by interfaces in WHERE clause.
Then I created a NEW blank database, charset NONE, and tested
SELECT COALESCE ( ?, '' ) || '%' FROM RDB$DATABASE
As expected if the parameter is null, statement works, otherwise gives
error.
IBEXPERT and IBPP may be both wrong with COALESCE? (It make no sense to
me and maybe doesn't care a lot to fb support list, ok).
I can solve with a work-around (stored proc).
Any hints meanwhile?
TIA to all.
Ciao.
Mimmo.
I'm converting a DLL made for SYBASE to Firebird.
Now I'm doing that with IBPP, because the ODBC interfaces I adopted are
someway troublesome.
This simple statement worked ok with ODBC interfaces:
SELECT FIELD_1, FIELD_2, FIELD_3, FIELD_4
FROM TABLE_1
WHERE ( FIELD_2 LIKE COALESCE ( ?, '' ) || '%' ) AND (FIELD_4 <> 'P')
Now results in "feature not supported" error with IBPP and has a
different error message with IBEXPERT (last release).
With IBEXPERT when the parameter is NULL there is no error, viceversa
giving the parameter any not null value IBEXPERT complain with a
"...truncation or transliteration error" (SERVER 1.5.1 charset NONE).
OK: maybe COALESCE is not well understood by interfaces in WHERE clause.
Then I created a NEW blank database, charset NONE, and tested
SELECT COALESCE ( ?, '' ) || '%' FROM RDB$DATABASE
As expected if the parameter is null, statement works, otherwise gives
error.
IBEXPERT and IBPP may be both wrong with COALESCE? (It make no sense to
me and maybe doesn't care a lot to fb support list, ok).
I can solve with a work-around (stored proc).
Any hints meanwhile?
TIA to all.
Ciao.
Mimmo.