Oracle ADF / JDeveloper 11.1.1.7。 Oracle DB。
我试图将存储过程称为:
create or replace
PROCEDURE SP_ADD_AUDIT_COMMENT_BY_RECID (ct_comments IN TYPE_AUDIT_COMMENT)
AS
MISSING_REQUIRED_INPUT EXCEPTION;
BEGIN
IF
(ct_comments.CUSTOM_APP_RECORD_ID IS NULL) OR
(ct_comments.CUSTOM_SOURCE IS NULL) OR
(ct_comments.UPDATEDBYDISPLAYNAME IS NULL) OR
(ct_comments.COMMENTDATE IS NULL) OR
(ct_comments.WFCOMMENT IS NULL)
THEN
RAISE MISSING_REQUIRED_INPUT;
ELSE
INSERT All
INTO AUDIT_RECORD_INSTANCE (CUSTOM_APP_RECORD_ID, CUSTOM_SOURCE, INSTANCEID, COMPOSITEINSTANCEID) VALUES (ct_comments.CUSTOM_APP_RECORD_ID, ct_comments.CUSTOM_SOURCE, ct_comments.INSTANCEID, ct_comments.COMPOSITEINSTANCEID)
INTO AUDIT_WFCOMMENTS (CUSTOM_APP_RECORD_ID, CUSTOM_SOURCE, TASKID, UPDATEDBY, UPDATEDBYDISPLAYNAME, COMMENTDATE, WFCOMMENT, SCOPE ) VALUES (ct_comments.CUSTOM_APP_RECORD_ID, ct_comments.CUSTOM_SOURCE, ct_comments.TASKID, ct_comments.UPDATEDBY, ct_comments.UPDATEDBYDISPLAYNAME, ct_comments.COMMENTDATE, ct_comments.WFCOMMENT, ct_comments.SCOPE)
SELECT * FROM dual;
END IF;
EXCEPTION
WHEN MISSING_REQUIRED_INPUT THEN
--DBMS_OUTPUT.PUT_LINE ('One or more required input values are missing.');
raise_application_error (-20001,'One or more required input values are missing.');
END;
使用以下命令从SQL Worksheet中可以正常工作:
DECLARE pComment TYPE_AUDIT_COMMENT;
BEGIN
pComment := TYPE_AUDIT_COMMENT('123','SOURCE','1','2','3','jSmith','Joe Smith',
to_timestamp('06-APR-15 02.25.58.187000000 PM','DD-MON-RR HH.MI.SS.FF AM'),'TEST COMMENT SP','SCOPE');
SCHEMANAME.SP_ADD_AUDIT_COMMENT_BY_RECID(pComment);
END;
在AppModule中,方法获取params并尝试执行该过程:
public void insertNewGenericComment(Comments comments){
String input =
"pComment := TYPE_AUDIT_COMMENT('" + comments.getAssessmentId() + "', '"
+ comments.getCustomSource() + "', '"
+ comments.getInstanceid() + "', '"
+ comments.getTaskId() + "', '"
+ comments.getCompositeInstanceId() + "', '"
+ comments.getUpdatedBy() + "', '"
+ comments.getUpdatedbyDisplayName() + "', to_timestamp('"
+ comments.getCommentDate() + "','DD-MON-RR HH.MI.SS.FF AM'), '"
+ comments.getComment() + "', '"
+ comments.getScope() + "'); SCHEMANAME.SP_ADD_AUDIT_COMMENT_BY_RECID(pComment);";
DBTransactionImpl dbti = (DBTransactionImpl)getDBTransaction();
dbti.executeCommand("DECLARE pComment TYPE_AUDIT_COMMENT; begin " + input + " end;");
我尝试了很多变化,但为什么我不能像在Worksheet中那样执行sql?
上面的JBO错误是:
There was an error adding a new comment: oracle.jbo.SQLStmtException: JBO-27121: SQL error during statement execution. Statement: DECLARE pComment TYPE_AUDIT_COMMENT; begin pComment := TYPE_AUDIT_COMMENT('210', 'AssignCustomTaskflow', 'NA', 'NA', 'NA', 'anonymous', 'anonymous', to_timestamp('16-Jun-15 02.58.20.000000502 PM','DD-MON-RR HH.MI.SS.FF AM'), ' test', 'NA'); SCHEMANAME.SP_ADD_AUDIT_COMMENT_BY_RECID(pComment); end;
粘贴到SQL Worksheet中的错误消息中的语句也可以正常执行。是否无法从ADF传递逐字过程调用?