oracle / dotnet-db-samples

.NET code samples for Oracle database developers #OracleDotNet
http://otn.oracle.com/dotnet
MIT License
408 stars 190 forks source link

Boolean data type not working on 11g #363

Closed iulianb closed 4 months ago

iulianb commented 4 months ago
PROCEDURE "TESTBOOL" (
  "PARAM1" IN BOOLEAN, 
  "PARAM2" OUT BOOLEAN) IS
BEGIN
    PARAM2 := PARAM1;
END;
string constr = "<Connection String>";
OracleConnection con = new OracleConnection(constr);
con.Open();

OracleCommand cmd = new OracleCommand("TESTBOOL", con);
cmd.CommandType = CommandType.StoredProcedure;

OracleParameter oparam = cmd.Parameters.Add("PARAM1", OracleDbType.Boolean);
oparam.Direction = ParameterDirection.Input;
oparam.Value = "True";

OracleParameter oparam2 = cmd.Parameters.Add("PARAM2", OracleDbType.Boolean);
oparam2.Direction = ParameterDirection.Output;

cmd.ExecuteNonQuery();

Console.WriteLine(oparam2.Value.ToString());
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.130" />
  </ItemGroup>

</Project>

This doesn't work on Oracle Database 11g Release 11.2.0.3.0 - 64bit Production. Fails with ORA-03115: unsupported network datatype or representation

alexkeh commented 4 months ago

Does the problem occur with a 19c ODP.NET Core driver?

Testing with newer ODP.NET Core 21c versions and DB 11.2 was limited as that DB version is no longer supported. The ODP.NET 21c doc does not list DB 11.2 as an officially supported version.

iulianb commented 4 months ago

tried with Oracle.ManagedDataAccess.Core 2.19.220 and 2.18.6, same outcome.

alexkeh commented 4 months ago

Reviewing the doc, I was reminded that managed ODP.NET only supports PL/SQL Booleans with Oracle DB 12.2 and higher. Since ODP.NET Core shares much of the same code with managed ODP.NET, this should also apply to ODP.NET Core. I'll confirm with my dev team and update the next version of the doc to reflect this.