From: | Merlin Moncure <mmoncure(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 19:26:21 |
Message-ID: | CAHyXU0xHchzaoEsY1P+5vHjRKTJOK0veBf_NX40a_GKU772uHw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Mar 7, 2012 at 12:51 PM, <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
> $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';
Well, the languages are obviously not compatible. You're going to
have to convert them all and to do that you're going to have a decent
understanding of both languages. I doubt there are any automatic
tools to do it.
start here:
http://www.postgresql.org/docs/current/static/plpgsql.html
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Bret Stern | 2012-03-07 19:36:04 | Show Databases via ODBC |
Previous Message | Carlos Mennens | 2012-03-07 19:20:59 | Re: Automated Backup Script Help (Linux) |