ado.net - what are the OleDbTypes associated with Oracle Number and varchar2 when calling a function -


I am trying to map the OleDb parameter to the Oracle function. I was able to do this using the System.Data.Oracle Namespace, but found that it is depricated, so I thought I would rewrite it as OldDb to avoid installing the Oracle provider.

I have defined the following Oracle function as an example:

  function getImagePath (AIRSNumber in number) returns varchar2 returns' \\ aiimg524 \ images \ Ofndrtrk \ 2010 \ 01 \ 0kvrv1p000lcs74j '; End;  

And I'm calling it using the following code:

 using  (var command = new normal command ()) {command.Connection = Con; Command.CommandText = Configuration Manager. App settings [OTRAK_PHOTO_FUNC]; Type the command. Type command = command type Stored procedure; String Perm = Configuration Manager App settings [OTRAK_PHOTO_PARM]; Command. Parameter. Add (Parm, Olendi Type DCIL); // Map for Oracle number command. Parameter [parm]. Direction = Parameter Direction Input; order. Parameter [parm]. Value = ARSNumber; order. Parameter. Add (RETURN_VALUE, OleDbType.Variant); // map oracle varchar2 command Parameter [Return_GAR] Direction = Parameter Direction Return value; Try {con.Open (); Command.ExecuteNonQuery (); Path = command.Parameters [RETURN_VALUE] Valal.ToString (); }  

I tried a group of different ODDB types for parameter and return value. The current effort is from a mapping table found on the web. I said that number = decimal and varchar2 = variant. I am trying to determine the order of the types of the bees and ask for help. I do not find any useful error messages:

[System.Data.OleDb.OleDbException] = {"ORA-06550: line1, column 7: \ nPLS-00306: wrong number or In the call 'GETIMAGEPATH' call type \ nORA-06550: line1, column 7: \ n pll / sq: keeping in mind the statement "}

It was actually nothing with the type of parameter, but the OleDb provider for the order oracle used the parameter collection Do not respect the names of the parameters, but the parameters are added. When calling an oracle function, the return value is a free parameter that must be declared first. By adding my return value parameter and then the actual function parameter things started to work.

Use the command. Parameters.AddWithValue (parm, value) makes things simple.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -