From: Najm Hashmi <najm@mondo-live.com>
To: pgsql-sql@postgresql.org
Subject: Need help! parse erro
Date: Tue, 31 Oct 2000 10:39:31 -0500
Message-ID: <39FEE7B2.31B1D2FB@mondo-live.com> (raw)
Hi every one, I have just strated to use postgres. I wrote a vert
simple pl/pgsql function as given below:
CREATE FUNCTION
add_new_user(varchar(32),char(8),varchar(128),varchar(128),varchar(32),
varchar(32)) RETURNS boolean AS' DECLARE
oldUser RECORD;
USR ALIAS FOR $1;
PWORD ALIAS FOR $2;
EMAIL ALIAS FOR $3;
ADDR ALIAS FOR $4;
CITY ALIAS FOR $5;
CNTRY ALIAS FOR $6;
BEGIN
SELECT INTO oldUser *
FROM users
where username=USR AND password= PWORD;
IF FOUND
THEN
RETURN ''f'';
ELSE
INSERT INTO USERS(username,password,email,address,city,country)
values(USR,PWORD,EMAIL,ADDR,CITY,CNTRY);
RETURN ''t'';
END IF;
END;'
LANGUAGE 'plpgsql';
When I run it I get the following error:
najdb=# select
add_new_user('najm'::varchar,'najm1234'::char,'najmh@whatever'::varchar,'123street'::varchar,'mtl'::varchar,'canada'::varchar);
ERROR: parser: parse error at or near "$1"
Someone, please help me out here.
I would also appreciate if you all "wizards" out there could send me
some more complex examples of plpgsql functions and triggers sinece
postgres docs doesn't have any good ones. Thank you all for all your
help.
Regards.
Najm.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: najm@mondo-live.com
Subject: Re: Need help! parse erro
In-Reply-To: <39FEE7B2.31B1D2FB@mondo-live.com>
References: <39FEE7B2.31B1D2FB@mondo-live.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox