plpgsql always returning null..

Поиск
Список
Период
Сортировка
От Anand Raman
Тема plpgsql always returning null..
Дата
Msg-id 20010202211333.C8084@india-today.com
обсуждение исходный текст
Ответы Re: plpgsql always returning null..
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Adam Lang"
Дата:
Сообщение: Postgres users/groups
Следующее
От: Fernando Schapachnik
Дата:
Сообщение: Stalled post to pgsql-general