darold / ora2pg

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
http://www.ora2pg.com/
GNU General Public License v3.0
978 stars 341 forks source link

Wrong procedure Name Generated #1733

Closed ladudu closed 4 months ago

ladudu commented 4 months ago

My Package names like above PKG_PRSP0210 <--package name --PRSP0221_AXXXXXXXXXXX <--procedure name --AXXXXXXXXXXX <--procedure name The Ora2Pg Generate SQL file name like AXXXXXXXXXXX.sql, This resulted in me actually having two procedures, but only one of them was generated. I tried to create a package for Test,but the results were correct.

darold commented 4 months ago

I need the DDL to reproduce, you can remove the body of the procedure between the begin and last end.

ladudu commented 4 months ago
CREATE OR REPLACE PACKAGE PRS.PKG_TEST0001 IS
    PROCEDURE TEST0011_A;
        PROCEDURE A;
END PKG_TEST0001;
CREATE OR REPLACE PACKAGE BODY PRS.PKG_TEST0001
IS
  PROCEDURE TEST0011_A
  IS

    msg CHAR(6) := NULL;
    procedure test
    is
      v_log_msg CHAR(6) := NULL; 
    begin
      v_log_msg := v_log_msg;

    end;

  BEGIN  
    msg := msg;
  END TEST0011_A;

  procedure A
  IS
  msg CHAR(6) := NULL;
  begin
   msg := msg;
  end;
END PKG_TEST0001;

ora2pg -p -t PACKAGE -c ./config/ora2pg.conf -b ./schema/packages The file name I generated is below image I haven't figured out the name generation rules yet

CREATE OR REPLACE PROCEDURE pkg_test0001.a () AS $body$
DECLARE

  msg char(6) := NULL;

BEGIN
   msg := msg;
  end;

$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;
-- REVOKE ALL ON PROCEDURE pkg_test0001.a () FROM PUBLIC;

CREATE OR REPLACE PROCEDURE pkg_test0001.test () AS $body$
DECLARE

      v_log_msg char(6) := NULL;

BEGIN
      v_log_msg := v_log_msg;

    end;

  BEGIN
    msg := msg;
  END;

$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;
darold commented 4 months ago

Ok, nested procedure are not supported, this is why the export is wrong. You must fix the nested procedure/function in Oracle prior export with Ora2Pg.

ladudu commented 4 months ago

Ok, nested procedure are not supported, this is why the export is wrong. You must fix the nested procedure/function in Oracle prior export with c. Thank you for your reply.

  1. Are there plans to support nesting?
  2. Will the package support optional export? There too many project packages , which is very time-consuming.
darold commented 4 months ago

Are there plans to support nesting?

no, not for the moment. This is a huge work, I don't have free time for that.

Will the package support optional export? There too many project packages , which is very time-consuming.

I don't understand this question. Can you please elaborate more?

ladudu commented 4 months ago

I want to export only one package,because it's takes too long to export all packages each time.Sometimes only one package changes.

darold commented 4 months ago

Yes, like tables or other export type using -a "MYPACKAGE" will only export this package.