1

尝试调用 PLSQL 存储过程并遇到这个我无法解决的错误。存储过程接受 5 个参数并返回一个游标和一条错误消息。所有参数都是varchar2,错误信息是varchar2。

方法:

List fetchEmployees(){
    List employeeList = []
    Sql sql = new groovy.sql.Sql(dataSource)
    sql.call("BEGIN package.p_get_employees(?,?,?,?,?,?,?); END;",
        [code1,code2,code3,code4,code5,Sql.resultSet(OracleTypes.CURSOR),Sql.resultSet(OracleTypes.VARCHAR)])
    {cursorResults ->

                while(cursorResults.next()){
                    def person = new Person()
                    person.setEmail(cursorResults.getAt(1))
                    person.setNetid(cursorResults.getAt(0))
                    employeeList.add(person)
                }
    }

    return employeeList
}

当我尝试通过这个时,我得到了这个错误:

Caused by: java.sql.SQLException: org.apache.commons.dbcp.DelegatingCallableStatement with address: "oracle.jdbc.driver.T4CCallableStatement@e76514" is closed.
...
4

0 回答 0