Tool to translate Oracle PL / SQL to Postgresql PL / pgSQL

Is there a tool (preferably free) that translates the Oracle PL / SQL stored procedure language into the Postgresql PL / pgSQL stored procedure language?

+5
source share
4 answers

There is a tool available at http://ora2pg.darold.net/ that can be used to translate Oracle schemas for Postgres schemas, but I'm not sure if it will also translate stored procedures. But this can provide a place to start.

+3
source

EnterpriseDB, Oracle, Oracle. Oracle , , , .

+2

Oracle Postgres. - . , . , , .

+2

ora2pg .

:

  • DECODE() CASE Oracle WHERE (+) LEFT OUTER JOIN. .
  • PL/SQL PL/PGSQL (. ).

It would be nice if someone would run the sourceforge project to do this.
Hint hint ...

Here is what I mean for (2) above:

CREATE OR REPLACE FUNCTION trunc(
  parmDate   DATE    ,
  parmFormat VARCHAR ) 
RETURNS date 
AS $$
DECLARE
  varPlSqlFormat VARCHAR;
  varPgSqlFormat VARCHAR;
BEGIN
  varPgSqlFormat := lower(parmFormat);

  IF varPgSqlFormat IN (
    'syyyy' ,
    'yyyy'  ,
    'year'  ,
    'syear' ,
    'yyy'   ,
    'yy'    ,
    'y'     ) THEN
    varPgSqlFormat := 'year';
  ELSEIF varPgSqlFormat IN (
    'month' ,
    'mon'   ,
    'mm'    ,
    'rm'    ) THEN 
    varPgSqlFormat := 'month';
  ELSEIF varPgSqlFormat IN (
    'ddd' ,
    'dd'  ,
    'j'   ) THEN 
    varPgSqlFormat := 'day';
  END IF;

  RETURN DATE_TRUNC(varPgSqlFormat,parmDate);
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION trunc(
  parmDate   DATE) 
RETURNS date 
AS $$
DECLARE
BEGIN
  RETURN DATE_TRUNC('day',parmDate);
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION last_day(in_date date) RETURNS date 
AS $$
DECLARE
BEGIN
  RETURN CAST(DATE_TRUNC('month', in_date) + '1 month'::INTERVAL AS DATE) - 1;
END;
$$ LANGUAGE plpgsql;
+2
source

All Articles