amaach amaach - 1 year ago 392
C# Question

Boolean in OracleDbType

what is Oracle equivalent for Boolean? I have this function where I need to pass onlineFiling to a stored procedure as bool but apparently Oracle don't have Boolean in its OracleDbType. How do I do this? thanks

public List<MModel> GetReportData(DateTime startDateTime, DateTime endDateTime, bool onlineFiling)
var managementModel = new List<ManagementModel>();
var oracCmd = new OracCommand(1);
oracCmd.AddInParameter(OracleDbType.Date, "I_STARTDATE", startDateTime));
oracCmd.AddInParameter(OracleDbType.Date, "I_ENDDATE", endDateTime));
oracCmd.AddInParameter(OracleDbType.???, "I_ONLINE", onlineFiling));
//rest of code here

Answer Source

Look at the Oracle Data Provider documentation at Data Provider for .NET Developer's Guide. ODP does not seem to support boolean.

One option could be to use Char instead or Number with 1/0.

Also you should have a look at following SO posts:

"Boolean" parameter for Oracle stored procedure

How to pass boolean parameter to Oracle procedure C#

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download