Create XMLType to insert xml in Oracle

_bas_

Member
I want to insert XML in the database, using the XMLType.

var
LXMLType: TXMLType;
begin
LXMLType := TXMLType.Create(OracleSession, 'Hello World');

This constructor raises the following exception:
First chance exception at $760EC41F. Exception class EOracleError with message 'OCI-21500: internal error code, arguments: [58], [], [], [], [], [], [], []
OCI-21500: internal error code, arguments: [kghfrh:ds], [0x691C188], [], [], [], [], [], []
'. Process MyService.exe (7888)

What goes wrong here?

Oracle: 11
DOA: 4.0.7
Delphi: 2006

Thanks,
Bas
 
Last edited:
Same exception when I try DOA 4.1.1.

procedure TXMLType.SetXML(const XMLData: string);
var
XMLDataCLOB: TLOBLocator;
begin
CreateQuery;
XMLDataCLOB := CreateXMLDataCLOB;
try
XMLDataCLOB.AsString := XMLData;
Query.DeclareVariable('doa_object', otObject);
Query.SetComplexVariable('doa_object', Self);
Query.DeclareVariable('xmldata', otCLOB);
Query.SetComplexVariable('xmldata', XMLDataCLOB);
with Query.SQL do
begin
Add('begin');
Add(' :doa_object := sys.xmltype.createxml(:xmldata);');
Add('end;');
end;
Query.Execute;
 
Last edited:
The Oracle 10.2 client is not really stable with XMLTYPE instances. If possible, prevent the creation and fetching of XMLTYPE instances by using the XMLTYPE.GetClobVal() function in select queries and the XMLTYPE.CreateXML() in insert and update queries.
 
Back
Top