【问题标题】:Oracle UTL_FILE exceptions alternatives in PostgresPostgres 中的 Oracle UTL_FILE 异常替代方案
【发布时间】:2020-07-17 10:42:00
【问题描述】:

我正在将一个 Oracle 存储过程迁移到 AWS Aurora Postgres,它具有 UTL_FILE 操作来读取和写入外部文件。在异常部分,我使用了所有这些异常类型。 UTL_FILE.invalid_pathUTL_FILE.invalid_operationUTL_FILE.invalid_modeUTL_FILE.read_errorUTL_FILE.write_errorWHEN OTHERS

是否可以在 Postgres 中处理所有这些异常,或者我应该使用 orafce 扩展名吗?

【问题讨论】:

  • AWS Aurora Postgres我不详细了解,应该是不同存储的Postgres。如果 Aurora Postgres 有 UTL_FILE,那么很可能它来自预安装的 Orafce 扩展。

标签: postgresql database-migration amazon-aurora postgresql-11 orafce


【解决方案1】:

据我所知,AWS Aurora Postgres 也使用 Orafce

https://aws.amazon.com/about-aws/whats-new/2020/06/amazon-aurora-supports-postgresql-versions-117-1012-and-9617-and-adds-global-database-for-postgresql-117/

Postgres 没有像 Oracle 这样的自定义命名异常,因此您必须稍微重写代码,而是必须检查错误消息 - 例如 - Oracle 的 UTL_FILE.write_error 是 Postgres 的 RAISE 异常(命名为 raise_exception - @987654322 @) 带有错误消息(可在SQLERRM 变量中或通过GET STACKED DIAGNOSTICS 获得)是"UTL_FILE_WRITE_ERROR"

【讨论】:

    猜你喜欢
    • 2018-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-22
    • 2013-09-28
    • 1970-01-01
    相关资源
    最近更新 更多