Subject RE: [firebird-support] COALESCE with parameters (IBPP, IBEXPERT or Firebird?)
Author mimmo.masotti@tin.it
Hi, all.
I made some cut-and-paste errors; maybe this morning I'd be in-line with
brain.
Environment: Firebird 1.5.1 running in a Win2K virtual machine (VKware).
Original database with all char and varchar fields defined with charset
WIN_1252.

Original statement (working with various ODBC drivers):
>SELECT FIELD_1, FIELD_2, FIELD_3, FIELD_4
> FROM TABLE_1
> WHERE ( FIELD_2 LIKE COALESCE ( ?, '' ) || '%' )
> AND (FIELD_4 <> 'P')
>

When I do Statement.Prepare()
>... results in "feature not supported" error with IBPP.

Anyway, ASAP (maybe tomorrow), I'll control if Database charset connection
is really WIN_1252;
anyway then IBPP::Status.ErrorMessage() is not very precise (IMMHO).

The same statement in last version of IBEXPERT
>SELECT FIELD_1, FIELD_2, FIELD_3, FIELD_4
> FROM TABLE_1
> WHERE ( FIELD_2 LIKE COALESCE ( :pippo, '' ) || '%' )
> AND (FIELD_4 <> 'P')
>
(parameters are written differently ;-) )

> ... when the parameter is NULL, there is no error
...and result set is as expected...
> , viceversa <BR>
>giving the parameter any not null value IBEXPERT complain with a <BR>
>"...truncation or transliteration error"
><BR>

>OK: maybe COALESCE is not well understood by interfaces in WHERE clause.<BR>
>Then I created a NEW blank database, charset NONE, and tested<BR>
><BR>
>SELECT COALESCE ( :pippo, '' ) || '%' FROM RDB$DATABASE<BR>
><BR>
>As expected if the parameter is null, statement works, otherwise gives
the above<BR>
>error.<BR>

This demonstrates that IBEXPERT has a little glitch, but how I can really
test parameter passing in COALESCE to Firebird?

TIA to all.

Ciao.
Mimmo.