Subject | Re: [firebird-support] exists(EXECUTE STATEMENT ... |
---|---|
Author | Helen Borrie |
Post date | 2004-08-13T09:01:26Z |
At 10:47 AM 13/08/2004 +0200, you wrote:
really does is that it executes the SELECT statement in its argument and
starts accumulating output rows. As it eliminates each row, it discards it
and moves on. It exits immediately with True if it finds one row. If it
doesn't find a row at all, it will keep going until the set is exhausted,
before returning False.
coding conventions are much more readable than double quotes and the
problems associated with them.
/heLen
>Hi Helen,Well, you could say that, in terms of what it returns. In fact, what it
>
> >>Hi,
> >>
> >> (Firebird 1.5.1 CS on Linux)
> >> in PSQL the following statement doesn't work:
> >>
> >> [...]
> >> "SQL" = 'SELECT "Id" FROM "SomeTable" WHERE "Fieldname" ='||
> >> "ParameterOfSP";
> >>
> >> IF (not exists(EXECUTE STATEMENT "SQL")) THEN
> >> [...]
> >>
> >>
> >> Did I make a syntax error
>
>HB> :-)
>
> >>or is this a missing feature of firebird?
>
>HB> EXECUTE STATEMENT is a PSQL statement syntax in its own right. You can't
>HB> use it as some sort of extended "variable" to substitute into syntax of a
>HB> DSQL statement (or any other statement at all).
>
>HB> On the other side of the coin, an EXISTS() predicate can not take any kind
>HB> of argument except a subquery.
>
>Ok.
>But would be a nice enchantment, wouldn't it?
>As EXISTS only Checks, whether there is a result or not it should be
>possible I think.
really does is that it executes the SELECT statement in its argument and
starts accumulating output rows. As it eliminates each row, it discards it
and moves on. It exits immediately with True if it finds one row. If it
doesn't find a row at all, it will keep going until the set is exhausted,
before returning False.
>[...]Saving on keystrokes and improving visual clarity isn't laziness...clean
>
>
>HB> Back to the drawing board? You'll find the description and examples
>in the
>HB> v.1.5 Release Notes.
>
>I've read them but there was nothing about Exists :-)
>
>I 've changed the query to a select count("Id")... INTO :"Counter"
>which perfectly works.
>
>
>HB> By the way, did you know that these infernal double quotes are not
>required?
>
>Yes, but I normally I use mixed case variables. They are better
>readable I think! But I know that many people are to lazy to enter
>this two chars....
coding conventions are much more readable than double quotes and the
problems associated with them.
/heLen