Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwIju-00059r-85 for pgsql-admin@arkaria.postgresql.org; Sun, 12 Dec 2021 06:53:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwIjs-0006cE-2k for pgsql-admin@arkaria.postgresql.org; Sun, 12 Dec 2021 06:53:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwIjr-0006bw-9g for pgsql-admin@lists.postgresql.org; Sun, 12 Dec 2021 06:53:39 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwIjn-0006Pn-VI for pgsql-admin@lists.postgresql.org; Sun, 12 Dec 2021 06:53:37 +0000 Received: by mail-qt1-x830.google.com with SMTP id a2so12380206qtx.11 for ; Sat, 11 Dec 2021 22:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=ua6v/sTVJ4EaJGInirmkQ6xtz+oJds022F7jIQUAxgM=; b=pBiU3sXu4h7Tcfuo9S5VAu0kumF41ywZf5+mJmmJLF+9IrDKEH912+JM0g2velkqof uAI9FrCAzRtVfuqcGoDRAMCH9xuqClyj5m8oIbV+KO5dAFi4CZ+kGlAPw8c0XeT0hkh0 e2HeDJezh94K7akuS8ns0mgBlZd2LCP3iGikN3jiqLKgBGHQPStQjcrSblwQhcq8+7tv wS4CZwSK4syJO3MXQmt7+cvCTDtAd4QBx/Rfou10N/EFOlR7728zczGcDGkitlKpiuvp 0ubLFhkFik/dZQX9zCUPZGcFg+meTsfsAzs5JVhwaJFPzJkXrVngiQsTaTEZdZuJt668 vgZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=ua6v/sTVJ4EaJGInirmkQ6xtz+oJds022F7jIQUAxgM=; b=B8GRlQrPqC8d5USl22QKBDA0oziWOl3YpYvCdHFsxpHoOf6Jlbls5QorcJ/lt7fBG7 N1uFox45Wn7P7Bm1qaScJ2SpbxFya60UZtqqMlqFKco2qsaUkymYZ4Drsk4f9jst2AFg FOiBfQ0ZNKS8r7dTTQ3S0miyxlm7thY3NVS2hltdKrWI8/uedyMhCUEnZt9Nlw9dwSqx qF1vwai74of4FAgMHn14KoIN/tlw4noPzRZGrgQnpYrKDrhxHCNsFCfYKosEESTTFEOk /9477gQlsZER8TpsiqF47p/oHld28qdTXHX2yuCdx76oZO9Mav1jiCoqhDeQ/DNcd71e 6EoA== X-Gm-Message-State: AOAM533+x1WdhK5UJVA1wj6QE4tzVODGdmqlr21/5m722pe3xmSrXqp+ OZL3FlkCe02wqMn/uzYe19r4meHyYZHAJw== X-Google-Smtp-Source: ABdhPJznri1eFshaszglhdq8IWKtlyWGd9pLmpxQnXlJz8GV98DYc4acOgXAn8I/ESWXW0N0yAQlGQ== X-Received: by 2002:a05:622a:308:: with SMTP id q8mr36628496qtw.463.1639292014050; Sat, 11 Dec 2021 22:53:34 -0800 (PST) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id f12sm5873383qtj.93.2021.12.11.22.53.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Dec 2021 22:53:33 -0800 (PST) Content-Type: multipart/alternative; boundary="------------HPvGbKgIJyrkWir0zOgcUqQN" Message-ID: <7fb9d1c0-77ce-fa7b-a835-d0977ae8aa92@gmail.com> Date: Sun, 12 Dec 2021 01:53:32 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: package conversion error from oracle to postgresql database !!!!!!!!! Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Mladen Gogala In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------HPvGbKgIJyrkWir0zOgcUqQN Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/12/21 00:46, dbatoCloud Solution wrote: > Hi All, > While migrating oracle to PostgreSQL database using ora2pg tool. I > have got this below error for the package. Could someone please help > with this? > psql:./schema/packages/package.sql:??: ERROR:  schema "utl_file" does > not exist > LINE 75:    file_type utl_file.file_type := utl_file.fopen(file_dir, ... >                       ^ > ERROR: an error occurs when importing file ./schema/packages/package.sql. > [ybos@doliordv265 comsod_code]$ > It is not possible to make one to one conversion from Oracle to Postgres because those two databases are different and have different design principles and different principles of operation. If you want to use file system interface from Postgres, you can use any untrusted version of the supported scripted languages like Perl or Python and implement your file operations. The "untrusted" versions of the scripting languages are those with the access to file system, which is what you need. In other words, some assembly required. You can, as suggested, use orafce, but orafce does not turn Postgres into a free version of Oracle. IThe orafce extension only goes so far. You will have to rethink the application and rewrite it to use Postgres features. Not even the best ORM will help you out with that. BTW, EnterpriseDB has by far the largest collection of Oracle features  made available on top of the Postgres kernel. EnterpriseDB can natively execute PL/SQL and it has UTL_FILE package. However, EnterpriseDB isn't free. It's much cheaper than Oracle, but is not free. On the other hand, DB2 can also natively execute PL/SQL but is also not free. And DB2 isn't Postgres either. It is however a rock solid database, much cheaper than Oracle, but not free. In the end, you always get what you pay for. Replacing Oracle by Postgres is possible but not easy. If you want an easy replacement, you will have to pay for it. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------HPvGbKgIJyrkWir0zOgcUqQN Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 12/12/21 00:46, dbatoCloud Solution wrote:
Hi All,
While migrating oracle to PostgreSQL database using ora2pg tool. I have got this below error for the package. Could someone please help with this? 
psql:./schema/packages/package.sql:??: ERROR:  schema "utl_file" does not exist
LINE 75:    file_type utl_file.file_type := utl_file.fopen(file_dir, ...
                      ^
ERROR: an error occurs when importing file ./schema/packages/package.sql.
[ybos@doliordv265 comsod_code]$

It is not possible to make one to one conversion from Oracle to Postgres because those two databases are different and have different design principles and different principles of operation. If you want to use file system interface from Postgres, you can use any untrusted version of the supported scripted languages like Perl or Python and implement your file operations. The "untrusted" versions of the scripting languages are those with the access to file system, which is what you need. In other words, some assembly required. You can, as suggested, use orafce, but orafce does not turn Postgres into a free version of Oracle. IThe orafce extension only goes so far. You will have to rethink the application and rewrite it to use Postgres features. Not even the best ORM will help you out with that.

BTW, EnterpriseDB has by far the largest collection of Oracle features  made available on top of the Postgres kernel. EnterpriseDB can natively execute PL/SQL and it has UTL_FILE package. However, EnterpriseDB isn't free. It's much cheaper than Oracle, but is not free. On the other hand, DB2 can also natively execute PL/SQL but is also not free. And DB2 isn't Postgres either. It is however a rock solid database, much cheaper than Oracle, but not free. In the end, you always get what you pay for. Replacing Oracle by Postgres is possible but not easy. If you want an easy replacement, you will have to pay for it.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------HPvGbKgIJyrkWir0zOgcUqQN--