On Tuesday 13 January 2004 00:35, Doug McNaught wrote:
> "Chris Ochs" <chris@paymentonline.com> writes:
> >
> > CREATE FUNCTION taxship(varchar,integer,varchar,float,float) returns
> > integer AS '
> > insert into taxship(s_oid,order_id,mer_id,tax,shipping) values
> > ('$1',$2,'$3',$4,$5);
> > SELECT 1;
> > ' LANGUAGE SQL;
>
> When you want to use single quotes inside a quoted string (which is
> what a function body is) you need to escape them.
Can I point out that you don't need any quotes here - these are variables not
literals. Just do:
INSERT INTO (...) VALUES ($1,$2,$3...)
--
Richard Huxton
Archonet Ltd