Coniglio Sgabbiato <nobody (AT) nowhere (DOT) it> wrote:
Quote:
Hi, I am trying to execute a select into statement inside a sp, if I
test it as plain sql command it works well, when I try to create the sp
with this command inside it gives me an error, is there a workaround? |
Works for me, as a plain select into and as a execute 'sql' into:
test=# create or replace function select_into_test() returns int as $$declare r int; begin select into r 1; return r; end; $$language plpgsql;
CREATE FUNCTION
Zeit: 228,802 ms
test=*# select * from select_into_test();
select_into_test
------------------
1
(1 Zeile)
Zeit: 0,984 ms
test=*# rollback;
ROLLBACK
Zeit: 0,246 ms
test=# create or replace function select_into_test() returns int as $$declare r int; begin execute 'select 1' into r; return r; end; $$language plpgsql;
CREATE FUNCTION
Zeit: 0,397 ms
test=*# select * from select_into_test();
select_into_test
------------------
1
(1 Zeile)
Please, show us your function and tell us your pg-version.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°