From: | "Premil Agarwal" <preagarw(at)gmail(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org |
Subject: | Function's final statement must be a SELECT |
Date: | 2008-05-14 20:23:33 |
Message-ID: | 92aa956e0805141323y3c14fe2p4e10ba9c67637c49@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-interfaces |
I am trying to write a function in PgAdmin 1.8.2 for postgres 8.3. The
function should check the input parameter for NULL. If its NULL then
function should return 'Auto' otherwise return the input as such.
CREATE FUNCTION check_for_null( inp character varying) RETURNS character
varying AS $$
DECLARE
temp1 character varying := 'Auto';
temp2 character varying := inp;
BEGIN
IF temp2 IS NOT NULL THEN
temp1 := temp2;
END IF;
RETURN temp1;
END;
$$ LANGUAGE SQL;
When I hit 'OK' in create function window, I get following error :-
ERROR: return type mismatch in function declared to return *character
varying
DETAIL*: Function's *final statement must be a SELECT*.
CONTEXT: SQL function "check_for_null"
Any suggestions why this happens ??
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2008-05-14 20:36:13 | Re: [INTERFACES] Function's final statement must be a SELECT |
Previous Message | Marc Fromm | 2008-05-14 20:07:49 | phpgadmin |
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2008-05-14 20:36:13 | Re: [INTERFACES] Function's final statement must be a SELECT |
Previous Message | Michael Meskes | 2008-05-13 10:07:31 | Re: PG 8.2.7, ECPG & Composite types.. |