troubleshooting Question

PLSQL Table of XMLType

Avatar of Wasim Akram Shaik
Wasim Akram ShaikFlag for India asked on
Oracle Database
5 Comments1 Solution843 ViewsLast Modified:
Pls help me to spot the error in the below block

CREATE OR REPLACE TYPE xmlobj AS OBJECT (
   col   XMLTYPE
);
/

CREATE OR REPLACE TYPE xmltab AS TABLE OF xmlobj;
/

CREATE TABLE XMLTABLE1
(
  COL1  XMLTYPE
)



DECLARE
   -- l_obj   xmltab;
   i       NUMBER;

   CURSOR c1
   IS
      SELECT XMLELEMENT (object_id, object_id) AS object1
        FROM user_objects
       WHERE ROWNUM <= 10;

   l_obj   xmltab := xmltab ();
BEGIN
   i := 1;

   FOR l1 IN c1
   LOOP
      l_obj.EXTEND;
      l_obj (i) := xmlobj (l1.object1);
      i := i + 1;
   END LOOP;

   FORALL i IN 1 .. l_obj.COUNT
      INSERT INTO xmltable1
           VALUES l_obj (i);
END;

Error on executing this block is

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

 26  /
      INSERT INTO xmltable1
      *
ERROR at line 23:
ORA-06550: line 23, column 7:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got -
ORA-06550: line 23, column 7:
PL/SQL: SQL Statement ignored


SQL>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros