Need help! parse erro

From: Najm Hashmi <najm(at)mondo-live(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Need help! parse erro
Date: 2000-10-31 15:39:31
Message-ID: 39FEE7B2.31B1D2FB@mondo-live.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)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.

Browse pgsql-sql by date

  From Date Subject
Next Message Petr Jezek 2000-10-31 16:05:17 INSERT [IGNORE] INTO TABLE
Previous Message Decio Fonini 2000-10-31 12:54:24 Re: fetching rows