I am trying to write a postgres function and I'm getting errors when
the parameter sub is empty (it wont ever be null) and meetCode has a number.
This is the function code:
create or replace function SubjectDisplay(IN subj varchar,IN meetCode
numeric,IN meetTrWP integer,OUT Display varchar)
returns varchar as
$BODY$
Declare
meetType varchar;
BEGIN
IF subj='' Then
if meetCode=0 Then
if meetTrWp=0 Then
Select S_MEETING_TITLE as Display from System Limit 1;
Return;
elseif meetTrWp=1 Then
Select S_TRAINING_TITLE as Display from System Limit 1;
Return;
else
Select S_WP_TITLE as Display from System Limit 1;
Return;
end if;
else
--This is where I run into problems. I get an error when I run it.
Query has no destination for result data
Select MT_DESCRIPTION as meetType from MEETING_TYPE Where MT_CODE=meetCode;
Display := meetType
Return;
end if;
else
Display := subj
Return;
end if;
Return;
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
Christine Penner
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general