Problem with Oracle CLOB field
Moderators: gto, EgonHugeist
Problem with Oracle CLOB field
Hello!
I have a problem with a clob inside a query
SELECT id, clob_field, other_columns FROM table;
In all returned rows a value of clob field is the same, the value of the last row of a table. The rest of fields is properly changing.
If the same query is used for each record separately a value of the clob field is adequate.
Any suggestions?
My environment:
- Oracle 11.1.0.1.0
- ZEOS 6.6.4
- Delphi 7
I have a problem with a clob inside a query
SELECT id, clob_field, other_columns FROM table;
In all returned rows a value of clob field is the same, the value of the last row of a table. The rest of fields is properly changing.
If the same query is used for each record separately a value of the clob field is adequate.
Any suggestions?
My environment:
- Oracle 11.1.0.1.0
- ZEOS 6.6.4
- Delphi 7
Hello,
I have the same problem.
I identified that the fields whose value is null don't reads the value of the last record.
I imagine the problem lies in defining the pointer. In ZDbcOracleResultSet unit, in TZOracleResultSet.GetBlob method.
I'm trying to identify the source of the problem. Any breakthrough will communicate.
Josimar.
I have the same problem.
I identified that the fields whose value is null don't reads the value of the last record.
I imagine the problem lies in defining the pointer. In ZDbcOracleResultSet unit, in TZOracleResultSet.GetBlob method.
I'm trying to identify the source of the problem. Any breakthrough will communicate.
Josimar.
Hello!
I'm debugging and will be found some news.
In the unit ZDbcOracleResultSet, TZOracleResultSet.GetBlob mthod create the pointer to the CLOB field content:
The LobLocator pointer value is always the same.
The TZOracleBlob.ReadBlob method, read the CLOB field value. When the content is NULL or empty, the value is read correctly.
I could not identify when the pointer value is set.
Any breakthrough will communicate.
Josimar.
I'm debugging and will be found some news.
In the unit ZDbcOracleResultSet, TZOracleResultSet.GetBlob mthod create the pointer to the CLOB field content:
Code: Select all
GetSQLVarHolder(ColumnIndex);
CurrentVar := @FOutVars.Variables[ColumnIndex];
if CurrentVar.TypeCode in [SQLT_BLOB, SQLT_CLOB] then
begin
if CurrentVar.Indicator >= 0 then
LobLocator := PPOCIDescriptor(CurrentVar.Data)^
else LobLocator := nil;
Connection := GetStatement.GetConnection as IZOracleConnection;
Result := TZOracleBlob.Create(FPlainDriver, nil, 0, Connection, LobLocator,
CurrentVar.ColType);
end
{...}
The TZOracleBlob.ReadBlob method, read the CLOB field value. When the content is NULL or empty, the value is read correctly.
I could not identify when the pointer value is set.
Any breakthrough will communicate.
Josimar.
Good news!
I kicked a code that solved the problem.
Theoretically, this change seems to have no effect. But in practice it worked.
The change was in the ZDbcOracleResultSet unit, the GetBlob method of the TZOracleResultSet class. Soon after creating the object TZOracleBlob, run with a call to ReadBlob with typecast to IZOracleBlob:
With this change the reading and writing blobs is occurring normally.
Josimar.
I kicked a code that solved the problem.
Theoretically, this change seems to have no effect. But in practice it worked.
The change was in the ZDbcOracleResultSet unit, the GetBlob method of the TZOracleResultSet class. Soon after creating the object TZOracleBlob, run with a call to ReadBlob with typecast to IZOracleBlob:
Code: Select all
GetSQLVarHolder(ColumnIndex);
CurrentVar := @FOutVars.Variables[ColumnIndex];
if CurrentVar.TypeCode in [SQLT_BLOB, SQLT_CLOB] then
begin
if CurrentVar.Indicator >= 0 then
LobLocator := PPOCIDescriptor(CurrentVar.Data)^
else LobLocator := nil;
Connection := GetStatement.GetConnection as IZOracleConnection;
Result := TZOracleBlob.Create(FPlainDriver, nil, 0, Connection, LobLocator,
CurrentVar.ColType);
(Result as IZOracleBlob).ReadBlob; // MY CHANGE
end
else
{...}
Josimar.