X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0281FD1BB53 for ; Wed, 5 Nov 2003 19:54:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07107-02 for ; Wed, 5 Nov 2003 15:54:25 -0400 (AST) Received: from web20803.mail.yahoo.com (web20803.mail.yahoo.com [216.136.226.192]) by svr1.postgresql.org (Postfix) with SMTP id CD09DD1B96E for ; Wed, 5 Nov 2003 15:54:23 -0400 (AST) Message-ID: <20031105195424.7444.qmail@web20803.mail.yahoo.com> Received: from [208.13.35.65] by web20803.mail.yahoo.com via HTTP; Wed, 05 Nov 2003 11:54:24 PST Date: Wed, 5 Nov 2003 11:54:24 -0800 (PST) From: Jeff Eckermann Subject: Re: Select and functions To: stephen@cass-ltd.co.uk, pgsql-sql@postgresql.org In-Reply-To: <200311051426.19315.stephen@cass-ltd.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/30 X-Sequence-Number: 15845 --- "Stephen J. Thompson" wrote: > But if I use it in a before trigger the procedure > fails to work. > > CREATE OR REPLACE FUNCTION > staging.write_work_country() > RETURNS trigger AS > ' > DECLARE > alias_rec RECORD; > BEGIN > -- Clean the phone number > NEW.worktelephonenumber = > REPLACE(NEW.worktelephonenumber,' ',''); > RETURN NEW; > END; > ' > > I get the following error: > > ERROR: parser: parse error at or near "',''); > > Can anyone help me please? Single quotes inside function bodies need to be escaped. The easiest way is to double them, i.e. from one single quote to two single quotes. Backslashes would work just as well (and also need to be escaped if used in a function body). __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree