hey dbwizard,
die Lösung von Dir geht bei mir leider nicht, sieht ja genial einfach aus, ist die für Oracle 10g ?
Bekomme immer die Meldung: "The Query fails because all columns types are currently not supported" -> benutze Oracle 9.2i
Grüße
- nö, sollte auch in 9.2 funktionieren :
Guckst du :
oracle@CHTHL-TUX-ORACLE2:/usr/data/oracle/scripting/dba> sqlplus scott/tiger
SQL*Plus: Release 9.2.0.8.0 - Production on Mon Mar 3 14:51:23 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> CREATE OR REPLACE TYPE myscalartype AS OBJECT (job VARCHAR2 (30))
2 /
Type created.
SQL> CREATE OR REPLACE TYPE myarraytype AS TABLE OF myScalarType
2 /
Type created.
SQL> SELECT CAST (MULTISET (SELECT job FROM emp GROUP BY job) AS myArrayType) x
FROM emp
2 /
X(JOB)
--------------------------------------------------------------------------------
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
X(JOB)
--------------------------------------------------------------------------------
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
X(JOB)
--------------------------------------------------------------------------------
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
X(JOB)
--------------------------------------------------------------------------------
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
MYARRAYTYPE(MYSCALARTYPE('ANALYST'), MYSCALARTYPE('CLERK'), MYSCALARTYPE('MANAGE
R'), MYSCALARTYPE('PRESIDENT'), MYSCALARTYPE('SALESMAN'))
14 rows selected.
SQL>