Re: CallableStatement problem
On Apr 2, 6:07 am, Lew <l...@nospam.lewscanon.com> wrote:
Tom Hawtin <use...@tackline.plus.com> wrote:
Also note
"If used, the result parameter must be registered as an OUT parameter."
ros wrote:
The error that I get now is:
java.sql.SQLException: No output parameters registered.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
Tom already answered this part of the question.
-- Lew
I have tried this again. But get the same error:
// Create CallableStatement object
CallableStatement genid = conn.prepareCall("{? = call
GeneratePcId()}");
genid.registerOutParameter(1, java.sql.Types.INTEGER);
ResultSet rs = genid.executeQuery();
//genid.execute();
int number = rs.getInt(1);
CallableStatement cstmt = conn.prepareCall("{call
InsertPrice (?, ?, ?, ?, ?)}");
// Bind values to the parameters
cstmt.setInt(1, number );
cstmt.setInt(2, 8);
cstmt.setInt(3, 600);
cstmt.setDate(4, Date.valueOf("2008-01-01"));
cstmt.setDate(5, Date.valueOf("2008-02-02"));
// Execute the query
cstmt.execute();
Can you see what the error is?
Cheers
ros