If a table contains an empty BLOB, OracleDataReader.GetValues() and OracleDataReader.GetValue() will just return null for that value, when InitialLOBFetchSize is set to -1 (not even DbNull, but just null). When specifying 0 or a positive value for InitialLOBFetchSize I get an empty byte array as expected.
Is there some way to configure this, that I get the fast loading for other BLOBs, and not null for empty BLOBs?
And is there a reason when GetValue() would return null, or should it always be just the database value or DbNull (and this is just a bug in Oracle)?
Test data:
CREATE TABLE FOO (BLOB1 BLOB);
declare
emptyBlob BLOB;
begin
dbms_lob.createtemporary(emptyBlob, false);
INSERT INTO FOO VALUES (emptyBlob);
end;
Executing this code, GetValue(0) returns null.
var cmd = new OracleCommand("SELECT BLOB1 FROM FOO", conn)
{
InitialLOBFetchSize = -1,
};
var reader = cmd.ExecuteReader();
reader.Read();
Trace.Assert(reader.GetValue(0) != null);
Tested with Oracle.ManagedDataAccess 21.5.0 and Oracle.ManagedDataAccess.Core 3.21.50 with 19c server.