Problems with default parameters in function

Problems with default parameters in function

Postby maxcpr » Wed 18 Feb 2009 10:35

Hi. Looks like there is problem when invoke function with default parameters. When i use in function default parameter conjuction with
CheckParams = true, in function passed not default values but NULL's.

For example:

Oracle Function:

create or replace function Create_TestForDefaults
(
niClass number,
dtiPlanPayDate date default TO_DATE('1980-07-02','YYYY-MM-DD'),
niCurrency varchar2 default 'DEF'
) return number
as
begin
raise_application_error( -20000, niClass || ':' || dtiPlanPayDate || ':' || niCurrency);
return 1;
end Create_TestForDefaults;


C# code:

CoreLab.Oracle.OracleConnection oraConnect = new CoreLab.Oracle.OracleConnection("User Id=***;Password=***;Server=***");

try
{

oraConnect.Open();

CoreLab.Oracle.OracleCommand oraCommand = new CoreLab.Oracle.OracleCommand("NB.Create_TestForDefaults", oraConnect);

oraCommand.CommandType = CommandType.StoredProcedure;

oraCommand.ParameterCheck = true;

oraCommand.Parameters.Add("niClass", CoreLab.Oracle.OracleDbType.Number).Value = 1;


oraCommand.Parameters.Add("RESULT", CoreLab.Oracle.OracleDbType.Number).Direction = ParameterDirection.ReturnValue;

oraCommand.ExecuteNonQuery();

oraConnect.Close();
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
finally
{
if (oraConnect.State == ConnectionState.Open)
oraConnect.Close();
}

In message window will bee shown: "1::" but have to been "1:1980-07-02:DEF"

Please help.
maxcpr
 
Posts: 33
Joined: Wed 10 Dec 2008 14:46

Postby Shalex » Fri 20 Feb 2009 13:48

We have answered you by e-mail. This behaviour is as designed.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle