Re: oracle to postgres

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ramesh T <rameshparnanditech(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: oracle to postgres
Date: 2015-01-29 21:02:04
Message-ID: 54CA9FCC.2000702@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/29/2015 03:16 AM, Ramesh T wrote:
> hello,
> can any one help me to convert oracle to postgres script..?
> following code ..
> BEGIN
> EXECUTE IMMEDIATE 'DROP TABLE CONTAINER';
> EXCEPTION
> WHEN OTHERS THEN
> IF SQLCODE != -942 THEN
> RAISE;
> END IF;
> END;
> advance thanks,

For hints and tips see:

http://www.postgresql.org/docs/9.3/interactive/plpgsql-porting.html

In this case I believe the following is what you want:

BEGIN
DROP TABLE CONTAINER;
EXCEPTION
WHEN OTHERS THEN
IF RETURNED_SQLSTATE != -942 THEN
RAISE;
END IF;
END;

Not sure about that state code. I could not find it here:

http://www.postgresql.org/docs/9.3/interactive/errcodes-appendix.html

For plpgsql error handling, see here:

http://www.postgresql.org/docs/9.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roger Pack 2015-01-29 21:06:13 Re: 4B row limit for CLOB tables
Previous Message Day, David 2015-01-29 20:54:39 Re: segmentation fault postgres 9.3.5 core dump perlu related ?