Skip to content

Commit 04e3124

Browse files
author
Jacek Gębal
committed
Changed Reporter initialization to use UT_OUTPUT_REPORTER_BASE instead of UT_REPORTER_BASE.
Oracle JDBC 23.x sends the reporter STRUCT typed as UT_OUTPUT_REPORTER_BASE. Assigning UT_OUTPUT_REPORTER_BASE to a concrete subtype variable fails with PLS-00382
1 parent a39d748 commit 04e3124

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/java/org/utplsql/api/outputBuffer/DefaultOutputBuffer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class DefaultOutputBuffer extends AbstractOutputBuffer {
2929
protected CallableStatement getLinesCursorStatement(Connection conn) throws SQLException {
3030
Reporter reporter = getReporter();
3131
String plsql = "DECLARE" +
32-
" l_rep " + reporter.getTypeName() + "; " +
32+
" l_rep " + reporter.getTypeName() + " := " + reporter.getTypeName() +"(); " +
3333
"BEGIN" +
34-
" l_rep := treat(:2 as " + reporter.getTypeName() + ");" +
35-
" :1 := l_rep.get_lines_cursor(); " +
34+
" l_rep.set_reporter_id(:1); " +
35+
" :2 := l_rep.get_lines_cursor(); " +
3636
"END;";
3737
OracleCallableStatement cstmt = (OracleCallableStatement) conn.prepareCall(plsql);
38-
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
39-
cstmt.setORAData(2, reporter);
38+
cstmt.setString(1, reporter.getId());
39+
cstmt.registerOutParameter(2, OracleTypes.CURSOR);
4040
return cstmt;
4141
}
4242
}

src/main/java/org/utplsql/api/reporter/Reporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Reporter init(Connection con) throws SQLException {
6868
*/
6969
private void initDbReporter(OracleConnection oraConn, ReporterFactory reporterFactory) throws SQLException {
7070
OracleCallableStatement callableStatement = (OracleCallableStatement) oraConn.prepareCall("{? = call " + selfType + "()}");
71-
callableStatement.registerOutParameter(1, OracleTypes.STRUCT, "UT_OUTPUT_REPORTER_BASE");
71+
callableStatement.registerOutParameter(1, OracleTypes.STRUCT, "UT_REPORTER_BASE");
7272
callableStatement.execute();
7373

7474
Reporter obj = (Reporter) callableStatement.getORAData(1, reporterFactory);

0 commit comments

Comments
 (0)