how to use variables in postgresql - Mailing list pgsql-novice

From saumya goel
Subject how to use variables in postgresql
Date
Msg-id 888154f50706212255n2acce6avfcc0ff33fb820e1b@mail.gmail.com
Whole thread Raw
Responses Re: how to use variables in postgresql  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-novice
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';
dbms_output.put_line('enter the values sequentially');
loop
if myflag='n' then
exit;
end if;
insert into std_values
values('&tree_species_name','&location',&p,&c1,&c2,&q,&c3,&a,&b,&sp_gravity,&exp_factor);
commit;
dbms_output.put_line('records inserted sucessfully');
dbms_output.put_line('enter n to exit or y to continue entering values');
myflag:= '&y or n';
end loop;
commit;
$BODY$
LANGUAGE 'sql' VOLATILE;

BUT IT SHOWS ERROR AT INITIALISATION OF MYFLAG... CAN ANYONE TELL ME HOW TO DECLARE VARIABLES IN POSTGRESQL..

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.1 -- very slow query time because of "BETWEEN" (dbmail)
Next
From: "A. Kretschmer"
Date:
Subject: Re: how to use variables in postgresql