Re: Function parameter

From: "Nico Callewaert" <callewaert(dot)nico(at)telenet(dot)be>
To: "John DeSoi" <desoi(at)pgedit(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function parameter
Date: 2009-02-25 07:34:05
Message-ID: 67083F62DDDA484E8D2F148EDBE12504@etsinformatics.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

----- Original Message -----
From: "John DeSoi" <desoi(at)pgedit(dot)com>
To: "Nico Callewaert" <callewaert(dot)nico(at)telenet(dot)be>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, February 25, 2009 1:52 AM
Subject: Re: [GENERAL] Function parameter

>
> On Feb 24, 2009, at 5:10 PM, Nico Callewaert wrote:
>
>> I'm trying to modify an input parameter of a function, but I receive
>> following error :
>>
>> ERROR: "$17" is declared CONSTANT
>> CONTEXT: compile of PL/pgSQL function "update_jobreg" near line 26
>>
>> Is there a way to modify an input parameter or I have to declare a local
>> variable and assign that input parameter to it ?
>
> Declaring a local variable is the best way to do it. You can modify a
> parameter if you declare it as INOUT, but you generally only want to do
> that if you want to return something from the function.
>
> Note that you can declare and assign the value in a single line in the
> DECLARE section of the function, e.g.
>
> text_var text := text_param;
>

Hi !

Thank you for the explanation. I was not warae of the fact that you could
declare and assign a variable in 1 line.

Thanks, best regards, Nico

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2009-02-25 08:16:40 Re: speaking of 8.4...
Previous Message Bill Herbert 2009-02-25 04:30:16 Problem setting up PostgreSQL