I have a function in Oracle that returns a sequence number. When I try to get that value in C# by a parameter it always tells me that the parameter type is invalid. A sample value of that returned value is 115545. If indeed this error is correct then what is the correspondent in ODBCType for this value? If it isn't correct then what is the problem?
Oracle function is:
FUNCTION Get_Next_Message_Id__
RETURN NUMBER IS
temp_ NUMBER;
CURSOR get_in_message_id_seq IS
SELECT in_message_id_seq.NEXTVAL
FROM dual;
BEGIN
General_SYS.Init_Method(lu_name_, 'IN_MESSAGE_API', 'Get_Next_Message_Id__', TRUE);
OPEN get_in_message_id_seq;
FETCH get_in_message_id_seq INTO temp_;
CLOSE get_in_message_id_seq;
RETURN(temp_);
END Get_Next_Message_Id__;
C# Code:
OdbcConnection myConnection = new OdbcConnection(ODBC_CLass.ifsconnectionstring);
OdbcParameter next_id = new OdbcParameter();
next_id.Direction = ParameterDirection.Output;
myConnection.Open();
OdbcCommand command = new OdbcCommand("{? = call ifsapp.in_message_api.Get_Next_Message_Id__}", myConnection);
command.CommandType = CommandType.StoredProcedure;
next_id = command.Parameters.Add("temp_", OdbcType.Int);
int k = command.ExecuteNonQuery();
MessageBox.Show("next_id: " + next_id.Value);
SELECT in_message_id_seq.NEXTVAL INTO temp_ FROM dual;And don't use tabs when posting code, pls.