Re: Select and functions

Поиск
Список
Период
Сортировка
От Jeff Eckermann
Тема Re: Select and functions
Дата
Msg-id 20031105195424.7444.qmail@web20803.mail.yahoo.com
обсуждение исходный текст
Ответ на Select and functions  ("Stephen J. Thompson" <stephen@cass-ltd.co.uk>)
Список pgsql-sql
--- "Stephen J. Thompson" <stephen@cass-ltd.co.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


В списке pgsql-sql по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Select and functions
Следующее
От: Jerome Alet
Дата:
Сообщение: avoid circular references