Re: inner join problem with temporary tables

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: guillermoariast(at)linuxwaves(dot)com
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, lists(at)peufeu(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: inner join problem with temporary tables
Date: 2007-06-14 08:30:03
Message-ID: 162867790706140130r2a929b0v2bc706bcdf711480@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2007/6/14, guillermo arias <guillermoariast(at)linuxwaves(dot)com>:
> could you please give me an example?.
> How could i make an inner join select with temporary tables?
>
> This function does not work:
>
> REATE OR REPLACE FUNCTION modelo.test2(OUT xart_cod character varying, OUT xart_descri character varying)
> RETURNS SETOF record AS
> $BODY$
> begin
> create temp table t_arti as (select art_cod,art_descri from modelo.articulos);
> select $1,$2 from t_arti ;
> end;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
>
>
> this is the error message:
>
> ERROR: query has no destination for result data
> SQL state: 42601
> Hint: If you want to discard the results of a SELECT, use PERFORM instead.
> Context: PL/pgSQL function "test2" line 4 at SQL statement
>
>

every select's output in plpgsql have to be redirected into variables.

http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW

regards
Pavel Stehule

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2007-06-14 08:34:09 strange change (and error) in 8.3 ?
Previous Message Albe Laurenz 2007-06-14 08:15:40 Re: Regular expressions in procs