ORA-00600: internal error code

Devil

Member²
Hi Marco!

I do GetInsertDataStatement function in loop, on first iteration this function executed successfully, but on second iteration i get oracle error:

ORA-00600: internal error code, arguments: [kolrrdl:0rfc], [], [], [], [], [], [], []
ORA-06512: at "SYS.DBMS_LOB", line 833
ORA-06512: at "MIGRATOR.OPERATION_PKG", line 120
ORA-06512: at line 2

function GetInsertDataStatement(const AOperationID: Integer;
const ATableName: string): string;
var
LOB: TLOBLocator;
begin
LOB := TLOBLocator.CreateTemporary(MigratorSession, otCLOB, False);
try
FQuery.SQL.Text := cInsertStatementSQL;

FQuery.DeleteVariables;
FQuery.DeclareVariable('p_operation_id', otInteger);
FQuery.SetVariable('p_operation_id', AOperationID);

FQuery.DeclareVariable('p_table', otString);
FQuery.SetVariable('p_table', ATableName);

FQuery.DeclareVariable('p_statement', otCLOB);
FQuery.SetComplexVariable('p_statement', LOB);
FQuery.Execute;
Result := LOB.AsString;
finally
LOB.Free;
end;
end;

const cInsertStatementSQL = 'begin' + #13#10 +
' mig.operation_pkg.get_insert_statement(p_operation_id => :p_operation_id,' + #13#10 +
' p_table => :p_table,' + #13#10 +
' p_statement => :p_statement);' + #13#10 +
'end;';

for i:= 0 to 5 do
begin
...
FQuery.SQL.Text := GetInsertDataStatement(i, 'table' + IntToStr(i);
...
end;

function specification in oracle package:

create or replace package mig.operation_pkg is
--Result: 'insert into table1(fld1,...) values(:fld1,...)'
procedure get_insert_statement(p_operation_id number, p_table varchar2, p_statement in out nocopy clob);
end operation_pkg;

p_statement is temporary clob parametr

I fix my problem here:
LOB := TLOBLocator.Create(MigratorSession, otClob);//CreateTemporary(MigratorSession, otCLOB, False);

and add in const cInsertStatementSQL after 'begin' line:
'dbms_lob.createtemporary(:p_statement, false, dbms_lob.call);'

It's work successfully for all iterations,
but in this case temporary lob locator not free by TLOBLocator, because not used constructor CreateTemporary.
What You think Marco?
 
The ORA-00600 error makes me think this is an Oracle bug. Which Oracle Client and Server version are you using?
 
Oracle Client: 9.2.0.1.0
Oracle Server: 10.2.0.2.0
DOA 4.0.6.1

Maybe I need use 10g client because my application will be executed with 10g client and server.

When will be as possible I checked this.

Thanks Marco.
 
It's work successfully work too.
For free temporary CLOB object i do next:

var
LOB: TLOBLocator;
begin
LOB := TLOBLocator.Create(MigratorSession, otClob);//CreateTemporary(MigratorSession, otCLOB, False);
try
//Create temporary CLOB object and fill this
FQuery.SQL.Text := cInsertStatementSQL;

FQuery.DeleteVariables;
FQuery.DeclareVariable('p_operation_id', otInteger);
FQuery.SetVariable('p_operation_id', AOperationID);

FQuery.DeclareVariable('p_table', otString);
FQuery.SetVariable('p_table', ATableName);

FQuery.DeclareVariable('p_statement', otCLOB);
FQuery.SetComplexVariable('p_statement', LOB);
FQuery.Execute;
Result := LOB.AsString;

//Delete temporary CLOB object
FQuery.SQL.Text := cFreeTemporarySQL;
FQuery.DeleteVariable('p_operation_id');
FQuery.DeleteVariable('p_table');
FQuery.Execute;
finally
LOB.Free;
end;
end;

const
cInsertStatementSQL = 'begin' + #13#10 +
' dbms_lob.createtemporary(:p_statement, false, dbms_lob.call);' + #13#10 +
' mig.operation_pkg.get_insert_statement(p_operation_id => :p_operation_id,' + #13#10 +
' p_table => :p_table,' + #13#10 +
' p_statement => :p_statement);' + #13#10 +
'end;';

cFreeTemporarySQL = 'begin' + #13#10 +
' dbms_lob.freetemporary(:p_statement);' + #13#10 +
'end;';

But i don't known, really temporary object is freed up :-(
 
Back
Top