The following syntax works fine in Toad for Oracle 12.1:
** SELECT deptid,**
** XMLAGG (XMLELEMENT (E,lastname||’; ‘) ).EXTRACT (’//text()’) AS “EMPS”**
FROM
(SELECT deptid, lastname FROM emptest)
GROUP BY deptid;
The results look like this:
DEPTID
EMPS
10
SMITH; HARRIS; JONES;
20
TYLER;
However this same query does not work in Toad Data Point 3.6 when I’m connected to the same Oracle database. Instead I get this error:
ORA-00942: table or view does not exist
How can I get XMLAGG to work in TDP? I am on version 3.6.1.3294.
(I know that LISTAGG would solve the problem, but sometimes XMLAGG works better than LISTAGG.)
If you want to try recreating the above test, below are the commands I used to create the temp table EMPTEST:
CREATE TABLE EMPTEST
( EMPID NUMBER,
LASTNAME VARCHAR2(20),
DEPTID NUMBER);
INSERT INTO EMPTEST VALUES
(1,‘SMITH’,10);
INSERT INTO EMPTEST VALUES
(2,‘JONES’,10);
INSERT INTO EMPTEST VALUES
(3,‘TYLER’,20);
INSERT INTO EMPTEST VALUES
(4,‘HARRIS’,10);