[英]Oracle UTL_FILE exceptions alternatives in Postgres
I'm migrating an Oracle stored procedure to AWS Aurora Postgres which has UTL_FILE
operations to read and write in external files.我正在将 Oracle 存储过程迁移到 AWS Aurora Postgres,它具有
UTL_FILE
操作来读取和写入外部文件。 In the Exception part, I have all these exception types used.在异常部分,我使用了所有这些异常类型。
UTL_FILE.invalid_path
, UTL_FILE.invalid_operation
, UTL_FILE.invalid_mode
, UTL_FILE.read_error
, UTL_FILE.write_error
, and WHEN OTHERS
. UTL_FILE.invalid_path
、 UTL_FILE.invalid_operation
、 UTL_FILE.invalid_mode
、 UTL_FILE.read_error
、 UTL_FILE.write_error
和WHEN OTHERS
。
Is it possible to handle all these exceptions in Postgres or should I go for orafce
extension?是否可以在 Postgres 中处理所有这些异常,或者我应该 go 进行
orafce
扩展?
What I know, The AWS Aurora Postgres uses Orafce too据我所知,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/ 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 has not custom named exceptions like Oracle, so you have to rewrite your code little bit, you have to check error message instead - for example - Oracle's UTL_FILE.write_error
is a Postgres's RAISE exception (named raise_exception
- P0001 ) with error message (available in SQLERRM
variable or via GET STACKED DIAGNOSTICS
) is "UTL_FILE_WRITE_ERROR"
. Postgres 没有像 Oracle 这样的自定义命名异常,所以你必须稍微重写你的代码,你必须检查错误消息 - 例如 - Oracle 的
UTL_FILE.write_error
是 Postgres 的 RAISE 异常(名为raise_exception
- P0001 )带有错误消息(可用在SQLERRM
变量中或通过GET STACKED DIAGNOSTICS
)是"UTL_FILE_WRITE_ERROR"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.