OCCI & ORA -21500
Hi...
This is agustin.
I am getting the oracle error while runnning my c++ appln..
which uses occi for connecting and accessing db.
the error is ora-21500
internal error code..
please i ma not able to get into this,,
any one tell me what may be the problem
Message was edited by:
user619638
Shiyer,
libmoxa.so is the library I have created which is performing the oracle queries..
The pool is created from the main thread by:
Environment _env = Environment::createEnvironment (Environment::DEFAULT);
ConnectionPool connectionpool = _env->createConnectionPool(
username, passwd, tnsname, 1, 10, 1);
And then each query is used run inside a connect initiated with:
Connection *conn = connectionpool->createConnection(_username.c_str(), passwd.cstr());
Statement *stmt = conn->createStatement("select 1 from dual;");
ResultSet *rset = stmt->executeQuery();
while( rset->next() == rset->DATA_AVAILABLE ) {
std::cout << rset->getInt(1) << std::endl;
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
and connection released with:
connectionpool->terminateConnection(conn);
Hope this helps!
cheers
James
Similar Messages
-
Hi,
I've been getting this seg fault using OCCI, my environment:
Oracle client 10.2.0.4.1 x86_64 (jul 2009) on rhel5.4
Oracle database 9.2.0.8 x86_64 on rhel4.8
I've written a g++ multi thread app that is making use of Connection Pooling, within 5 minutes of my app starting it seg faults with:
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
ORA-21500: internal error code, arguments: [17099], [], [], [], [], [], [], []
Errors in file :
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
ORA-21500: internal error code, arguments: [17099], [], [], [], [], [], [], []
----- Call Stack Trace -----
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
ORA-21500: internal error code, arguments: [17099], [], [], [], [], [], [], []
Errors in file :
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
ORA-21500: internal error code, arguments: [17099], [], [], [], [], [], [], []
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
calling call entry argument values in hex
location type point (? means dubious value)
Cannot seek to string table section header in /proc/8712/exe.
Cannot seek to string table section header in /proc/8712/exe.
Segmentation fault
its compiled against gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
I've tried the following:
Installing the occi download from http://www.oracle.com/technology/tech/oci/occi/occidownloads.html and compiling with gcc-3.4.6
I'm using the following commands to compile & link:
g++ -DMOXA_DEBUG -I/database/u00/app/oracle/product/10.2.0/db_1/rdbms/demo -I/database/u00/app/oracle/product/10.2.0/db_1/rdbms/public -I/database/u00/app/oracle/product/10.2.0/db_1/plsql/public -I/database/u00/app/oracle/product/10.2.0/db_1/network/public -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/DB_Table.d" -MT"src/DB_Table.d" -o"src/DB_Table.o" "../src/DB_Table.cpp"
g++ -L/database/u00/app/oracle/product/10.2.0/db_1/rdbms/lib -L/database/u00/app/oracle/product/10.2.0/db_1/lib -shared -o"libmoxa.so" ./src/DB_Table.o ./src/Dialup.o ./src/Modem.o ./src/Rtu.o ./src/Rtu_Type.o ./src/Session.o ./src/Session_Log.o ./src/Soe_Point.o ./src/Soe_Point_Event.o ./src/Thread.o ./src/Utils_Time.o ./src/db.o -locci10_343 -lclntsh -ldl -lm
I've tried to do a -locci10 instead of the -locci10_343, still nothing..
Intesting to note, the older version of the application on the same environment doesn't have this problem..
I do know OCCI is a bit tempremental, especially when creating threads, as i've had to put a 100ms delay otherwise i get other errors
the back trace looks like, it allways core dumps when releasing the connection..
#0 0x00002b01b9fd8cae in slrac () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
(gdb) bt
#0 0x00002b01b9fd8cae in slrac () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#1 0x00002b01b9fd8b3d in kgdsaaddr () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#2 0x00002b01b9fd83b8 in kgdsdst () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#3 0x00002b01b9c7f0b0 in skgudmp () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#4 0x00002b01b9fb27ac in kgeriv () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#5 0x00002b01b9fb2fab in kgesiv () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#6 0x00002b01b9fb2ace in kgesic0 () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#7 0x00002b01b9ace52d in kpuhhfre () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#8 0x00002b01b9ad9a3a in kpuhmcfre () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#9 0x00002b01b9a6ca5a in kputac () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#10 0x00002b01b9b8265a in kpuspsessionrelease () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#11 0x00002b01b9be1d6f in OCISessionRelease () from /database/u00/app/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
#12 0x00002b01b95452f1 in oracle::occi::ConnectionImpl::do_destroy () from /home/fep/moxa_1.3/libmoxa/Debug/libmoxa.so
#13 0x00002b01b954d78c in oracle::occi::ConnectionPoolImpl::terminateConnection () from /home/fep/moxa_1.3/libmoxa/Debug/libmoxa.so
#14 0x00002b01b953c47c in DB::release_connection (conn=0xed36498) at ../src/db.cpp:126
I'm downloading the 11.2g client in the hope it works there without a hitch..
Any help/suggestions whould be much appreciated..
Cheers
JamesShiyer,
libmoxa.so is the library I have created which is performing the oracle queries..
The pool is created from the main thread by:
Environment _env = Environment::createEnvironment (Environment::DEFAULT);
ConnectionPool connectionpool = _env->createConnectionPool(
username, passwd, tnsname, 1, 10, 1);
And then each query is used run inside a connect initiated with:
Connection *conn = connectionpool->createConnection(_username.c_str(), passwd.cstr());
Statement *stmt = conn->createStatement("select 1 from dual;");
ResultSet *rset = stmt->executeQuery();
while( rset->next() == rset->DATA_AVAILABLE ) {
std::cout << rset->getInt(1) << std::endl;
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
and connection released with:
connectionpool->terminateConnection(conn);
Hope this helps!
cheers
James -
Hello,
What is the meaning of the ORA-21500 message? Don't know what to do with this error code!I think you should search through the Metalink with the parameters of the error code or log an iTAR if possible.
21500, 00000, "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
// *Cause: This is the generic error number for the OCI
// environment (client-side) internal errors. This indicates
// that the OCI environment has encountered an exceptional
// condition.
// *Action: Report as a bug - the first argument is the internal error number. -
ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]
I searched this forum for posts on this error. Most posts indicate a incompatible client and server causes this error. I'm running 9.2.0.4 on my desktop and our server is running 9.2.0.6. Is this ok or do I need to upgrade my client? Thanks.
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Sep 18 07:18:46 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production1. Can you try changing the definition of the object_id as follows..
SQL> set echo on
SQL> spool testcase.log
SQL> --
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> --
SQL> define USERNAME = OTNTEST
SQL> --
SQL> def PASSWORD = OTNTEST
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user OTNTEST cascade
User dropped.
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to OTNTEST identified by OTNTEST
Grant succeeded.
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to OTNTEST
Grant succeeded.
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to OTNTEST
Grant succeeded.
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user OTNTEST default tablespace USERS temporary tablespace TEMP
User altered.
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://www.oracle.com/pwb_user_agg.xsd';
3 :schemaPath := '/public/pwb_user_agg.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> create or replace directory XMLDIR as 'c:\xdb\otn'
2 /
Directory created.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<schema xmlns="http://www.w3.org/2001/XMLSchema"
5 targetNamespace="http://www.oracle.com/pwb_user_agg.xsd" version="1.0"
6 xmlns:xdb="http://xmlns.oracle.com/xdb"
7 elementFormDefault="qualified">
8 <element name = "User">
9 <complexType>
10 <sequence>
11 <element name = "UserID" type = "positiveInteger"/>
12 <element name = "UserName" type = "string"/>
13 <element name = "PhoneNumber" type = "string"/>
14 <element name = "LAN" type = "string"/>
15 <element name = "CreateDate" type = "date"/>
16 <element name = "UserPlans" maxOccurs = "unbounded">
17 <complexType>
18 <sequence>
19 <element name = "PlanName" type = "string" />
20 <element name = "EFTFlag" type = "string"/>
21 <element name = "DefaultPlan" type = "string"/>
22 </sequence>
23 </complexType>
24 </element>
25 </sequence>
26 </complexType>
27 </element>
28 </schema>');
29 begin
30 if (dbms_xdb.existsResource(:schemaPath)) then
31 dbms_xdb.deleteResource(:schemaPath);
32 end if;
33 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
34 end;
35 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,TRUE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> create table pwb_user
2 (
3 USER_ID NUMBER(38) NOT NULL ,
4 USER_LAST_NAME VARCHAR2(30) NOT NULL ,
5 USER_FIRST_NAME VARCHAR2(30),
6 USER_MIDDLE_INITIAL VARCHAR2(1),
7 USER_LAN_ACCOUNT VARCHAR2(30) NOT NULL ,
8 USER_TIMESTAMP DATE NOT NULL,
9 USER_PHONE_NBR VARCHAR2(20)
10 )
11 /
Table created.
SQL> create table pwb_user_plan
2 (
3 USPL_ID NUMBER(38) NOT NULL ,
4 USPL_USER_ID NUMBER(38),
5 USPL_PLAN_ID NUMBER(38),
6 USPL_TIMESTAMP DATE,
7 USPL_DEFAULT_PLAN_FLAG VARCHAR2(1),
8 USPL_EFT_FLAG VARCHAR2(1)
9 )
10 /
Table created.
SQL> create table pwb_plan
2 (
3 PLAN_ID NUMBER(9) NOT NULL ,
4 PLAN_NAME VARCHAR2(30) NOT NULL
5 )
6 /
Table created.
SQL> create or replace view pwb_view_agg of XMLType
2 XMLSCHEMA "http://www.oracle.com/pwb_user_agg.xsd" ELEMENT "User"
3 WITH OBJECT ID (extract(SYS_NC_ROWINFO$, '/User/UserID/text()').getnumberval()) AS
4 SELECT XMLElement
5 (
6 "User",
7 XMLAttributes
8 (
9 'http://www.oracle.com/pwb_user_agg.xsd' AS "xmlns",
10 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
11 'http://www.oracle.com/pwb_user_agg.xsd http://www.oracle.com/pwb_user_agg.xsd' AS "xsi:schemaLocation"
12 ),
13 XMLForest
14 (
15 u.user_id as "UserID",
16 u.user_last_name || ' ' ||u.user_first_name as "UserName",
17 u.user_phone_nbr as "PhoneNumber",
18 u.user_lan_account as "LAN",
19 TO_CHAR(u.user_timestamp, 'YYYY-MM-DD') as "CreateDate"
20 ),
21 (
22 SELECT Xmlagg
23 (
24 XMLElement
25 (
26 "UserPlans",
27 XMLForest
28 (
29 n.plan_name as "PlanName",
30 p.uspl_eft_flag as "EFTFlag",
31 p.uspl_default_plan_flag as "DefaultPlan"
32 )
33 )
34 )
35 FROM pwb_user_plan p, pwb_plan n
36 WHERE p.uspl_user_id = u.user_id
37 AND p.uspl_plan_id = n.plan_id
38 )
39 )
40 FROM pwb_user u
41 WHERE u.user_id = 1234
42 /
View created.
SQL> insert into pwb_user values (1234,'Drake','Mark','D','[email protected]',sysdate,'650-555-1212')
2 /
1 row created.
SQL> insert into pwb_user_plan values (5678,1234,9,sysdate,'T','T')
2 /
1 row created.
SQL> insert into pwb_plan values (9,'Plan 9 from Outer Space')
2 /
1 row created.
SQL> select *
2 from pwb_view_agg
3 /
SYS_NC_ROWINFO$
<User xmlns="http://www.oracle.com/pwb_user_agg.xsd" xmlns:xsi="http://www.w3.or
g/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/pwb_user_ag
g.xsd http://www.oracle.com/pwb_user_agg.xsd"><UserID>1234</UserID><UserName>Dra
ke Mark</UserName><PhoneNumber>650-555-1212</PhoneNumber><LAN>mark.drake@example
.com</LAN><CreateDate>2006-09-18</CreateDate><UserPlans><PlanName>Plan 9 from Ou
ter Space</PlanName><EFTFlag>T</EFTFlag><DefaultPlan>T</DefaultPlan></UserPlans>
</User>
SQL> -
Hi,
My aggregate member function output/OUT parameter is a nested table or collection : table_out1 :
table_out1 TABLE OF NTAB_TYPE
Name Null? Type
EMPNO NUMBER
SALARY NUMBER
TST CHAR(10)
TE CHAR(10)
And this table_out1 is not part/column of any database table.
I am just using this table_out1 instance : returnValue : as a empty collection initially and then I am appending elements or objects
of type : NTAB_TYPE into this collection and then outputting the results(the entire collection items) directly to the sql prompt
after the completion of the ODCIAggregateTerminate member function. I am creating the new Objects by iterating through a set p :
and then corresponding creating objects using : OCIObjectNew(...)
But my problem is the OCICollSize(..) fails and throws an error : ORA-21500 or ORA-21560 .....
If I still go further and execute the OCICollApend(..) then it fails at that moment and gives me the same ORA-21500 or ORA-21560.
It fails at the very first element or when I am trying to append for the first time as the collection is empty.
The elem & elemind of OCICollAppend() : respectively : tmp & tmp_ind in my function ODCIAggregateTerminate are not null as I can check
them in my code ..So may be I am suspecting that the collection being empty it is throwing the error : but since in my case the collection
is an OUT/Output parameter so it should successfully append but it is not happening so..
When I check the OCI Collection size of returnValue : table_out1 : the value is nested_table size : 134580616
member function ODCIAggregateTerminate(
self IN OUT MinDistanceImpl, returnValue OUT table_out1,
flags IN number)
return number
as language C
library custagg name "ODCIAggregateTerminate"
with context
parameters (
context,
self,
self INDICATOR STRUCT,
returnValue ,
returnValue INDICATOR,
flags,
flags INDICATOR ,
RETURN ),
typedef OCITable table_out1;
struct ntab_type
OCINumber empno;
OCINumber salary;
OCIString * tst;
OCIString * te;
typedef struct ntab_type ntab_type;
struct ntab_type_ind
OCIInd _atomic;
OCIInd empno;
OCIInd salary;
OCIInd tst;
OCIInd te;
typedef struct ntab_type_ind ntab_type_ind;
extern "C" OCINumber * ODCIAggregateTerminate(
OCIExtProcContext *context,
MinDistanceImpl * self,
MinDistanceImpl_ind * self_ind,
table_out1 * returnValue,
short * returnValue_ind,
OCINumber * flags,
short flags_ind)
......Some previous code goes here...................
ntab_type * tmp = (ntab_type *) 0;
ntab_type_ind * tmp_ind = (ntab_type_ind *) 0;
returnValue = (table_out1 *) 0; // Can comment this : as it does not make any difference
OCIType out_tdo = (OCIType )0;
set<Outdata*>::iterator it;
for (it = storedCtx->l.p.begin(); it != storedCtx->l.p.end(); it++) {
fprintf(pFile, " in term set is : salary : %d , s.end : %s", (*it)->salary, (*it)->iend);
fflush(pFile);
int sal = (*it)->salary;
char time = (char )malloc(10*sizeof(char) + 1);
strcpy(time,(*it)->iend);
static sword status = 0;
if(( status = OCITypeByName(handles.envhp, handles.errhp, handles.svchp, (const text *) "SYS", (ub4) strlen("SYS"),
(const text *) "NTAB_TYPE", (ub4) strlen("NTAB_TYPE"), (text *)0, (ub4) 0,
OCI_DURATION_SESSION, OCI_TYPEGET_ALL, &out_tdo)) != OCI_SUCCESS)
fprintf (pFile, "Ocitypename - Fail\n");
fflush(pFile);
checkerr(&handles, status);
if((status = OCIObjectNew(handles.envhp,handles.errhp,handles.svchp, OCI_TYPECODE_OBJECT, out_tdo, (dvoid *)0,
OCI_DURATION_SESSION, TRUE, (dvoid**)&tmp)) != OCI_SUCCESS)
fprintf (pFile, "OCIOBJECTNEW - Fail\n");
fflush(pFile);
checkerr(&handles, status);
OCINumberFromInt( handles.errhp,&sal,sizeof(int),OCI_NUMBER_SIGNED, &tmp->empno);
if (checkerr(&handles, OCINumberFromInt( handles.errhp,&sal,sizeof(int),OCI_NUMBER_SIGNED,&tmp->salary)))
int success = ODCI_SUCCESS;
OCINumberFromInt( handles.errhp,&success,sizeof(int),OCI_NUMBER_SIGNED,returned );
*returnValue_ind = OCI_IND_NULL;
return returned;
if (checkerr(&handles, OCIStringAssignText(handles.envhp,handles.errhp, (CONST text *) time, strlen(time), &tmp->tst)))
int success = ODCI_SUCCESS;
OCINumberFromInt( handles.errhp,&success,sizeof(int),OCI_NUMBER_SIGNED,returned );
*returnValue_ind = OCI_IND_NULL;
return returned;
if (checkerr(&handles, OCIStringAssignText(handles.envhp,handles.errhp, (CONST text *) time, (ub2)strlen(time), &tmp->te)))
int success = ODCI_SUCCESS;
OCINumberFromInt( handles.errhp,&success,sizeof(int),OCI_NUMBER_SIGNED,returned );
*returnValue_ind = OCI_IND_NULL;
return returned;
char * ctst1 = (char *)OCIStringPtr(handles.envhp, tmp->tst);
char * cte1 = (char *)OCIStringPtr(handles.envhp, tmp->te);
fprintf(pFile, "from ctst1 & cte1 values");
tmp->tst : %s | tmp->te : %s | \n", ctst1, cte1);
fflush (pFile);
if(tmp_ind==OCI_IND_NOTNULL)
fprintf(pFile, " Oci tmp_ind not null...\n");
fflush(pFile);
else {
fprintf(pFile, " After OCI tmp_ind is NULL ...\n");
fflush(pFile);
sb4 sz;
if((status = OCICollSize(handles.envhp, handles.errhp,(CONST OCIColl *) returnValue, &sz)) != OCI_SUCCESS)
fprintf (pFile, "nested_table size error : %d\n", (int)sz);
fflush(pFile);
checkerr(&handles, status);
else {
fprintf (pFile, "nested_table_returnValue_size : %d\n", (int)sz);
fflush(pFile);
if (( status = OCICollAppend(hand*les.envhp, handles.errhp, (CONST dvoid *)tmp, (CONST dvoid *)tmp_ind, (OCIColl *)returnValue))
!= OCI_SUCCESS)
fprintf (pFile, "OCICollAppend - Fail\n");
fflush(pFile);
checkerr(&handles, status);
writing some status info of the program to the file : ( I deleted few printf statements in the above code..)
In ODCIAggregateTerminate Function!
in term set is : salary : 99 , s.end : 1999-10-10 sal value is : 99 After initializing sal is : 99 , time : 1999-10-10
******************Ocitypename - successfully done ***********************
**************before tmp_ind---> oci-ind-null ***********************
***************after tmp_ind---> oci-ind-null ***********************
OCIObjectNew created successfully
Before OCI Number conversion :
Before OCIstringassign text convs...terminate para....
After oci string assign text for tmp.tst...
After oci string assign text for tmp.tst...
After oci string assign text for tmp.te...
from ctst1 & cte1 values-----
tmp->tst : 1999-10-10 | tmp->te : 1999-10-10 |
Oci tmp_ind not null...
nested_table size error : 134580616
****************************In checkerr module *********************************************!
OCI error code 21500
****************************closing of checkerr module *********************************************!Hey,
Now I am able to append or add elements to the collection(OCITAble *). And it does not throw any error but the collection size is zero and collection is empty even after issuing OCICollAppend(...) .
I don't understand why is it happening so. I tried looking for almost 2-3 days and could not figure out what was happening....
Can any one suggest me some thing what is going on ... ... -
ERROR WHILE INSERTING BLOBS AS PARAMETERS OF EXISTING STORED PROCEDURE
I have 2 simple tables to keep large application data (as XMLDOCUMENT in one table and BLOB in another):
SQL> desc bindata_tbl;
Name Null? Type
BDATA_ID NOT NULL NUMBER(10)
BDATA NOT NULL BLOB
SQL> desc metadata_tbl;
Name Null? Type
MDATA_ID NOT NULL NUMBER(10)
MDATA NOT NULL SYS.XMLTYPE
and stored preocedure to input new data into those tables:
"SP_TEST_BIN_META_DATA"
i_MetaData in METADATA_TBL.MDATA%TYPE,
i_BinData in BINDATA_TBL.BDATA%TYPE
as
begin
if i_MetaData is not null then
insert into METADATA_TBL (MDATA_ID, MDATA)
values (METADATA_SEQ.nextval, i_MetaData);
end if;
if i_BinData is not null then
insert into BINDATA_TBL (BDATA_ID, BDATA)
values (BINDATA_SEQ.nextval, i_BinData);
end if;
COMMIT;
-- Handle exceptions
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE;
end;
I communicate with database from .Net application using "Oracle.DataAccess 10.1.0.200 (Runtime version v1.0.3705)" component.
Following procesure is a [simplified] examlple of the code I use, which demonstrates the errors while inserting XMLDOCUMENT and BLOB values simultaneously.
In my application those should be quite big objects (~200 K XML and ~5-25M binary image data), but following sample keeps failing even with very small-sized objects:
Line Number
1 private void PureTest()
2 {
3 OracleConnection conn = null;
4 OracleTransaction tx = null;
5 OracleCommand command = null;
6
7 try
8 {
9 // Open connection
10 string strConn = "Data Source=AthenaWf; User ID=AthenaWf; Password=Poseidon";
11 conn = new OracleConnection( strConn );
12 conn.Open();
13
14 // Begin transaction (not sure if really needed)
15 tx = conn.BeginTransaction();
16
17 // Create command
18 string strSql = "SP_TEST_BIN_META_DATA";
19 command = new OracleCommand();
20 command.Connection = conn;
21 command.CommandText = strSql;
22 command.CommandType = CommandType.StoredProcedure;
23
24 // Create parameters
25 // 1) XmlType parameter
26 string strXml = "<?xml version=\"1.0\"?><configuration testValue=\"123456789\"/>";
27 XmlDocument xmlDoc = new XmlDocument();
28 xmlDoc.LoadXml( strXml );
29 OracleXmlType oraXml = new OracleXmlType( conn, xmlDoc );
30 //oraXml = null;
31 //
32 OracleParameter xmlPrm = new OracleParameter();
33 xmlPrm.ParameterName = "i_MetaData";
34 xmlPrm.Direction = ParameterDirection.Input;
35 xmlPrm.OracleDbType = OracleDbType.XmlType;
36 xmlPrm.Value = oraXml;
37 command.Parameters.Add( xmlPrm );
38
39 // 2) Blob type
40 byte[] buf = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
41 OracleBlob oraBlob = new OracleBlob( conn, true );
42 //oraBlob.Write( buf, 0, buf.Length );
43 oraBlob = null;
44 //
45 OracleParameter blobPrm = new OracleParameter();
46 blobPrm.ParameterName = "i_BinData";
47 blobPrm.Direction = ParameterDirection.Input;
48 blobPrm.OracleDbType = OracleDbType.Blob;
49 blobPrm.Value = oraBlob;
50 command.Parameters.Add( blobPrm );
51
52
53 // Execute command finally
54 command.ExecuteNonQuery();
55 tx.Commit();
56 }
57 catch( Exception ex )
58 {
59 // Clean-up
60 if( command != null )
61 {
62 command.Dispose();
63 }
64 if( tx != null )
65 {
66 tx.Dispose();
67 }
68 if( conn != null )
69 {
70 conn.Dispose();
71 }
72
73 // Display error message
74 MessageBox.Show( ex.Message, "Error" );
75 }
76 }
If I try insert only XMLDOCUMENT object (lines 30, 42 are commented out, 43 IS NOT) - everything is OK.
If I try to insert only BLOB object (lines 30, 42 are NOT COMMENTED OUT, line 43 is commented out) - everything is OK again.
If I try to insert them both having some values (lines 30, 43 are commented out, 42 is not commented out) - it fails right on "command.ExecuteNonQuery();" (line 54)
with the following exception:
"ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%]".
Even when I nullify oraBlob before assigning it to OracleParameter value (line 30 is commented out, line 42 and 43 are not) I have the same exception.
XMLDOCUMENT and DLOB data logically are very coupled objects (in my application), so I really want to insert them simultaneously in one stored procedure in transactional way.
Is it bug of drivers, server, .net environment, or I miss something in implementation?
PS. In some articles on Oracle web and in MSDN site I found a mention about necessity of wrapping all write/update operations in a transaction, while working with temporary LOBs. I use it here, but it does not look like changing anything.Hello,
I tested your code with the 10.1.0.4.0 ODP and 10.1.0.4.0 Client and it worked fine.
Can you please apply the 10.1.0.4.0 patches for both ODP and client to see if this resolves the issue for you.
Here is the output from the same execution of the ODP application you provided as a testcase. These rows were inserted at the same time when I executed the application and passed the data as parameters to the SP you provided.
Results of Testing with 10.1.0.4.0
==========================
SQL> select count(*) from BINDATA_TBL
2 ;
COUNT(*)
1
SQL> select count(*) from METADATA_TBL;
COUNT(*)
1
SQL> select dbms_lob.getlength(bdata) from BINDATA_TBL;
DBMS_LOB.GETLENGTH(BDATA)
10
SQL> select mdata from METADATA_TBL;
MDATA
<?xml version="1.0"?><configuration testValue="123456789" /> -
Oracle Internal Error????
Hi,
I am getting the following error in PL/SQL procedure in which i have used XMLDB.
ERROR:
ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s],
[%s], [%s]
What does that mean? more importantly how do resolve this error?21500, 00000, "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
// *Cause: This is the generic error number for the OCI
// environment (client-side) internal errors. This indicates
// that the OCI environment has encountered an exceptional
// condition.
// *Action: Report as a bug - the first argument is the internal error number.I find it a tad weird that you get this error from a PL/SQL procedure? Are you sure it is that procedure that is throwing the exception?
From the error message description it sounds like the error should come from your local OCI (Oracle Call Interface) client driver.
How are you executing the procedure? From Java, Pro*C, something else? Have you tested the procedure call using SQL*Plus?
If this is a server-side error (despite what the error message details above say), there should be a record of this error (as with all internal Oracle server errors) in the alert log of that instance.
Have you checked the alert log? Is there an error? What does it say? (please post the error details here)
Has a trace file been generated? (the alert log will list that too) If so, have you edited the trace file and looked at the header in the file? It often contains useful data, such as the SQL that caused the error dump.
PS. Why did you post the problem here? An internal Oracle error has very little do with the SQL and PL/SQL languages, which are the subject matter of this forum. Posting this problem in the Database-General forum would have been more appropriate. -
XDB 9.2.0.3 and sqlPlus 9.2.0.1
Recently upgraded our 9i development server to 9.2.0.3 because we were having problems with XDB version 9.2.0.1 of the database. Once theses upgrades were performed we started having some other issues.
Seems using sqlPlus 9.2.0.1 from our client has problems performing basic operations with XDB 9.2.0.3, and Mark recently confirmed this in another post problem with installing basic demo A simple test like this fails:
SQL> select XDBUriType('/xdbconfig.xml').getXML() from dual;
ERROR: ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]
From our upgraded server running 9.2.0.3 sqlPlus it seems to work fine:
SQL> select XDBUriType('/xdbconfig.xml').getXML() from dual;
XDBURITYPE('/XDBCONFIG.XML').GETXML()
<xdbconfig xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd" xmlns:xsi="http://w
How is everyone upgrading their client, or rather sqlPlus to 9.2.0.3? I finally broke down and installed 9i Personnel and used the RDBMS 9.2.0.3 patch on my workstation to get it done. If there is a better way to get this done, I couldn't find it. I'd hate to have our db developers install 9i personnel, it seems like an extreme solution. Any help would appreciated.If I remember correctly, the first time I tried to update Installer from 2.2.0.12 (by manually selecting products.jar from directory where I extracted 2.2.0.18), the thing got stuck somewhere at 90%.
So I restarted machine and run setup.exe from 2.2.0.18 directory (it performs automatic uninstall of 2.2.0.12).
After that I had no problems. -
Oracle 10.2.0.4 client/ODP connecting to 11g database
Hi Folks -
Are there any know problems using an Oracle 10.2.0.4 client and the 10.2 ODP/ODAC client to connect to an 11g database?
Normally ,we'd use the Oracle 11g client/ODP but it is giving us errors so we need to go back to 10g
..any foresee-able problems with this?soryy it took so long to reply.
we hit a bug which was supposed to be fixed in 11g client but is still there. OraOps11x.dll causing IIS 6.0 to crash. Took us a week to figure out what it was and didn't even consider it being an error caused by the 11g client until MS support pointed it out in a dump file we had them analyze. Oracle support confirmed it was true and last I heard they plan to have it fixed in the next update to the client, which they say is scheduled for end of July 2008. I hope it is fixed, because we're running into other problems with the 10.2.0.4 client also (ORA-21500 [%],[%],[%],[%],[%]). -
Hi all,
When calling the OCIColAppend function, I get an error. OCIErrorGet and OCIExtProcRaiseExcp tell me that the error is
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
The error reference tells me
Cause: This is the generic error number for the OCI environment (client-side) internal errors. This indicates that the OCI environment has encountered an exceptional condition.
Action: Report to Oracle Customer Support. The first argument is the internal error number.
Anybody have an idea what is causing this?
As background, I'm running an External Procedure and trying to create a collection from an array. Here is a snippet of my C code
int WINAPI createCol(OCIEnv envhp, OCIError errhp, OCIColl col1,int arr1, int arraySize)
exec sql begin declare section;
int tmp_int;
OCINumber ocinum;
long errcode;
char errbuf;
exec sql end declare section;
tmp_int = arr1[0];
if (OCINumberFromInt(errhp,(dvoid *) &tmp_int, sizeof(tmp_int), OCI_NUMBER_SIGNED, &ocinum) != OCI_SUCCESS)
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
return errcode;
//The above function returns OCI_SUCCESS
if ( OCICollAppend( envhp, errhp, &ocinum, 0, col1 ) != OCI_SUCCESS )
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,(text *) &errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
return errcode;
//Here it returns with the error code
int WINAPI getNumArr(OCIExtProcContext oci_ctx,OCIColl p_out,short *p_out_i)
do some ProC stuff to register context, get env, allocate err handle, select a column out of a table and then
iRet = createCol(oeh, oerrh, p_out, arrOut, arraySize);
OCIExtProcRaiseExcp(myctx,i1);
return i1;
Thanks for your time if anyone takes a look at this.
Even better if you can point me to some examples of using External Procedures and ESQL (ProC) and working with Collections/VArrays.Hi all,
When calling the OCIColAppend function, I get an error. OCIErrorGet and OCIExtProcRaiseExcp tell me that the error is
ORA-21500: internal error code, arguments: [], [], [], [], [], [], [], []
The error reference tells me
Cause: This is the generic error number for the OCI environment (client-side) internal errors. This indicates that the OCI environment has encountered an exceptional condition.
Action: Report to Oracle Customer Support. The first argument is the internal error number.
Anybody have an idea what is causing this?
As background, I'm running an External Procedure and trying to create a collection from an array. Here is a snippet of my C code
int WINAPI createCol(OCIEnv envhp, OCIError errhp, OCIColl col1,int arr1, int arraySize)
exec sql begin declare section;
int tmp_int;
OCINumber ocinum;
long errcode;
char errbuf;
exec sql end declare section;
tmp_int = arr1[0];
if (OCINumberFromInt(errhp,(dvoid *) &tmp_int, sizeof(tmp_int), OCI_NUMBER_SIGNED, &ocinum) != OCI_SUCCESS)
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
return errcode;
//The above function returns OCI_SUCCESS
if ( OCICollAppend( envhp, errhp, &ocinum, 0, col1 ) != OCI_SUCCESS )
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,(text *) &errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
return errcode;
//Here it returns with the error code
int WINAPI getNumArr(OCIExtProcContext oci_ctx,OCIColl p_out,short *p_out_i)
do some ProC stuff to register context, get env, allocate err handle, select a column out of a table and then
iRet = createCol(oeh, oerrh, p_out, arrOut, arraySize);
OCIExtProcRaiseExcp(myctx,i1);
return i1;
Thanks for your time if anyone takes a look at this.
Even better if you can point me to some examples of using External Procedures and ESQL (ProC) and working with Collections/VArrays. -
XMLType - client problem on reading XML?
When I execute this function in my 9.2.0.7.0 database:
create or replace function get_study_xml (p_study_id in number)
return xmltype is xml_doc xmltype;
begin
execute immediate '
select xmlelement(
...lots of code...
from XML_STUDY_VIEW where STUDY_ID = '||p_study_id||'' into xml_doc;
return xml_doc;
end get_study_xml;I get the following error with a 9.2.0.1.0 client:
ORA-03118: two-task coroutine has invalid stateAnd the following error with a 9.2.0.3.0 client:
ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]And finally the following error with a 9.2.0.7.0 client:
ORA-24909: call in progress. Current operation cancelledI've done lots of investigation, and so far I've deduced the following:
* It works fine on a PC with a 10g client
* The function returns the XMLType successfully (it seems)
* On all clients, the error occurs not on returning the XMLType, but on trying to read the XML within.
I am trying to do this via Delphi components from Allround Automations (makers of PL/SQL Developer). I don't know how to output the XML to DBMS Output, so could do with some help there. If I could test it without using Allround's components, I could isolate the problem.
I suspect the problem is not with the components though but with the OCI/client, because the same components work fine on 10g client.
If someone could help give some suggestions, including how I could try to output the XML in SQL*Plus, it would be greatly appreciated.
Best regards,
Gary
I don't know if it's relevent, but it may be worth noting that the SQL statement I've commented out is fairly massive, but even if I query data that produces a tiny XML object (i.e. hardly any data), it still fails. The full function is below, so you can see what I'm doing:
create or replace function get_study_xml (p_study_id in number)
return xmltype is xml_doc xmltype;
begin
execute immediate '
select xmlelement(
"STUDY",
xmlforest(STUDY_ID, '||columnsforest('XML_STUDY_VIEW')||')
select xmlagg(
xmlelement(
"STUDYHEADING",
xmlforest('||columnsforest('XML_STUDYHEADING_VIEW')||')
from XML_STUDYHEADING_VIEW where STUDY_ID = '||p_study_id||'
select xmlelement(
"TESTSUBSTANCE",
xmlforest('||columnsforest('XML_TESTSUBSTANCE_VIEW')||')
from XML_TESTSUBSTANCE_VIEW where STUDY_ID = '||p_study_id||'
select xmlagg(
xmlelement(
"STRAIN",
xmlforest('||columnsforest('XML_STRAIN_VIEW')||')
from XML_STRAIN_VIEW where STUDY_ID = '||p_study_id||'
select xmlagg(
xmlelement(
"POSITIVECONTROL",
xmlforest('||columnsforest('XML_POSCTRL_VIEW')||')
from XML_POSCTRL_VIEW where STUDY_ID = '||p_study_id||'
select xmlagg(
xmlelement(
"SOLVENT",
xmlforest('||columnsforest('XML_SOLVENT_VIEW')||')
from XML_SOLVENT_VIEW where STUDY_ID = '||p_study_id||'
select xmlagg(
xmlelement(
"POSTFIX",
xmlforest('||columnsforest('XML_POSTFIX_VIEW')||')
from XML_POSTFIX_VIEW where STUDY_ID = '||p_study_id||'
select xmlagg(
xmlelement(
"EXPERIMENTFOLDER",
xmlforest(FOLDER_ID,'||columnsforest('XML_EXPTFOLDER_VIEW')||'),(
select xmlagg(
xmlelement(
"EXPERIMENT",
xmlforest(EXPT_ID,'||columnsforest('XML_EXPERIMENT_VIEW')||'),(
select xmlagg(
xmlelement(
"EXPERIMENTHEADING",
xmlforest('||columnsforest('XML_EXPTHEADING_VIEW')||')
from XML_EXPTHEADING_VIEW h where h.EXPT_ID = e.EXPT_ID
select xmlagg(
xmlelement(
"EXPERIMENTSTRAIN",
xmlforest('||columnsforest('XML_EXPTSTRAIN_VIEW')||'),(
select xmlagg(
xmlelement(
"PLATE",
xmlforest('||columnsforest('XML_EXPTPLATE_VIEW')||'),(
select xmlagg(
xmlelement("POSTFIX",CODE_ID)
from XML_PLATEPOSTFIX_VIEW x where x.PLATE_ID = p.PLATE_ID
and x.FOLDER_ID = f.FOLDER_ID
from XML_EXPTPLATE_VIEW p where p.EXPT_ID = e.EXPT_ID
and p.STRAIN_CODE = s.STRAIN_CODE
and p.PLATE_TYPE = 0
from XML_EXPTSTRAIN_VIEW s where s.EXPT_ID = e.EXPT_ID
from XML_EXPERIMENT_VIEW e where e.STUDY_ID = '||p_study_id||'
and f.folder_id = e.folder_id
select xmlagg(
xmlelement(
"CONTROL",
xmlforest('||columnsforest('XML_CONTROL_VIEW')||'),(
select xmlagg(
xmlelement(
"CONTROLPLATE",
xmlforest('||columnsforest('XML_CONTROLPLATE_VIEW')||'),(
select xmlagg(
xmlelement("POSTFIX",CODE_ID)
from XML_PLATEPOSTFIX_VIEW x where x.PLATE_ID = p.PLATE_ID
and x.FOLDER_ID = f.FOLDER_ID
from XML_CONTROLPLATE_VIEW p where p.CONTROL_ID = c.CONTROL_ID
and p.PLATE_TYPE > 0
from XML_CONTROL_VIEW c where c.STUDY_ID = '||p_study_id||'
and f.folder_id = c.folder_id
from XML_EXPTFOLDER_VIEW f where f.STUDY_ID = '||p_study_id||'
from XML_STUDY_VIEW where STUDY_ID = '||p_study_id||'' into xml_doc;
return xml_doc;
end get_study_xml;This may be related to bug 3396162 but I'm not sure I fully understand the implications of this bug, or the cirumstances under which it can arise.
Getting back to the basic problem. Can you reproduce the problem with by calling your PL/SQL from a 9.2.0.7.0 SQL*PLUS.
I'm not familar with Delphi. Is it Java or 'C' based. Is it using an OCI connection. If so does it bind to the latest Oracle Installation or does it embed the Oracle OCI components. If the later do you know which version of OCI is embedded ?
WRT to dumping to DBMS_OUTPUT the following is a somewhat of a work in progress...
create or replace package XDB_XML_OUTPUT_10200
AUTHID CURRENT_USER
as
procedure put_xml(myXML XMLType);
procedure processNode(INDENT VARCHAR2, NODE DBMS_XMLDOM.DOMNODE);
end;
create or replace package body XDB_XML_OUTPUT_10200
as
currentLine CLOB;
wipBuffer CLOB;
printBuffer CLOB;
currentNode pls_integer;
elementClosed boolean;
procedure outputBuffer(buffer in out nocopy CLOB)
as
begin
dbms_output.put_line(buffer);
dbms_lob.trim(buffer,0);
end;
procedure putNode(INDENT varchar2, NODE DBMS_XMLDOM.DOMNODE)
as
byteCount pls_integer;
begin
if (currentNode = DBMS_XMLDOM.ELEMENT_NODE) then
outputBuffer(currentLine);
end if;
byteCount := length(INDENT);
dbms_lob.writeAppend(currentLine,byteCount,INDENT);
dbms_lob.trim(printBuffer,0);
dbms_xmldom.writeToCLOB(node,printBuffer);
dbms_lob.append(currentLine,printBuffer);
end;
procedure putAttribute(NODE DBMS_XMLDOM.DOMNODE)
as
buffer varchar2(32767);
byteCount pls_integer;
begin
dbms_lob.trim(printBuffer,0);
dbms_xmldom.writeToCLOB(node,printBuffer);
dbms_lob.trim(wipBuffer,0);
buffer := ' ' || DBMS_XMLDOM.GETNODENAME(NODE) || '="';
byteCount := length(buffer);
dbms_lob.writeAppend(wipBuffer,byteCount,buffer);
dbms_lob.append(wipBuffer,printBuffer);
byteCount := 1;
dbms_lob.writeAppend(wipBuffer,byteCount,'"');
dbms_lob.append(currentLine,wipBuffer);
end;
procedure putAttributes(ATTRS DBMS_XMLDOM.DOMNAMEDNODEMAP)
as
ATTRNODE DBMS_XMLDOM.DOMNODE;
begin
for i in 0..DBMS_XMLDOM.GETLENGTH(ATTRS)-1 loop
ATTRNODE := DBMS_XMLDOM.ITEM(ATTRS,I);
putAttribute(ATTRNODE);
end loop;
end;
procedure printText(NODE DBMS_XMLDOM.DOMNODE)
as
byteCount pls_integer;
buffer varchar2(1);
begin
buffer := '>';
byteCount := length(buffer);
dbms_lob.writeAppend(currentLine,byteCount,buffer);
dbms_lob.trim(printBuffer,0);
dbms_xmldom.writeToCLOB(NODE,printBuffer);
dbms_lob.append(currentLine,printBuffer);
currentNode := DBMS_XMLDOM.TEXT_NODE;
end;
procedure startElement(INDENT varchar2, NODE DBMS_XMLDOM.DOMNODE, ATTRS DBMS_XMLDOM.DOMNAMEDNODEMAP)
as
byteCount pls_integer;
buffer varchar2(32767);
begin
if (not elementClosed) then
buffer := '>';
byteCount := 1;
dbms_lob.writeAppend(currentLine,byteCount,buffer);
end if;
elementClosed := false;
-- Start a new Element : Flush the buffer
outputBuffer(currentLine);
dbms_lob.trim(wipBuffer,0);
buffer := INDENT || '<' || DBMS_XMLDOM.GETNODENAME(NODE);
byteCount := length(buffer);
dbms_lob.writeAppend(currentLine,byteCount,buffer);
putAttributes(ATTRS);
currentNode := DBMS_XMLDOM.ELEMENT_NODE;
end;
procedure endElement(INDENT varchar2, NODE DBMS_XMLDOM.DOMNODE)
as
byteCount pls_integer;
buffer varchar2(32767);
begin
if (elementClosed) then
outputBuffer(currentLine);
buffer := INDENT || '</' || DBMS_XMLDOM.GETNODENAME(NODE) || '>';
byteCount := length(buffer);
dbms_lob.writeAppend(currentline,byteCount,buffer);
else
if (currentNode = DBMS_XMLDOM.ELEMENT_NODE) then
buffer := '/>';
byteCount := length(buffer);
dbms_lob.writeAppend(currentline,byteCount,buffer);
else
buffer := '</' || DBMS_XMLDOM.GETNODENAME(NODE) || '>';
byteCount := length(buffer);
dbms_lob.writeAppend(currentline,byteCount,buffer);
end if;
end if;
currentNode := DBMS_XMLDOM.ELEMENT_NODE;
elementClosed := true;
end;
procedure processChildren(INDENT varchar2, NODE DBMS_XMLDOM.DOMNODE)
as
CHILDREN DBMS_XMLDOM.DOMNODELIST;
CHILD DBMS_XMLDOM.DOMNODE;
begin
CHILDREN := DBMS_XMLDOM.GETCHILDNODES(NODE);
for i in 0..DBMS_XMLDOM.GETLENGTH(CHILDREN)-1 loop
CHILD := DBMS_XMLDOM.ITEM(CHILDREN,I);
processNode(INDENT , CHILD);
end loop;
end;
procedure processNode(INDENT VARCHAR2, NODE DBMS_XMLDOM.DOMNODE)
as
newIndent varchar2(256) := INDENT || ' ';
begin
-- ENTITY_REFERENCE_NODE
-- ENTITY_NODE
-- DOCUMENT_TYPE_NODE
-- DOCUMENT_FRAGMENT_NODE
-- NOTATION_NODE
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.COMMENT_NODE) then
putNode(INDENT,NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.PROCESSING_INSTRUCTION_NODE ) then
putNode(INDENT,NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.CDATA_SECTION_NODE) then
putNode(INDENT,NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.TEXT_NODE) then
printText(NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.ATTRIBUTE_NODE) then
putAttribute(NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.ELEMENT_NODE) then
startElement(INDENT,NODE,DBMS_XMLDOM.GETATTRIBUTES(NODE));
processChildren(newIndent, NODE);
endElement(INDENT,NODE);
end if;
if (DBMS_XMLDOM.GETNODETYPE(NODE) = DBMS_XMLDOM.DOCUMENT_NODE) then
processChildren(INDENT,NODE);
end if;
end;
procedure put_xml(myXML XMLType)
as
doc DBMS_XMLDOM.DOMDOCUMENT;
begin
DBMS_LOB.createTemporary(currentLine,true,DBMS_LOB.SESSION);
DBMS_LOB.createTemporary(wipBuffer,true,DBMS_LOB.SESSION);
DBMS_LOB.createTemporary(printBuffer,true,DBMS_LOB.SESSION);
doc := DBMS_XMLDOM.NEWDOMDOCUMENT(myXML);
processNode('#',DBMS_XMLDOM.MAKENODE(doc));
outputBuffer(currentLine);
DBMS_LOB.freeTemporary(printBuffer);
DBMS_LOB.freeTemporary(wipBuffer);
DBMS_LOB.freeTemporary(currentLIne);
end;
end;
/ -
XQUERY / XMLTABLE Syntax to read and XML from a Windows local drive?
Hi,
Would someone post an example of the syntax to read a text file containing XML from the local Windows disk drive using xquery/xmltable syntax?
Thanks,
VictorDoes the following help...
SQL> conn test/test
Connected.
SQL> -- The test user has the DBA role...
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
5 rows selected.
/* The content of the data.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>
SQL> drop directory xmlstore;
Directory dropped.
SQL> -- the directory is on a Windows system...
SQL> create directory xmlstore as 'E:\temp';
Directory created.
SQL> create table test
2 (xmldata xmltype);
Table created.
SQL> INSERT into test
2 VALUES
3 (XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8')));
1 row created.
SQL> set long 100000000
SQL> select * from test;
XMLDATA
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>
1 row selected.
SQL> select XMLTYPE('<ROOT><ID>0</ID><INFO><INFO_ID>0</INFO_ID><INFO_CONTENT>Text</INFO_CONTENT></INFO></ROOT>') as "XDATA"
2 from dual;
XDATA
<ROOT><ID>0</ID><INFO><INFO_ID>0</INFO_ID><INFO_CONTENT>Text</INFO_CONTENT></INFO></ROOT>
1 row selected.
SQL> select XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8')) as "XDATA"
2 from dual;
ERROR:
ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]
no rows selected
SQL> select extract((XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') as "XDATA"
2 from dual;
XDATA
<ROOT><ID>0</ID><INFO><INFO_ID>0</INFO_ID><INFO_CONTENT>Text</INFO_CONTENT></INFO></ROOT>
1 row selected.
SQL> select xdata
2 from (XMLTABLE('*'
3 PASSING (XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8')))
4 COLUMNS xdata xmltype PATH '/*'
5 )
6 )
7 ;
XDATA
<ROOT><ID>0</ID><INFO><INFO_ID>0</INFO_ID><INFO_CONTENT>Text</INFO_CONTENT></INFO></ROOT>
1 row selected. -
Cannot display complete document in binary XML XMLType column
I've been trying to get a query to work that will display the complete XML document stored in a column of XMLType, binary XML storage.
<b/>
I"m using Toad 10.6.1.3.
<b/>
I'm running Oracle client:
{code}Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production{code}
<b/>
The table is defined:
{code}CREATE TABLE AUDITED_EVENT_XML_MIN (
AUDITED_EVENT_XML_PK_ID NUMBER(10) PRIMARY KEY,
/* The time the audit record was created. */
CREATED_TIME TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL,
/* Well-formed XML message */
XML_EVENT_CONTENT XMLType
XMLTYPE COLUMN "XML_EVENT_CONTENT" STORE AS BINARY XML;
{code}
<b/>
The XML has no namespace. The SQL that I tried is:
{code}select e.xml_event_content.extract('/') from AUDITED_EVENT_XML e;{code}
<b/>
I also tried a simpler approach.
{code}select * from AUDITED_EVENT_XML e;{code}
<b/>
and got this error:
{code}ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]{code}
<b/>
I'm a newbie; I'm sure there is a simple way to do this; but I can't find it in the Oracle XML DB Developers Guide.
It would also be helpful to know how to do this for documents that have a declared namespace (without a xsd schema)...
Thanks in advance...
Edited by: flyeagle5683 on Sep 4, 2012 3:18 PMWhen ran from the Command window in PL/SQL Developer
Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
SQL>
SQL> CREATE TABLE AUDITED_EVENT_XML_MIN (
2 AUDITED_EVENT_XML_PK_ID NUMBER(10) PRIMARY KEY,
3 /* The time the audit record was created. */
4 CREATED_TIME TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL,
5 /* Well-formed XML message */
6 XML_EVENT_CONTENT XMLType
7 )
8 XMLTYPE COLUMN "XML_EVENT_CONTENT" STORE AS BINARY XML;
Table created
SQL> insert into audited_event_xml_min values (1, systimestamp, xmltype('<root><child1>Val1</child1></root>'));
1 row inserted
SQL> commit;
Commit complete
SQL> select * from AUDITED_EVENT_XML_MIN e;
AUDITED_EVENT_XML_PK_ID CREATED_TIME XML_EVENT_CONTENT
1 05-SEP-12 09.24.36.546435 AM <root>
<child1>Val1</child1>
</root>
SQL> select e.xml_event_content.extract('/') from AUDITED_EVENT_XML_MIN e;
E.XML_EVENT_CONTENT.EXTRACT('/
<root>
<child1>Val1</child1>
</root>
SQL> I also ran the two SELECT statements from SQL*Plus, (11.2.0.3 32-bit Instant Client) and received the exact same results.
I'm guessing your version of Toad (or something between it and the DB) does not like XMLType data types being returned.
Try
select e.xml_event_content.extract('/').getStringVal() from AUDITED_EVENT_XML_MIN e;or .getClobVal() if the XML is large and see what happens. -
Internal heap error 17113 addr=0
internal heap error 17113 addr=0
HEAP DUMP heap name="" desc=f03bc3c
extent sz=0x0 alt=0 het=41 rec=0 flg=0 opc=0
parent=7eb2591c owner=0 nex=0 xsz=0x0
Hla:0
ORA-21500: internal erro code, arguments: [17113], [0x0],[],[],[],[],[],[]
Errors in file :
ORA-21500: internal erro code, arguments: [17113], [0x0],[],[],[],[],[],[]
-------Call Stack Trace -----------
NOTE: <PLT>+offset is used to represent that the
function being called is offset bytes from
the PROCEDURELINKAGE_TABLE_.
SIGBUS.
Has anybody seen this one before? Any suggestions, comments, sympathy will be greatly appreciated.Can you tell me what is stack size and where to change it? We are having this problem and don't know where to look to make a "Stack size" change. We are on Oracle8i Enterprise Edition Release 8.1.7.2.0
-
Get a ORA-32104 error: Debian Oracle10gR2 OCCI
My code is very simple, and i got an exception when I was trying to execute the following code env = Environment::createEnvironment (Environment::OBJECT); I have also tried env = Environment::createEnvironment (); The result is exactly the same.
The exception is "Error while trying to retrieve text for error ORA-32104"
My host is Debian, gcc4.1.2, and I have got the new occi library. I am confused with the error.
I compiler the code with gcc3.4.3, but got the same error.
Thanks.
using namespace oracle::occi;
using namespace std;
int
main( int argc, char* argv[] )
Environment * env = NULL;
// Open a connection to the database, then close it.
int ret = 0;
try
env = Environment::createEnvironment(Environment::OBJECT);
catch (SQLException ea)
cerr << " Oracle10g: " << ea.what();
ret = 1;
Environment::terminateEnvironment(env);
return 0;
}Thanks in advance,
summerDo you have the following set in your ENV
ORACLE_HOME
ORACLE_SID
rgds
Maybe you are looking for
-
How to customize top navigation css in SharePoint 2013?
Hi All, How to customize top navigation css in SharePoint 2013?(Want to add colors for each link in the navigation) My current page is like- Expected-
-
How to create a dynamic table (repeating) with static header?
Hello My purpose is to create a table which should be dynamically filled at runtime depending on the number of elements in the datasource($record.list). If the list is empty, the table shouldn't be displayed at all. I created a subform which holds a
-
Help me With my MacBook please!!!
I was listening to recently downloaded music on my MacBook last night when all of a sudden the screen went black stopped the music and beeped about 9 or 10 times. Now whenever I try to start it up again the screen stays black and beeps the same amoun
-
Configuration Missing in Purchase Requisition in ECC
Hi we have a scenarios,need your help to map it into system... Existing scenario--we give SFG to we are taking SFG from a vendor and Returning him FG.Now to procure the SFG we need a pr at our location...PR is getting created but the source of supply
-
Filenames as Command Line Arguments: How?
i need to create a program that involves taking in a file name as command line argument, reads the file and then displays its contents on the screen. it needs to work with any file with a .txt extension. The only thing i dont fully understand is how