Re: Giving error for function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Giving error for function
Дата
Msg-id 4361.1452612562@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Giving error for function  (Sachin Srivastava <ssr.teleatlas@gmail.com>)
Список pgsql-general
Sachin Srivastava <ssr.teleatlas@gmail.com> writes:
> I am getting the below error while I am running the below function
> "add_po_doc_hist", for "c_company" cursor, please suggest what is wrong
> with code.
> ERROR:  relation "c_company" does not exist
> CONTEXT:  compilation of PL/pgSQL function "add_po_doc_hist" near line 11

> CREATE OR REPLACE FUNCTION add_po_doc_hist(subscriberid bigint)
>   RETURNS void AS
> $BODY$
> DECLARE
> --Select All Companies for the subscriber entered
> c_company CURSOR FOR
>                 SELECT company_id
>                 from PSM_COMPANY_PROFILE
>                 where is_BUYER = 1
>   and subscriber_id=subscriberID;
> v_company c_company%ROWTYPE;

The error is pointing you here.  I believe the problem is that c_company
is a cursor, not a table, and as such can't be referenced with %rowtype.

I think you could just use RECORD instead ...

            regards, tom lane


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: PostgreSQL upgrade 9.3.4 -> 9.3.10
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Text parameter is treated as sql query in postgresql function