Search Postgresql Archives

Re: oracle to postgres

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux