PL/SQL   «Prev 

Flattening Nested Table in Oracle

SELECT product_id, item_qty, detail_amount
  FROM THE (SELECT detail_nest 
    FROM sale_header
    WHERE sale_id =22)
WHERE detail_amount=78;

Location 1 The SELECT clause for selecting attributes (that is, columns) from the nested table
Location 2The FROM THE clause for specifying details of the outer table
Location 3 The second SELECT clause to select the nested table column (detail_nest) from sale_header (the outer table)
Location 4 The FROM clause to select sale_header (the outer table)
Location 5 The WHERE clause to select a particular row from sale_header, the outer table
Location 6 The WHERE clause to select a particular row from the inner table