From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | mgould(at)isstrucksoftware(dot)net |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Converting stored procedures from SQL Anywhere to PostGres. |
Date: | 2012-03-07 21:01:58 |
Message-ID: | 4F57CCC6.5070702@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 03/07/2012 10:51 AM, mgould(at)isstrucksoftware(dot)net wrote:
> 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
^^^ Should be returns
For a good overview see:
http://www.postgresql.org/docs/9.0/interactive/plpgsql-structure.html
> $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
>
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Abbate | 2012-03-07 21:16:47 | FDWs, foreign servers and user mappings |
Previous Message | Bret Stern | 2012-03-07 21:00:32 | Re: Show Databases via ODBC |