Query Nested Table Data

How to query nested table column of a table without using table function?

Questions by sandip01   answers by sandip01

Showing Answers 1 - 3 of 3 Answers

Pooja

  • Sep 3rd, 2012
 

There are two general ways to query a table that contains a collection type as a column or attribute.

Nest the collections in the result rows that contain them.

Distribute or unnest collections so that each collection element appears on a row by itself.

Code
  1. SELECT d.dept_emps

  2.   FROM department_persons d;


DEPT_EMPS(IDNO, NAME, PHONE)
-------------------------------------------------------------
PEOPLE_TYP(PERSON_TYP(1, John Smith, 1-650-555-0135),
PERSON_TYP(2, Diane Smith, 1-650-555-0135))

Code
  1. SELECT e.*

  2.   FROM department_persons d, TABLE(d.dept_emps) e;


IDNO NAME PHONE
---------- ------------------------------ ---------------
1 John Smith 1-650-555-0135
2 Diane Smith 1-650-555-0135

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions