How to declare a variable?

Imagine you have variable names and values stored in arays:

declare var_names, var_values any;
var_names := vector('var1', 'var2', 'var3' );
var_values  := vector('1', '2', '3' );

How to declare variables using var_names and var_values from the arrays above ?

@MakeItWork

You can NOT declare variables dynamically in context of existing PL stored procedure, what you can do is to create dynamically another PL stored procedure, compile with exec() and then use it.

HTH

1 Like