Skip site navigation (1) Skip section navigation (2)

Re: FUNCTION question

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Nico Callewaert <callewaert(dot)nico(at)telenet(dot)be>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: FUNCTION question
Date: 2009-02-25 00:47:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Feb 24, 2009, at 7:25 AM, 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;

John DeSoi, Ph.D.

In response to

pgsql-novice by date

Next:From: Shabala DeshpandeDate: 2009-02-26 08:22:15
Subject: Version details for psql/postmaster
Previous:From: Nico CallewaertDate: 2009-02-24 12:25:11
Subject: FUNCTION question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group