开发者

Suppress PHP warnings for expected Oracle exceptions

I have a PHP functi开发者_如何转开发on that calls a PL/SQL package that can throw a number of known exceptions (i.e. user exceptions) that I can catch in PHP and act on. The problem is, despite catching the exception in PHP I get a warning in the PHP log file with a stack trace from the PL/SQL exception:

PHP Warning:  oci_execute(): ORA-20001: Something isn't valid
ORA-234565: at "MY.PACKAGE", line 234
ORA-923485: at "MY.PACKAGE", line 123

How can I suppress these OCI warnings? I don't want to suppress all warnings as they can be helpful for other issues, but when it's an expected error from my PL/SQL I don't want it filling up my log file.


If you only need to suppress the warning on oci_execute(), prepend it with @

@oci_execute()

Using that kind of runtime error suppression is often not recommended since it covers up problems in the application, but you've handled the problem in the code by catching the exception already and understand the consequence of suppressing the warnings.

PHP docs on the @ operator...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜