Re: Select and functions

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: stephen(at)cass-ltd(dot)co(dot)uk, pgsql-sql(at)postgresql(dot)org
Subject: Re: Select and functions
Date: 2003-11-05 19:54:24
Message-ID: 20031105195424.7444.qmail@web20803.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- "Stephen J. Thompson" <stephen(at)cass-ltd(dot)co(dot)uk>
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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jerome Alet 2003-11-05 21:40:41 avoid circular references
Previous Message luisblock 2003-11-05 18:30:20 SQL Help