Subject AW: [firebird-support] execute statement and in(variable)
Author Olaf Kluge
Hello,



I’ve a little problem with this:



CREATE PROCEDURE P_TEST(

INPUTPARAM1 varchar(50))

returns(

menge double precision)



AS /**/

declare variable statement1 varchar(100);

BEGIN

statement1 = 'Select Menge from auftraege where auftrag_pos in('||
inputparam1 || ')';





for execute statement :statement1 into :menge do suspend;



END



The result is: Precompiler Error: parsing error - execute.



Any ideas?



Thank you.





Mit freundlichen Grüßen/with best regards

SATRON Sachsen
Steuerungstechnik GmbH

Olaf Kluge

Fon +49 (0) 37 25/ 35 06-31
Fax +49 (0) 37 25/ 35 06-12
Mob +49 (0) 1 70/ 92 92 375
E-Mail: <mailto:olaf.kluge@...> olaf.kluge@...

...........................................................................

SATRON Sachsen Steuerungstechnik GmbH
Geschäftsführer: Bernd Grötzschel, Gerd Kaden
Sitz: D-09405 Zschopau, Johann-Gottlob-Pfaff-Straße 7
Amtsgericht: Chemnitz HRB 1218

Diese E-Mail ist vertraulich und beabsichtigt einzig zum Gebrauch der
Person, an die sie adressiert ist.
Wenn Sie nicht der Empfänger sind, nehmen Sie zur Kenntnis, dass Sie diese
E-Mail in Fehler und jeder Verwendung erhalten haben,
Verbreitung, Weiterleitung, Drucken oder Kopieren dieser E-Mail wird strikt
verboten.





_____

Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Im Auftrag von Martijn Tonies
Gesendet: Donnerstag, 16. Oktober 2008 09:35
An: firebird-support@yahoogroups.com
Betreff: Re: [firebird-support] execute statement and in(variable)



Hello Olaf,

> The follow code doesn't work:

Any message?

> Declare statement1 as string;
>
> Statement1 = "select abc from tabc where x =" || :inputparameter || " into
> :iabc "

You cannot have the INTO clause inside this string.

> For Execute statement :statement1

INTO :iabc

> Do begin
> .
> end
>
> When I take the "for" into the statement-string, it doesn't work too.

Of course not.

> The reason for this statement is an input parameter (string) with a list.
> (100, 200, 300). This is also my second question:
>
> The in(..) statement doesn't work,

How "doesn't" it work?

>if I delivered an internal variable so
> for example:
>
> For select a from abc where b in (:inputparametervariable). But this works
> fine: For select a from abc where b in (100, 200, 300).

Corrent, IN ( ... ) cannot work with a variable cause a variable is a single
value,
not a text string. With [FOR] EXECUTE STATEMENT this should work fine.

> Please, can you give me a tip? The question 1 is described in the
> firebird-documentation, but it doesn't work.

Read the syntax again ;-)

>I don't like to set more
> input-parameters for my procedure, therefore this stringlist.

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene. <http://www.upscene.com> com
My thoughts:
http://blog. <http://blog.upscene.com/martijn/> upscene.com/martijn/
Database development questions? Check the forum!
http://www.database <http://www.databasedevelopmentforum.com>
developmentforum.com



No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.173 / Virus Database: 270.8.1/1727 - Release Date: 15.10.2008
20:02




[Non-text portions of this message have been removed]