Re: cursor return null

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: cursor return null
Дата
Msg-id 1405963719554-5812246.post@n5.nabble.com
обсуждение исходный текст
Ответ на cursor return null  (Ramesh T <rameshparnanditech@gmail.com>)
Список pgsql-general
rameshparnanditech wrote
> Hello,
>            in postgres function (id bigint ),the following code not return
> any value with artNums ,But when i do  select statement ony it's output
> the
> values with out include cursor
>
>  i.e,cursor problem ..?
>
> please let me know what should i do to getvalues from cursor, but i dont
> where i missing
>
>  function (id bigint )
>
> DECLARE
>       PartNums   varchar (10000);
>  artNums CURSOR for
>       SELECT p.PART_NUM part_num
>         FROM lineitem sol, part p
>        WHERE sol.ORDER_ID = id AND p.PART_ID = sol.PART_ID;
>
>    BEGIN
>       FOR cPart IN  artNums LOOP
>    BEGIN
>         PartNums := PartNums || cPart.part_num || ', ';
> END;

You have two BEGIN statements and no "END LOOP" statement...you need to read
the documentation and learn the correct syntax for using CURSORS and FOR
loops.

You should also post the entire function and not just excerpts to minimize
the risk of copy/paste problems and not reporting your reality.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/cursor-return-null-tp5812219p5812246.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: statement_timeout doesn't work
Следующее
От: David G Johnston
Дата:
Сообщение: Re: Why would I need to explicitly cast a string literal to text?