How to create my own result set?

Started by Ismael ....over 17 years ago2 messagesgeneral
Jump to latest
#1Ismael ....
ismaelpsp@hotmail.com

Hi there,
I'm making a really weird stored procedure which makes use of about 5 tables...
and I need to create my own result set based on the computed result of various
FOR loops.

Does anyone knows how can I do that using PL/pgSQL?

I "think" I need to declare a couple of variables that accept APPENDING but I
don't know if that's possible.

Lets say for example:
CREATE OR REPLACE FUNCTION weirdFunction() RETURNS AS $$
DECLARE
column1 ;
column2 ;
BEGIN
--first row
column1.append('something');
column2.append('something');

--second row
column1.append('again');
column2.append('again');

END;
$$ LANGUAGE plpgsql;

So the result of that should be
something something
again again

Is it possible to do something like that?

Tanks in advance
_________________________________________________________________
Tenemos lo que búscas…JUEGOS.
http://club.prodigymsn.com/

#2Ismael ....
ismaelpsp@hotmail.com
In reply to: Ismael .... (#1)
Re: How to create my own result set?

I'll try with what says in the FAQ, but should someone know of a way
to declare a variable that allows appending please tell me

http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions

----------------------------------------

Hi there,
I'm making a really weird stored procedure which makes use of about 5 tables...
and I need to create my own result set based on the computed result of various
FOR loops.

Does anyone knows how can I do that using PL/pgSQL?

I "think" I need to declare a couple of variables that accept APPENDING but I
don't know if that's possible.

Lets say for example:
CREATE OR REPLACE FUNCTION weirdFunction() RETURNS AS $$
DECLARE
column1 ;
column2 ;
BEGIN
--first row
column1.append('something');
column2.append('something');

--second row
column1.append('again');
column2.append('again');

END;
$$ LANGUAGE plpgsql;

So the result of that should be
something something
again again

Is it possible to do something like that?

Tanks in advance

_________________________________________________________________
Plug&Play te trae en exclusiva los mejores conciertos de la red
http://club.prodigymsn.com/