Subject Re: [firebird-support] Variable column in SELECT.
Author Soporte Solutec
I get the idea but i have an error trying to execute mystr: parsing error - mystr. (I think is telling to me it does not recognize mystr like something that can be execute).

Remember I am trying to do that into a store procedure. Let me know.

----- Original Message -----
From: Nick
To: firebird-support@yahoogroups.com
Sent: Saturday, June 24, 2006 5:11 PM
Subject: RE: [firebird-support] Variable column in SELECT.


No you can't. you can do

> declare variable mystr varchar(100);

campo = 'telefono';
mystr = "select " || campo || " from tabla into :valor"
execute mystr

NB syntax not checked but you get the idea, needs firebird 1.5 or higher

--
Nick
-----We Solve your Computer Problems---
UNIX, C, Panther, Ingres, Interbase, Firebird - Available Shortly

> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com] On Behalf Of fsorianop2006
> Sent: 24 June 2006 19:41
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Variable column in SELECT.
>
>
> Hi,
>
> Can I use a variable in a SELECT statement in a store procedure?
>
> for example:
>
>
> declare variable campo varchar(20);
> declare variable valor varchar(40);
> begin
> campo = 'telefono';
> select :campo from tabla into :valor;
>
> //expecting to have:
> // select telefono from tabla into :valor;
> end
>
> It is like the macrosubstitution in visual foxpro with the &
> character.
>
> Please let me know,
>
> Fernando Soriano
> soporte@...
>
>
>
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Check out the new improvements in Yahoo! Groups email.
> http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/67folB/TM
> ----------------------------------------------------------
> ------~->
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources
> item on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>





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