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!

ROWNUM equivalent for Nested Tables?

_Dylan_Jan 9 2009 — edited Jan 13 2009
Is there an equivalent to the ROWNUM pseudocolumn for a nested table such that something like this...
WITH driver_data AS
  (SELECT 1 AS id, sys.dbms_debug_vc2coll('a','b','c') AS val FROM dual
  UNION ALL
  SELECT 2 AS id, sys.dbms_debug_vc2coll('x','y','z') AS val FROM dual)
--
--
SELECT t1.id,
  --t2.rownum as pos,
  t2.column_value AS val
FROM driver_data t1,
     TABLE(t1.val) t2 ;

ID	VAL
1	a
1	b
1	c
2	x
2	y
2	z
...would return something like this...
ID	VAL  POS
1	a      1
1	b      2
1	c      3
2	x      1
2	y      2
2	z      3
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2009
Added on Jan 9 2009
33 comments
3,500 views