Re: plpgsql always returning null..

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Anand Raman <araman(at)india-today(dot)com>
Cc: postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql always returning null..
Date: 2001-02-02 17:37:08
Message-ID: Pine.BSF.4.21.0102020936310.21728-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I don't see this on my test on 7.1beta3, can you give the
table schema and some sample data?

On Fri, 2 Feb 2001, Anand Raman wrote:

> hi guys
> I am trying out a simple plpgsql function on 702
>
> drop function quantity_available(int4);
> CREATE FUNCTION quantity_available (int4) RETURNS INT4 AS '
> DECLARE
> totq int4;
> BEGIN
> select INTO totq cast(quantity as INT4) from inventory
> where exhibit_distribution_id=$1;
> return totq;
> END;'
> LANGUAGE 'plpgsql';
>
> select quantity_available(594);
>
> is always returning null even when there is correponding data
>
> arttoday=# select quantity from inventory where exhibit_distribution_id = 594;
> quantity
> ----------
> 1
> (1 row)
>
> Can some one please explain this anamoly..
>
> Thanks
> Anand
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-02-02 17:39:35 Re: Re: sintax???
Previous Message Gregory Wood 2001-02-02 17:26:54 Re: Left Join Complex Query