From: | "Chris Ochs" <chris(at)paymentonline(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: casting parameters to a function |
Date: | 2004-01-14 00:10:05 |
Message-ID: | 03b501c3da32$c3272b90$250a8b0a@chris |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I finally figured out that you cannot assign parameters to a variable in the
DECLARE section, it has to be done inside the BEGIN/END block. except for
the ALIAS command it seems that parameters do not exist in the DECLARE
block.
> I am trying to move all of the sql statements from my code into a pl/pgsql
> function. I have one function for a transaction block that contains 10
> inserts and I need to pass 50 parameters to it.
>
> Well I can't do that, so I was playing around with passing the parameters
in
> as a varchar[] array, but then I have the issue of the variables being the
> wrong type when I insert them.
>
> I was playing around with trying to convert types, but it isn't working so
> far. The function takes a single varchar[] as an argument..
>
> This doesn't work:
> s ALIAS FOR $1;
> in_trans_date timestamp := s[3];
>
> and this doesn't work either:
> in_trans_date timestamp := $1[3];
>
> Can someone help me in how to assign an array element to a variable and
cast
> it?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-01-14 00:16:34 | Re: casting parameters to a function |
Previous Message | Tom Lane | 2004-01-13 23:58:59 | Re: serverless postgresql |