When considering a migration from Oracle to PostgreSQL, the first topic that comes up is PL/SQL incompatibility. It is certainly a difficult part of the migration, and that in itself is not wrong.
Perhaps this problem relates to #3923 (which is about literals with len <= 32767), but that ticket is too old, so it seems better to me start new one. Consider script ...
If this (and maybe others) function is called with a non-NULL output SQLDA, with a select statement that returns more than one row or throw errors, exceptions are not returned in the status vector.