Re: how to use variables in postgresql

From: Christoph Della Valle <christoph(dot)dellavalle(at)goetheanum(dot)ch>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to use variables in postgresql
Date: 2007-06-22 06:35:39
Message-ID: 467B6DBB.1050205@goetheanum.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

and use DECLARE ;-)

I HAVE A PROBLEM REGARDING DECLARATION/ INITIALISATION OF VARIABLES IN
POSTGRESQL FUNCTIONS AND PROCEDURES. MY CODE PRESENTLY LOOKS LIKE
CREATE FUNCTION ins_into_std_values() RETURNS void AS
$BODY$
DECLARE
myflag CHAR(1) :='y';
BEGIN
...
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

A. Kretschmer schrieb:
> am Thu, dem 21.06.2007, um 22:55:38 -0700 mailte saumya goel folgendes:
>
>> I HAVE A PROBLEM REGARDING DECLARATION/ INITIALISATION OF VARIABLES IN
>> POSTGRESQL FUNCTIONS AND PROCEDURES. MY CODE PRESENTLY LOOKS LIKE
>> CREATE FUNCTION ins_into_std_values() RETURNS void AS
>> $BODY$
>> myflag CHAR(1) :='y';
>> ...
>> $BODY$
>> LANGUAGE 'sql' VOLATILE;
>>
>
> Use another language, for instance plpgsql. Pure SQL hasn't variables.
> http://www.postgresql.org/docs/current/interactive/plpgsql.html
>
>
> Andreas
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Brian Neu 2007-06-22 08:59:18 Re: 8.1 -- very slow query time because of "BETWEEN" (dbmail)
Previous Message A. Kretschmer 2007-06-22 06:07:32 Re: how to use variables in postgresql