Subject | Re: [firebird-support] Re: parameter for the IN statement in a stored procedure |
---|---|
Author | Helen Borrie |
Post date | 2005-01-26T10:48:47Z |
At 09:22 AM 26/01/2005 +0000, you wrote:
your sample would throw a syntax error first, because of the double
quotes). In SQL you have to be very focused on the implicit logic of your
requests.
variable. Although you can run a FOR EXECUTE STATEMENT loop, you can never
place a variable inside the EXECUTE STATEMENT string. Consider the
logic...always...
./heLen
>Wow, ok, but can this also be done with your code?No, that will throw a "multiple rows in singleton select" error (though
>
>1. Parse the inputstr varchar(50) variable
>
>2. Sum up the single arguements to the val variable, so the val
>variable will look like this: ("200","201","202")
>
>3. execute the statement with the IN statement like
>
>execute statement 'SELECT r1 FROM t1 WHERE x1 IN ' || val into :r;
your sample would throw a syntax error first, because of the double
quotes). In SQL you have to be very focused on the implicit logic of your
requests.
>I think I have some obsession with that IN statement :)Yes, it's not a good habit. :-)
>What do you think, will this work?No. It would necessitate a FOR SELECT loop that contained a
variable. Although you can run a FOR EXECUTE STATEMENT loop, you can never
place a variable inside the EXECUTE STATEMENT string. Consider the
logic...always...
./heLen