Re: oracle to postgres - Mailing list pgsql-general

From Adrian Klaver
Subject Re: oracle to postgres
Date
Msg-id 54CA9FCC.2000702@aklaver.com
Whole thread Raw
Responses Re: oracle to postgres
Re: oracle to postgres
List 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.klaver@aklaver.com


pgsql-general by date:

Previous
From: "Day, David"
Date:
Subject: Re: segmentation fault postgres 9.3.5 core dump perlu related ?
Next
From: Roger Pack
Date:
Subject: Re: 4B row limit for CLOB tables