Home » Developer & Programmer » Precompilers, OCI & OCCI » Error inserting XML records > 4000 bytes (Oracle Release 11.2.0.2.0, Pro*C/C++ release 11.2.0.0.0, SunOS 5.10)
Error inserting XML records > 4000 bytes [message #532647] Wed, 23 November 2011 13:37
hnnagaraj
Messages: 1
Registered: November 2011
Junior Member
Hi,

I am seeing the following error while trying to insert XML records > 4000 bytes (Records < 4000 bytes get inserted without any issues). Any help in resolving the issue would be highly appreciated.

ORA return text: ORA-01461: can bind a LONG value only for insert into a LONG column.

I am also able to insert records > 4000 bytes using the following query, But, I want to insert the records through a C application (using Pro*C):

INSERT INTO MY_XML_TABLE
VALUES (XMLType(bfilename('XML_DIR', 'MY_FILE.XML'),
nls_charset_id('AL32UTF8')));

Oracle Version
===============
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

Pro*C/C++ version:
====================
Pro*C/C++ RELEASE 11.2.0.0.0 - PRODUCTION


Schema registration:
====================

begin
DBMS_XMLSCHEMA.registerSchema (
SCHEMAURL => 'MY_XML_SCHEMA.xsd',
SCHEMADOC => bfilename ('ENG_REPORTS', 'MY_XML_SCHEMA.xsd'),
GENTYPES => FALSE,
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
CSID =>nls_charset_id ('AL32UTF8'));
end;

Table creation
===============
CREATE TABLE MY_XML_TABLE (
MY_XML_RECORD XmlType )
XMLTYPE MY_XML_RECORD STORE AS BINARY XML
XMLSCHEMA "MY_XML_SCHEMA.xsd" ELEMENT "MYXMLTAG" ;


Record Insertion (Pro*C generated code):
=========================================

/* EXEC SQL FOR :l_sizeof_array_togo
insert INTO MY_XML_TABLE
(MY_XML_RECORD )
VALUES( XMLTYPE(:l_XML_ptr INDICATOR :l_XML_indicators )); */

{
struct sqlexd sqlstm;
sqlstm.sqlvsn = 12;
sqlstm.arrsiz = 1;
sqlstm.sqladtp = &sqladt;
sqlstm.sqltdsp = &sqltds;
sqlstm.stmt = "insert into MY_XML_TABLE (MY_XML_RECORD) values (XMLTYPE(:s1\
:s2 ))";
sqlstm.iters = (unsigned int )l_sizeof_array_togo;
sqlstm.offset = (unsigned int )20;
sqlstm.cud = sqlcud0;
sqlstm.sqlest = (unsigned char *)&sqlca;
sqlstm.sqlety = (unsigned short)4352;
sqlstm.occurs = (unsigned int )0;
sqlstm.sqhstv[0] = (unsigned char *)&l_XML_ptr->xml_record;
sqlstm.sqhstl[0] = (unsigned long )8002;
sqlstm.sqhsts[0] = ( int )sizeof(struct xml_rec_definition);
sqlstm.sqindv[0] = ( short *)&l_XML_indicators->XML_record_ind;
sqlstm.sqinds[0] = ( int )sizeof(struct XML_indicator);
sqlstm.sqharm[0] = (unsigned long )0;
sqlstm.sqadto[0] = (unsigned short )0;
sqlstm.sqtdso[0] = (unsigned short )0;
sqlstm.sqphsv = sqlstm.sqhstv;
sqlstm.sqphsl = sqlstm.sqhstl;
sqlstm.sqphss = sqlstm.sqhsts;
sqlstm.sqpind = sqlstm.sqindv;
sqlstm.sqpins = sqlstm.sqinds;
sqlstm.sqparm = sqlstm.sqharm;
sqlstm.sqparc = sqlstm.sqharc;
sqlstm.sqpadto = sqlstm.sqadto;
sqlstm.sqptdso = sqlstm.sqtdso;
sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}

[Updated on: Wed, 23 November 2011 15:15]

Report message to a moderator

Previous Topic: reconnect proc if disconnect
Next Topic: Problems with OCCI on Linux RHEL5.5
Goto Forum:
  


Current Time: Tue Sep 02 15:49:59 CDT 2014

Total time taken to generate the page: 0.11084 seconds