Re: PlPg/SQL mulit-array as a parameter?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PlPg/SQL mulit-array as a parameter?
Date: 2007-04-10 08:04:14
Message-ID: 20070410080414.GA31848@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Sat, dem 07.04.2007, um 6:27:27 -0700 mailte Simon István folgendes:
> How can i use multi-array parameter in PlPg/SQL?
>
> This array want to put in parameter.
> [[0, 1, 3, 0, 3, 4], [7, 12, 1, 9, 1, 2], [12, 24, 20, 42, 43, 44],
> [24, 103, 65, 113, 72, 25], [179, 357, 335, 348, 309, 138], [3901,
> 3491, 4326, 878, 3785, 450]]

Yes, why not?

Tell us more about what you need and what you have tried. A simple
example:

test=*# create or replace function my_foo(int[]) returns int as $$begin return $1[1][1]; end; $$language plpgsql;
CREATE FUNCTION
test=*# commit;
COMMIT
test=# select my_foo(array[[0, 1, 3, 0, 3, 4], [7, 12, 1, 9, 1, 2], [12, 24, 20, 42, 43, 44], [24, 103, 65, 113, 72, 25], [179, 357, 335, 348, 309, 138], [3901, 3491, 4326, 878, 3785, 450]]);
my_foo
--------
0
(1 row)

test=*# select my_foo(array[[10, 1, 3, 0, 3, 4], [7, 12, 1, 9, 1, 2], [12, 24, 20, 42, 43, 44], [24, 103, 65, 113, 72, 25], [179, 357, 335, 348, 309, 138], [3901, 3491, 4326, 878, 3785, 450]]);
my_foo
--------
10
(1 row)

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2007-04-10 08:04:37 Re: No of triggers of one single table
Previous Message sami jan 2007-04-10 07:58:49 Re: plperl "set-valued function" problem