Converting stored procedures from SQL Anywhere to PostGres.

From: <mgould(at)isstrucksoftware(dot)net>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Converting stored procedures from SQL Anywhere to PostGres.
Date: 2012-03-07 18:51:33
Message-ID: 20120307115133.c760ddbd7c0975bc4b045766db7d895c.7830852736.wbe@email16.secureserver.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am trying to convert stored procedures from SQL Anywhere to Postgres.
I am getting error

ERROR: syntax error at or near "return"
LINE 2: return integer AS
^

********** Error **********

ERROR: syntax error at or near "return"
SQL state: 42601
Character: 81

when I run this. I'm not sure what the problem is here. Any help would
be appreciated.

CREATE OR REPLACE FUNCTION "iss"."ConfigAddKey" (in
isscontrib.citext,pkeyname)
return integer AS
$BODY$
begin

declare l:retval integer;
declare l:id integer;

if exists(select id into l:id from iss.configkeys where keyname =
pkeyname) then
l:retval := l:id
else
insert into "iss".configkeys(keyname) values (pKeyname);
end if;
return retval

end;
$BODY$
LANGUAGE 'plpgsql';

Michael Gould
Intermodal Software Solutions, LLC
904-226-0978

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicolas Grilly 2012-03-07 18:51:55 Re: ts_rank seems very slow (140 ranked documents / second on my machine)
Previous Message Bill Moran 2012-03-07 18:47:46 Re: Advisory transaction lock for 128-bit space