Re: how to call an oracle function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Newbie" wrote...
> already tried changing OracleDbType.Int32 to OracleType.Int32
> but still getting the same exception

Did you name the parameters?

What is the *real* name of the input parameter?

Did you use that name?

Are there *more* parameters in the stored function than the input parameter
and the return value?

Did you get the "no length on String" error, even when you used
OracleType.Int32?


>> OracleCommand cmd = new OracleCommand();
>> cmd.Connection = oraConn;
>> cmd.CommandText = "ops$sqltime.pa_new_job_no_fn";
>> cmd.CommandType = CommandType.StoredProcedure;
>>
>> OracleParameter par1 =
>> new OracleParameter("RETURN_VALUE", OracleType.Int32);
>> par1.Direction = ParameterDirection.ReturnValue;
>> cmd.Parameters.Add(par1);
>>
>> // It's best to check what the input parameter *really* is
>> // named in the stored function, and to use that name...
>>
>> par1 = new OracleParameter("PROJECT_NO", OracleType.Int32);
>> par1.Value = projectNo;
>> par1.Direction = ParameterDirection.Input;
>> cmd.Parameters.Add(par1);
>>
>> int affectedRows = (int) cmd.ExecuteNonQuery();
>>
>> ljn = (int) cmd.Parameters["RETURN_VALUE"].Value;

// Bjorn A



.



Relevant Pages

  • Design to mitigate Exception constraint
    ... I need to create a web service that accepts exception info & publishes it to ... SQL. ... I thought such a service would accept an input parameter of type ...
    (microsoft.public.dotnet.general)
  • Re: Enum Idiom Question
    ... assuming we agree that an exception is overkill for a case where an ... input parameter is just miscoded? ...
    (comp.lang.java.programmer)
  • Re: Enum Idiom Question
    ... Is PadResult or something like it my best alternative ... input parameter is just miscoded? ... I'm just looking for alternatives to throwing an exception to ... overkill for relatively minor things like bad input parameters and that they ...
    (comp.lang.java.programmer)
  • Re: Exception as Parameter
    ... Is that possible to use exception as an input parameter in IDL ... treat exceptions as first-class types so if IDL made them first-class types, this would lead to awkward mappings for such languages. ...
    (comp.object.corba)
  • Re: Enum Idiom Question
    ... On 5/28/2010 8:54 PM, Rhino wrote: ... assuming we agree that an exception is overkill for a case where an ... input parameter is just miscoded? ...
    (comp.lang.java.programmer)