Creating a function with single quotes

From: Shawn Tayler <stayler(at)washoecounty(dot)us>
To: PostgreSQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Creating a function with single quotes
Date: 2009-02-19 15:41:11
Message-ID: 1235058071.29030.82.camel@shop.telecom.co.washoe.nv.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

This has me befuddled. I am trying create a simple experiment, rather
new to SQL and I am running into an issue with single quotes. All I can
find on creating a function states the procedure should be contained
within single quotes. My problem comes when I want to use a textual
representation of an interval.

create function csd_interval(integer) returns interval as
'BEGIN
RETURN $1 * interval '1 msec'
END;'
LANGUAGE 'plpgsql';

it always fails at the '1 msec' point.

Suggestions?
--
Sincerely,

Shawn Tayler
Radio Network Administrator
Washoe County Regional Communications System
Telecommunications Division
Technology Services Department
County of Washoe
State of Nevada
Ofc (775)858-5952
Cell (775)771-4241
FAX (775)858-5960

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Agustin Bialet 2009-02-19 16:00:32 Re: Creating a function with single quotes
Previous Message Gregory Stark 2009-02-18 13:05:46 Re: Funtion to clean up strings?