pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mario Alberto Soto Cordones <mario_soto@compuall.cl>
To: rlucas@tercent.net
Cc: pgsql-sql@postgresql.org
Subject: Re: PROBLEM WITH FUNCTIONS
Date: Mon, 21 Apr 2003 17:58:38 -0400 (CLT)
Message-ID: <1888.192.168.1.100.1050962318.squirrel@www.compuall.cl> (raw)
In-Reply-To: <B9FA6AB3-7442-11D7-9BCD-000A957653D6@tercent.net>
References: <1848.192.168.1.100.1050961085.squirrel@www.compuall.cl>
	<B9FA6AB3-7442-11D7-9BCD-000A957653D6@tercent.net>

Thank Randall

this  select * from get_unidades(10, 1, 15, 17);

work very good

thank, very much

Muchas, Muchas gracias
un gran saludo desde chile

Mario

> Mario,
>
> If your function returns a record, you have to treat it like it's a
> relation (table).  So you don't select it, you select from it.
>
> Try:
>
> select * from get_unidades(10, 1, 15, 17);
>
> Also you may have to give it an explicit variable list such as:
>
> select * from get_unidades(10,1,15,17) as (codigo numeric(3,0),
> descripcion text);
>
> Best,
>
> Randall
>
> On Monday, April 21, 2003, at 05:38 PM, Mario Alberto Soto Cordones
> wrote:
>
>> Hi.
>>
>> i have a problem with a function.
>>
>> i create a type unidades
>>    CREATE TYPE unidades AS (codigo numeric(3,0),
>>                             descripcion text);
>>
>> and i create a function get_unidades
>>     CREATE FUNCTION get_unidades(int4, int4, int4, int4) RETURNS
>> typeof
>> unidades AS '
>> SELECT cucoduni, cudesuni
>> FROM cumauni
>> WHERE cuempuni = $1 and
>>       cuseduni = $2 and
>>       cucaruni = $3 and
>>       cuasiuni= $4
>> ; '  LANGUAGE 'sql';
>>
>> and at this moment´s it´s all ok BUT when execute this function
>>      select get_unidades(10,1,15,17)
>>
>> say
>>      "cannot display a value of type RECORD"
>>
>> any idea, PLEASE HELP MY
>>
>> saludos
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 4: Don't 'kill -9' the postmaster
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


-- 
   Mario Soto Cordones
  Gerente de Proyectos
 Compuall Ingeniería Ltda.




view thread (6+ messages)  latest in thread

Message-ID: <1888.192.168.1.100.1050962318.squirrel@www.compuall.cl>
Permalink:  ../1888.192.168.1.100.1050962318.squirrel@www.compuall.cl/
Also on:    postgresql.org/message-id/1888.192.168.1.100.1050962318.squirrel@www.compuall.cl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mario_soto@compuall.cl, rlucas@tercent.net
  Subject: Re: PROBLEM WITH FUNCTIONS
  In-Reply-To: <1888.192.168.1.100.1050962318.squirrel@www.compuall.cl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox