get对象上抛出了无效的列索引错误。 正在调用Proc并设置参数的Java代码:
public Object[] order(HttpServletRequest request,
String userId,
String tName,
String aCodes,
String aFinCodes,
String oType,
int iBase,
String cFinCodes
) throws xyzSqlException{
Connection conn = null;
CallableStatement cstmt=null;
ResultSet rsTempHead = null;
ResultSet rsTempDetails = null;
int notdisplayedRows = 0;
Object[] oTempList = null;
ds = getDataSource(installBase);
try
{
conn = ds.getConnection();
OrdEntDTO tempDetailsDTO= null;
cstmt = conn.prepareCall("{call get_temp_details (?,?,?,?,?,?,?,?,?)}");
cstmt.setString(1,userId);
cstmt.setString(2,tName);
cstmt.setString(3,aCodes);
cstmt.setString(4,Utility.convertSQLStringIN(aFinCodes,","));
cstmt.setString(5,oType);
cstmt.registerOutParameter(6, -10);
cstmt.registerOutParameter(7, -10);
cstmt.registerOutParameter(8,Types.NUMERIC);
cstmt.setString(9,Utility.convertSQLStringIN(cFinCodes,","));
rsTemplateHeader =(ResultSet)cstmt.getObject(6);
rsTemplateDetails =(ResultSet)cstmt.getObject(7);
notdisplayedRows = cstmt.getInt(8);
logger.debugMsg("The notdisplayedRows " + notdisplayedRows);
int listIndex = 0;
if(rsTemplateDetails != null)
{
oTempList = new Object[501] ;
}
}
错误:
[3/9/17 17:23:43:771 IST] 00000030 SystemOut O 2017-03-09 17:23:43,771
FATAL dao.OEntryDAO - Sql Exception Occured :- Invalid column index
[3/9/17 17:23:43:831 IST] 00000030 SystemOut O 2017-03-09 17:23:43,824 ERROR dao.OEntryDAO - Sql Exception Occured :- Invalid column index
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1571)
at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
at com.ibm.ws.rsadapter.jdbc.WSJdbcCallableStatement.getObject(WSJdbcCallableStatement.java:782)
at dao.ODAO.order(OEntryDAO.java:1762)
at action.OEntryTempAction.execute(OEntryTempAction.java:184)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at Servlet.doGet(WebpartsServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1602)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:80)
步骤:
CREATE OR REPLACE PROCEDURE get_temp_details (userid IN VARCHAR2,
tname IN VARCHAR2,
acode IN VARCHAR2,
afincode IN VARCHAR2,
otype IN VARCHAR2,
refcur1 OUT sys_refcursor,
refcur2 OUT sys_refcursor,
temp_ord_status OUT NUMBER,
cFinCodes IN VARCHAR2
)
错误背后的原因是什么?如果需要,将提供更多代码。