From: Peter Kroon [mailto:plakr...@gmail.com]
Sent: Thursday, November 29, 2012 11:01 AM
To: pgsql-general@postgresql.org
Subject: set value var via execute
Is it possible to set the value of a var via execute?
drop table if exists __test;
create unlogged table __test(
id int
);
DO $$
Go it:
execute 'select id from '||v_table||' order by random() limit 1'
into v_holder;
2012/11/29 Peter Kroon
> --begin this
> fails--
> v_holder = execute 'select id from '||v_table||' ord
Is it possible to set the value of a var via execute?
drop table if exists __test;
create unlogged table __test(
id int
);
DO $$
DECLARE
v_holder int;
v_table text = 'table';
v_record_0 text[];
v_id int;
BEGIN
execute '
insert into __test(id)
select id from '||v_table||' order by random() l