Hi all,
I need to call an Oracle stored procedure. The proc does not return anything, It takes 4 input and updates some dates on tables.
I find examples of this but all have something like:
{ ? = call PRC_UNFIT_FILER(?,?,?,?) }
What syntax do I use if the proc does not return a value?
I am using Hibernate3.
My map file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="edu.ndsu.table.data" default-cascade="save-update">
<sql-query name="ICC.PRC_UNFIT_FILER" callable="false">
{ ? = call PRC_UNFIT_FILER(?,?,?,?) }
</sql-query>
</hibernate-mapping>
I have no <return> set in the map, because I'm not sure what to do.
My Java code:
Session session = null;
session = HibernateUtil.getSession();
Query query = session.getNamedQuery("ICC.PRC_UNFIT_FILER");
query.setParameter(0, "12345");
query.setParameter(1, new Date());
query.setParameter(2, new Date());
query.setParameter(3, "UNINDSU"); int mylist = query.executeUpdate();
Of course, I;m not sure if executeUpdate() is correct either. Thsi code gets:
May 7, 2008 4:14:15 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Missing IN or OUT parameter at index:: 5
org.hibernate.exception.GenericJDBCException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:174)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
at edu.ndsu.uniface.test.UnifaceAccessorTest.main(UnifaceAccessorTest.java:68)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 5
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1681)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)
....
And last, the Oracle proc:
REATE OR REPLACE PROCEDURE ICC.PRC_UNFIT_FILER (p_inser_id in VARCHAR2, p_trans_date in DATE, p_eff_date in DATE,p_reg_username in VARCHAR2) as
BEGIN
<<main>>
DECLARE
w_inser_id VARCHAR2(5) := 'begin';
w_eff_date DATE;
... lots of SQL code
end;
Thanks, I appreciate any help.
|