我有一个从应用程序调用的Oracle存储过程。存储过程将搜索我从应用程序给定的参数并查询出数据,然后将信息消息返回给我的应用程序。
但是,我得到一个错误
ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小
第37行是P_INFO,我在这里使用CLOB数据类型,假设它假定数据返回超过100k个字符,则它可以支持大量字符。
create or replace PROCEDURE SimpleProcedure
(
P_ID VARCHAR2,
P_INFO OUT CLOB
) AS
V_PROJ_ID VARCHAR2(50);
V_PROJ_NAME NVARCHAR2(1000);
V_APP_ID VARCHAR2(50);
V_APP_STATUS VARCHAR2(50);
CURSOR SUB_ATTACH_CURSOR(APP_ID VARCHAR2) IS
SELECT S.SUBMISSION_ID,
SA.FILE_ID,
SA.STATUS_CODE,
E.FILENAME_TEXT
FROM SUBM_ATTCHMNT SA
INNER JOIN SUB_SUBMISSION S
ON S.SUBMISSION_ID = SA.SUBMISSION_ID
INNER JOIN SUB_FILE E
ON E.FILE_ID = SA.FILE_ID
WHERE S.APP_ID = APP_ID;
BEGIN
SELECT P.PROJECT_ID,
P.NAME_TEXT,
A.APP_ID,
A.STATUS_CODE
INTO V_PROJ_ID, V_PROJ_NAME, V_APP_ID, V_APP_STATUS
FROM SUB_APP A
INNER JOIN SUB_PROJ P
ON P.PROJECT_ID = A.PROJECT_ID
WHERE A.ID = P_ID;
P_INFO := 'Information:
Proj id: ' || V_PROJ_ID || ',
Proj name: ' || V_PROJ_NAME || ',
App id: ' || V_APP_ID || ',
App status: ' || V_APP_STATUS || ',';
FOR SA IN SUB_ATTACH_CURSOR(V_APP_ID) LOOP
P_INFO := P_INFO || 'Submission id: ' || SA.SUBMISSION_ID ||
',file id: ' || SA.FILE_ID || ', file name: ' ||
SA.FILENAME_TEXT || ', file Status: ' ||
SA.STATUS_CODE || ' ';
END LOOP;
END SimpleProcedure;
答案 0 :(得分:0)
尝试这样(使用DBMS_LOB.APPEND):
@Test(expected=MySQLIntegrityConstraintViolationException.class)
public void testMenuDeletionFailure() {
\\invoke the method you need to unit test, there is no need of assertion statements
}