1

I am looking for a query similar to the below one.

SELECT  ROWNUM rnum,COLUMN_VALUE as dl
FROM    TABLE(CAST(varc('REGULAR','AD','PR') is varray(3) of varchar2(100)))

Output :

REGULAR 
AD
PR

PS: Type creation is not allowed in our oracle 11g by DBA. Using union is one option. But we are looking for list of array elements in the select query

Any suggestions please!

1
  • I know there is little point in arguing with a DBA but, for the record, their prohibition is uninformed, misguided and counter-productive. Feel free to quote me :-) Commented Sep 1, 2017 at 13:32

2 Answers 2

1

There are some handy collection types already supplied by Oracle - for example you could do:

select column_value
from table(SYS.DBMS_DEBUG_VC2COLL('REGULAR','AD','PR'));
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. It solves my problem ☺️
You should probably add a disclosure to your answer that the link goes to your own blog.
0

You can use the SYS.ODCIVARCHAR2LIST type:

SELECT ROWNUM,
       COLUMN_VALUE
FROM   TABLE( SYS.ODCIVARCHAR2LIST( 'REGULAR', 'AD', 'PR' ) );

1 Comment

Thanks for your reply

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.