--- "Stephen J. Thompson" <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster