OracleBoolean Structure

The OracleBoolean structure represents a logical value that is either TRUE or FALSE.

ODP.NET, Unmanaged Driver can access Oracle Database PL/SQL Booleans in Oracle Database Release 12.1 and later. ODP.NET Core and ODP.NET, Managed Driver can access Oracle Database PL/SQL Booleans in Oracle Database Release 12.2 and later. Starting with version 23, all ODP.NET providers support Boolean table columns introduced in Oracle Database 23ai.

OracleBoolean can use the following string literals as TRUE or FALSE values. These values are accepted in a case insensitive manner.

Table 14-14 Accepted OracleBoolean Values

TRUE values False values

true

false

t

f

yes

no

y

n

on

off

1

0

If whitespace is present before or after the string literals, then the whitespace is not considered upon .NET Boolean conversion.

If the string literals are anything other than those listed above, then an InvalidCastException will be returned when trying to read the value.

Class Inheritance

System.Object

  System.ValueType

    Oracle.DataAccess.Types.OracleBoolean

Declaration

// C#
public struct OracleBoolean : IComparable, INullable, IXmlSerializable

Requirements

Provider ODP.NET, Unmanaged Driver ODP.NET, Managed Driver ODP.NET Core

Assembly

Oracle.DataAccess.dll

Oracle.ManagedDataAccess.dll

Oracle.ManagedDataAccess.dll

Namespace

Oracle.DataAccess.Client

Oracle.ManagedDataAccess.Client

Oracle.ManagedDataAccess.Client

.NET Framework

See System Requirements

See System Requirements

-

.NET (Core)

-

-

See System Requirements

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Remarks

A OracleBoolean structure represents three possible values: TRUE, FALSE, and NULL. A non-zero value is interpreted as TRUE.

Example

// C#
using System;
using System.Data;
using Oracle.DataAccess.Types; // for use with ODP.NET, Unmanaged Driver
// using Oracle.ManagedDataAccess.Types; // for use with ODP.NET, Managed Driver
 
 class OracleBooleanSample
 {
    static void Main(string[] args)
    {
      OracleBoolean oracleBoolean1 = new OracleBoolean(true);
      OracleBoolean oracleBoolean2 = new OracleBoolean(0);
 
      Console.WriteLine("oracleBoolean1 : " + oracleBoolean1);
      Console.WriteLine("oracleBoolean2 : " + oracleBoolean2);
    }
 }