From: Stephen J. Thompson <stephen@cass-ltd.co.uk>
To: pgsql-sql@postgresql.org
Subject: Select and functions
Date: Wed, 5 Nov 2003 14:26:05 +0000
Message-ID: <200311051426.19315.stephen@cass-ltd.co.uk> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all,
I am having a little bit of trouble here.
If I use the replace function in a select statement all works as expected.
select firstname, lastname, replace(worktelephonenumber, ' ', '') AS worktel
from contacts;
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?
Thanks.
Stephen.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/qQiKDAwPLUWQb6sRAhNpAJ0QdVzmYdhAhFVXf06v5zACuS3y9wCfSSlS
W18AFuYb4J1le0W32uuIJto=
=xe/b
-----END PGP SIGNATURE-----
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: stephen@cass-ltd.co.uk
Subject: Re: Select and functions
In-Reply-To: <200311051426.19315.stephen@cass-ltd.co.uk>
* 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