Re: plpgsql always returning null..

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

hi

we have 2 databases on the test environment both running 702 ..
The answer for consitent in both the machines.. Both the databases when
queries returned null..

The table inventory is a very simple 2 column table containing
exhibit_distribution_id and quantity as the column..

arttoday=# select * from inventory;
exhibit_distribution_id | quantity
-------------------------+----------
453 | 59
454 | 31
455 | 71
456 | 54
457 | 51
458 | 55
459 | 68
460 | 44
461 | 60
..
..
..
594 | 70

Regards
Anand
On Fri, Feb 02, 2001 at 09:37:08AM -0800, Stephan Szabo wrote:
>
>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 Mikheev, Vadim 2001-02-02 18:42:56 RE: Is Oracle really so much faster
Previous Message Stephan Szabo 2001-02-02 17:44:08 Re: adding not null constraint to existing table