Noob Doob
Noob Doob

Reputation: 1907

EXECUTE INTO in plpgsql

I want to execute the following:

EXECUTE 'SELECT ' || row_name || ' INTO row_value FROM user_data.data WHERE id = ' || tid || ';';  

row_name, row_value and tid are variables of the plpgsql function. My concern is, whether the selected value will be passed to the row_value variable or not.

Upvotes: 0

Views: 971

Answers (1)

klin
klin

Reputation: 121534

Try it yourself! Your function raises

ERROR:  EXECUTE of SELECT ... INTO is not implemented
HINT:  You might want to use EXECUTE ... INTO or EXECUTE CREATE TABLE ... AS instead.

and all is clear.

Upvotes: 1

Related Questions