Subject Re: [firebird-support] COALESCE with parameters gives unexpected errors message.
Author Olivier Mascia
Bonjour Mimmo,

Le mercredi 25 août 2004 à 21:46:50, vous écriviez :

> 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?

Well, IBPP at least does not care at all if there is a COALESCE or
not. It takes what you give it and gives it in turn to whatever
server/engine you're connected to.

Could you show the complete error IBPP reports ?
Unless the error is something internal, specific to IBPP (few such
messages), the error message comes from the server/engine.

If this turns out to be closely linked to IBPP (which I'm not sure for
now), I'd be glad to answer more completely in the ibpp-discuss
mailing-list.

--
Cordialement,
Olivier Mascia