problem with RECORD in a stored procedure

Поиск
Список
Период
Сортировка
От Dalton Shane
Тема problem with RECORD in a stored procedure
Дата
Msg-id 200203081502.PAA28287@cs.may.ie
обсуждение исходный текст
Ответы Re: problem with RECORD in a stored procedure  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: problem with RECORD in a stored procedure  (daq <daq@ugyvitelszolgaltato.hu>)
Список pgsql-sql
HI,

I have a strange problem with regard to the RECORD type. IN plpgsql language it 
doesn't seem to recognise the data type. Does anybody have any idea why? I've 
included a sample function and the terminal output to show what I mean. I've 
also included what should have gone into table orla.

Any help would be appreciated in sorting out this frustrating problem.

Shane

CREATE FUNCTION sinead() RETURNS integer AS 'DECLARE    a integer :=0;    b RECORD;     BEGIN    FOR b IN SELECT
MIN(total)from results LOOP        INSERT INTO orla(total) VALUES(b);    END LOOP;        RETURN a;        END;
 
' LANGUAGE 'plpgsql';

-------------------------------------------------------------------------

ballina=# select sinead();
ERROR:  Attribute 'b' not found

--------------------------------------------------------------------------
ballina=# select MIN(total) from results;min 
-----  2
(1 row)

---------------------------------------------------------------------------



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

Предыдущее
От: rolf.ostvik@axxessit.no
Дата:
Сообщение: Re: [GENERAL] PL/pgSQL Syntax Problem
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: problem with RECORD in a stored procedure