hi,
say I have the following (simplified for discussion) pl/pgsql function:
FUNCTION myfunction ( ...) RETURNS TABLE ( elem1 integer, elem2 text, ...)
DECLARE
g RECORD
BEGIN
FOR g in SELECT colum1, column2 FROM someTable
LOOP
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
(sorry my previous email was truncated)
hi,
Here is what I want to do :
I want to check each row of a table against some conditions (this
check needs some
processing stuff I can easily code with pl/pgsql).
If the row is OK, I want to add it in a "resulting table",
else I just ignore the current
sql.).
cheers
Tom
2012/4/18 Pavel Stehule :
> Hello
>
> please try:
>
> postgres=# create or replace function foo()
> returns void as $$
> declare r x;
> begin
> for r in select * from x
> loop
> insert into y values(r.*);
> end loop;
> end;
> $$ langua
;
END;
I don't know if %rowtype is actually needed. I found this in here :
http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions
thanks again
Tom
2012/4/19 Pavel Stehule :
> 2012/4/19 thomas veymont :
>> hi Pavel,
>>
>> thanks for yo