Subject RE: [firebird-support] Unsupported parameter into SQL expression
Author Svein Erling Tysvær
I guess the reason why this doesn't work is because the datatype of the parameter is unknown. Using CAST directly to the parameter doesn't seem to work with Firebird 1.5 - I assume this is due to not knowing which datatype to cast from(!), but with Firebird 1.5 (it might work on newer Firebird versions, that's just the version I have at hand currently), you should be able to do something like

select art_codice, quantita, prezzo, prezzo / 100 * coalesce(cast(null as Integer), :sconto)
from mmr

I started this reply before Mimmo sent his, but with Firebird 1.5

select rdb$relation_id, rdb$relation_id / 100.00 * cast(:sconto as Integer)
from rdb$database

does not work ('-804 Data type unknown' with DB Workbench 3.3.0). Maybe that has been fixed in newer Firebird versions.

HTH,
Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of masotti
Sent: 29. april 2009 09:44
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Unsupported parameter into SQL expression



Codebue Fabio - P-Soft ha scritto:
> When I try yo execute a statem like this
>
> select art_codice, QUANTITA, PREZZO,
> PREZZO / 100 * :sconto
> from mmr
>
It make sense, but try something like that

SELECT ART_CODICE, QUANTITA, PREZZO, PREZZO / 100. 00 * CAST ( :sconto )
AS INTEGER

and this is the workaround.
Other with better knowledge in inner workings can explain better than me
why it's so.

Ciao.
Mimmo.