简体   繁体   English

从PL / SQL函数调用Java程序并处理Java异常

[英]Invoking Java program from PL/SQL function and handling Java exception

I have a PL/SQL function that wraps a Java stored procedure. 我有一个包装Java存储过程的PL / SQL函数。 I want to handle the returned exception by inserting the exception to a table. 我想通过将异常插入表中来处理返回的异常。

create or replace 
FUNCTION req(request VARCHAR2, ip VARCHAR2, port NUMBER)
RETURN VARCHAR2 AS LANGUAGE JAVA
NAME 'MRPosting.MRPost(java.lang.String, java.lang.String, int) return java.lang.String';

How can I get the returned exceptions and then insert it to a table? 如何获取返回的异常,然后将其插入表中?

You have to create another procedure (using plain PL/SQL) that calls the Java function. 您必须创建另一个过程(使用纯PL / SQL)来调用Java函数。 This procedure needs to contain an exception handler that does the insert. 该过程需要包含一个执行插入的异常处理程序。 Or you could have the Java function do the insert, it depends on your situation. 或者,您可以让Java函数执行插入操作,具体取决于您的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM