SELECT INTO an array

Поиск
Список
Период
Сортировка
Искать

SELECT INTO an array

От:
Alberto Bolchini <alberto@melloni49.it>
Дата:
Hi!

I'm trying to write a PLPGSQL Function using an array as an internal variable, but I don't seem to succeed:

CREATE FUNCTION ... RETURNS ... AS '
DECLARE 
  l_record integer[2];
BEGIN
  SELECT INTO l_record col01, col02 FROM table01 WHERE ...;

when calling the function, I get a 

ERROR:  array_in: Need to specify dimension

How do I specify such dimension?


Thanks 
Alberto

Re: SELECT INTO an array

От:
"Josh Berkus" <josh@agliodbs.com>
Дата:
Alberto,

> I'm trying to write a PLPGSQL Function using an array as an internal
> variable, but I don't seem to succeed:
> 
> CREATE FUNCTION ... RETURNS ... AS '
> DECLARE 
>   l_record integer[2];
> BEGIN
>   SELECT INTO l_record col01, col02 FROM table01 WHERE ...;

You don't want an array for the above.  You want a RECORD.

-Josh
FAQ