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 =>
_operation_id,' + #13#10 +
' p_table =>
_table,' + #13#10 +
' p_statement =>
_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?
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_table =>

' p_statement =>

'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

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

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?