Re: Function with Integer array parameter

Поиск
Список
Период
Сортировка
От Rodrigo De León
Тема Re: Function with Integer array parameter
Дата
Msg-id 1187284519.095352.248220@b79g2000hse.googlegroups.com
обсуждение исходный текст
Ответ на Re: Function with Integer array parameter  (Ranjan Kumar Baisak <rbaisak@nyc.yamaha.com>)
Список pgsql-general
On Aug 16, 11:06 am, rbai...@nyc.yamaha.com (Ranjan Kumar Baisak)
wrote:
> Decibel! wrote:
> > On Thu, Aug 16, 2007 at 11:14:25AM -0400, Ranjan Kumar Baisak wrote:
>
> >> Postgres Gurus,
> >>                             Please suggest me what is wrong with this
> >> function.
> >> This function tries to retrieve set of rows from description table based
> >> on set of ID fields passed as array.
>
> >> The error, I get is : ERROR:  only one AS item needed for language "plpgsql"
>
> >> CREATE OR REPLACE function get_description_list(integer[]) RETURNS SETOF
> >> type_description AS
> >> 'DECLARE
>
> > ...
>
> >>        WHERE   d_base.id in array_to_string(ints_desc_ids alias,',')
>
> > Note the quotes.
>
> > Use dollar quoting... it$$s your friend.
>
> I tries wir $$ as well as ''(two single quotes instead of one single
> quote) but still got the same error.
> I think the error is with
>
>   WHERE   d_base.id in array_to_string(ints_desc_ids alias,',').
> I need a way using integer array in where clause.

... WHERE d_base.id = ANY(ints_desc_ids) ...

See:
http://www.postgresql.org/docs/8.2/static/arrays.html#AEN5865


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

Предыдущее
От: novnov
Дата:
Сообщение: Re: Running a stored procedure via pgagent, need an examp le
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: how to get id of currently executed query?