Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Join subqueries on multiset

cf1d195c-44c3-4b34-817e-ecf6c8a88915Nov 29 2018 — edited Nov 29 2018

Hi,

Is it possible to join two subqueries on a multiset collection?

E.g. the following would return 1 row, because the multisets in both subqueries are identical.

with a as

(

SELECT

    1 as ID,

    CAST

      (

         MULTISET

         (

             SELECT 'A' from dual

             union all select 'B' from dual

             union all select 'C' from dual

         )

         AS sys.odcivarchar2list

       )

     AS MyList

FROM dual

where rownum = 1

),

b as

(

SELECT

    1 as ID,

    CAST

      (

         MULTISET

         (

             SELECT 'A' from dual

             union all select 'B' from dual

             union all select 'C' from dual

         )

         AS sys.odcivarchar2list

       )

     AS MyList

FROM dual

where rownum = 1

)

select * from a inner join b on a.mylist = b.mylist

;

When I run this SQL I receive the following error

ORA-00932: inconsistent datatypes: expected - got SYS.ODCIVARCHAR2LIST

00932. 00000 -  "inconsistent datatypes: expected %s got %s"

Thanks

This post has been answered by mathguy on Nov 29 2018
Jump to Answer
Comments
Post Details
Added on Nov 29 2018
5 comments
1,037 views