Oracle12C(集合运算符)之02-multiset

multiset(将一组标量数据收集成sql语句中的一组集合)

  1. 转换成集合
create or replace type row_no_list is table of varchar2(10);

SQL> select cast
     (
       multiset
       (
        select 'R' || rownum row_no from dual connect by level<=5
       ) as row_no_list
     ) as list
     from dual;
LIST                                                                                                                                                                                                                                                                          
----------------------------------------------------
ROW_NO_LIST('R1', 'R2', 'R3', 'R4', 'R5')  

SQL> select * from 
    table
    (
     select cast
     (
       multiset
       (
        select 'R' || rownum row_no from dual connect by level<=5
       ) as row_no_list
    ) as list
    from dual
   );
COLUMN_VAL
----------
R1        
R2        
R3        
R4        
R5

你可能感兴趣的:(Oracle12C(集合运算符)之02-multiset)