Function that returns Boolean

From: SHARMILA JOTHIRAJAH <sharmi_jo(at)yahoo(dot)com>
To: General postgres mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Function that returns Boolean
Date: 2009-02-23 17:39:01
Message-ID: 156905.9409.qm@web110714.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
This is a simple function that returns a boolean ..

create or replace function check_value( newValue IN VARCHAR,
oldValue IN VARCHAR ) RETURN BOOLEAN
as
'
BEGIN
IF ( newValue != oldValue)
then return true;
else
return false;
END IF;
END;
'
LANGUAGE 'plpgsql'

But I get this error...what is wrong with this ?

[Error] Script lines: 1-13 -------------------------
ERROR: syntax error at or near "RETURN"
Line: 2

Thanks
Sharmila

Responses

Browse pgsql-general by date

  From Date Subject
Next Message SHARMILA JOTHIRAJAH 2009-02-23 17:43:23 Re: Function that returns Boolean
Previous Message Marek Lewczuk 2009-02-23 16:10:34 overlaps behaviour - ('2006-03-01'::TimeStamp, '2007-12-01'::TimeStamp) overlaps ('2007-12-01'::TimeStamp, 'Infinity'::TimeStamp)