我有一個需要調用Oracle數據庫包功能的Grails應用程序。Oracle類型RECORD映射到哪種Java類型?
函數的返回值是RECORD
Oracle數據類型。
映射到什麼Java Oracle數據類型RECORD
?
我發現this page,但是,我要麼是盲人,要麼是沒有我需要的信息。
示例代碼:
封裝類型聲明
TYPE subjectDuration IS RECORD (
min_duration PLS_INTEGER,
max_duration PLS_INTEGER
);
功能
FUNCTION getSubjectDuration(
subject_code IN PACKGE.SUBJ_CODE%type,
course_number IN PACKGE.CRSE_NUMB%type,
term_code IN PACKGE.EFF_TERM%type
)
RETURN subjectDuration
IS
record_rowid ROWID;
subject_duration subjectDuration;
BEGIN
...
/*function code */
RETURN(subject_duration);
END;
Grails的代碼調用上述功能
String packageCheck = "BEGIN packge.getSubjectDuration(:subjectCode, :courseNumber, :termCode); END; "
sql.call(packageCheck, [subjectCode: subjectCode, courseNumber: courseNumber, termCode: termCode],
// OracleTypes.OTHER is the wrong type. I need the correct type for RECORD, which doesn't exist in OracleTypes.
Sql.resultSet(OracleTypes.OTHER)) { cursorResults ->
if (cursorResults.next()) {
def result = cursorResults.getAt(0)
log.debug(result)
}
}