Re: Using arguments with functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert Fitzpatrick" <robert(at)webtent(dot)com>
Cc: "PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using arguments with functions
Date: 2004-07-10 20:33:26
Message-ID: 20082.1089491606@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Robert Fitzpatrick" <robert(at)webtent(dot)com> writes:
> CREATE OR REPLACE FUNCTION "public"."get_next" (varchar) RETURNS varchar AS'
> DECLARE
> var1 alias for $1;
> BEGIN
> var1 = chr( (ascii(var1) + 1) );
> ...
> ohc=> select get_next('a');
> ERROR: "$1" is declared CONSTANT
> CONTEXT: compile of PL/pgSQL function "get_next" near line 5

plpgsql does not allow you to overwrite an argument value.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-07-11 00:28:16 Re: Trying to minimize the impact of checkpoints
Previous Message Oliver Elphick 2004-07-10 20:08:46 Re: Using arguments with functions