I seem to have encountered a short encounter with ODBC and DB2 when running stored procedures. It seems that it is not possible to return data from a stored procedure, and I have a preliminary request that I need to use. Has anyone got around this problem?
Thanks in advance
Update
The code I call looks like this (assuming the connection is already open):
string BaseSQL = "CALL B6009822.O#04666803.PUT";
OdbcCommand command = new OdbcCommand(BaseSQL, myConnection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Owner", OdbcType.VarChar).Value = "MH";
int rows = command.ExecuteNonQuery();
myConnection.Close();
I get the following error.
ERROR [HY000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0440 - Routine PUT in O#04666803 not found with specified parameters.
It seems to mind the name of the directory / library and the name of the procedure. Any idea on what I need to do to invoke the procedure?
Second update - a real example
string BaseSQL = "{ CALL B6009822.O#04666803.PUT(?,?,?,?,?,?,?,?,?) }";
OdbcCommand command = myConnection.CreateCommand();
command.CommandText = BaseSQL;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Param1", OdbcType.VarChar, 4).Value = "MH";
command.Parameters.Add("@Param2", OdbcType.Decimal, 8).Value = 20110217;
command.Parameters.Add("@Param3", OdbcType.Decimal, 4).Value = 1;
command.Parameters.Add("@Param4", OdbcType.Decimal, 8).Value = 178377;
command.Parameters.Add("@Param5", OdbcType.VarChar, 60).Value = "Description";
command.Parameters.Add("@Param6", OdbcType.Decimal, 9).Value = 0;
command.Parameters.Add("@Param7", OdbcType.Decimal, 9).Value = 45;
command.Parameters.Add("@Param8", OdbcType.Decimal, 9).Value = 0;
command.Parameters.Add("@Param9", OdbcType.VarChar, 10).Value = "*CREATE";
int rows = command.ExecuteNonQuery();
myConnection.Close();