Subject Re: [firebird-support] Using a query parameter before a subquery
Author Nando Dessena
Set,

S> I agree that this is an error. I tried a few things that failed at
S> prepare time:

S> select count(*)
S> from rdb$database
S> where :x < (select count(*) from rdb$database)

S> select count(*)
S> from rdb$database
S> where cast(:x as Integer) < (select count(*) from rdb$database)

S> And a few things that prepared without problems:

S> select count(*)
S> from rdb$database
S> where (select count(*) from rdb$database) > :x

S> select count(*)
S> from rdb$database
S> where :x < cast((select count(*) from rdb$database) as integer)

S> I was very surprised to learn that explicitly casting a select count(*)
S> to integer made the statement prepare, and that's what convinced me that
S> it is a small error.

S> I tried this on Firebird 1.5.2, I think (it might have been 1.5.3). I
S> haven't yet tried it on Firebird 2.0.

apparently none of them work on Fb 2.

Ciao
--
Nando Dessena
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================