Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

From: "Jyoti Seth" <jyotiseth2001(at)gmail(dot)com>
To: "'Pavel Stehule'" <pavel(dot)stehule(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] setof or array as input parameter to postgresql 8.2 functions
Date: 2007-06-14 05:47:27
Message-ID: 003201c7ae47$7ff80460$7fe80d20$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Thanks for the solution. With this I am able to pass arrays and
multidimensional arrays in postgresql functions.

One of my problem is still left I want to pass set of values with different
datatypes.For eg:
I want to pass following values to the function:
1 ajay 1000.12
2 rita 2300.24
3 leena 1230.78
4 jaya 3432.45

As the values have different data types I have to create three different
arrays. Is there any way with which I can pass this as a single setof
values.

Thanks,
Jyoti

-----Original Message-----
From: Pavel Stehule [mailto:pavel(dot)stehule(at)gmail(dot)com]
Sent: Wednesday, June 13, 2007 6:25 PM
To: Jyoti Seth
Cc: pgsql-general(at)postgresql(dot)org; pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] setof or array as input parameter to postgresql 8.2
functions

Hello

maybe:

create function foo(varchar[][]) returns void as $$ begin end$$
language plpgsql;

postgres=# select foo(array[array[1,2], array[2,2]]::varchar[][]);
foo
-----

(1 row)

Regards
Pavel Stehule

2007/6/13, Jyoti Seth <jyotiseth2001(at)gmail(dot)com>:
>
>
>
>
> Hi,
>
>
>
> I have to pass a set of values and arrays in postgresql 8.2 functions. But
I
> am not getting any help on that. Please let me know if any one has idea.
>
>
>
> Thanks,
>
> Jyoti

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2007-06-14 05:57:08 Re: [SQL] setof or array as input parameter to postgresql 8.2 functions
Previous Message guillermo arias 2007-06-14 05:38:43 Re: inner join problem with temporary tables

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2007-06-14 05:57:08 Re: [SQL] setof or array as input parameter to postgresql 8.2 functions
Previous Message Bob Singleton 2007-06-13 18:48:47 Re: calculate time diffs across rows with single timestamp