| Author |
How to use the getDate() method with a callable statement?
|
Jean Fore
Ranch Hand
Joined: Feb 23, 2006
Posts: 33
|
|
Hi, I have the following code. String str = "{? = call uspTestProcedure()}"; try { CallableStatement cs = con.prepareCall(str.toString()); cs.registerOutParameter(1, Types.DATE); cs.execute(); System.out.println("Store Proc result "+ ((Date)cs.getDate(1)).toString()); } catch(Exception ex) { System.out.println("Error while calling the stored procedure "+ex.getMessage());} } ------------------------------------------------- And I have the following stored procedure "uspTestProcedure" ------------------------------------------------------------- CREATE PROCEDURE dbo.uspTestProcedure(@dos datetime OUT) AS select @dos=UserBooks.DOS from UserBooks, Books where Books.bookid ='B000000001' GO But the callable statement execution is throwing the following ERROR. ----------------------------------------------------------- Error while calling the stored procedure [Microsoft][SQLServer 2000 Driver for J DBC][SQLServer]Procedure 'uspTestProcedure' expects parameter '@dos', which was not supplied. -------------------------------------------------------------------- Do you have any idea how to sort this out? Thanks -JEAN
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
I am not familiar with SQL server, but I guess problem at the place when you are calling your store procedure. You are prepearing your call as String str = "{? = call uspTestProcedure()}"; you should have defined the string as Shailesh
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
 |
|
|
subject: How to use the getDate() method with a callable statement?
|
|
|