Thread: Evaluate a variable

Evaluate a variable

From
Luís Sousa
Date:
Hi,

Is there anyway to evaluate a variable in plpgsql, like eval on PHP?
Suppose the example:

my_var:=''some value!'';
a:=''my_var'';
b:=<eval!!> a;

I already tried b:=EXECUTE a; without luck!

Best regards,
Luís Sousa



Re: Evaluate a variable

From
Alvaro Herrera
Date:
Luís Sousa wrote:
> Hi,
> 
> Is there anyway to evaluate a variable in plpgsql, like eval on PHP?
> Suppose the example:
> 
> my_var:=''some value!'';
> a:=''my_var'';
> b:=<eval!!> a;
> 
> I already tried b:=EXECUTE a; without luck!

Maybe stashing a SELECT in front?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.