Skip to Main Content

Oracle Database Discussions

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!

Select nth element in a nested table

K.GanJun 24 2018 — edited Jun 25 2018

SQL> desc nest_tab

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

NAME                                               VARCHAR2(40)

COURSES                                            COURSELIST

SQL> desc COURSELIST

COURSELIST TABLE OF VARCHAR2(64)

SQL> select nest_tab.courses  from  nest_tab;

COURSES

--------------------------------------------------------------------------------

COURSELIST('English', 'Drama')

What is the select syntax just to select 'English', ie the 1st item in the collection. I just want a very simple select. I know I can bulk load into a variable and then display it using an array etc. I just want a simple select, something like this (which is wrong, I know)

SQL> select nest_tab.courses(1)  from  nest_tab;

select nest_tab.courses(1)  from  nest_tab

       *

ERROR at line 1:

ORA-00904: "NEST_TAB"."COURSES": invalid identifier

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2018
Added on Jun 24 2018
4 comments
371 views