Objective: Replace a stored varray and update selected elements of a stored nested table using Oracle SQL.
This exercise is worth 10 points. Use the following schema assumptions so that column names and collection type names are unambiguous:
CUSTOMER_OBJ_TABLE contains CUST_ID and a PHONE_LIST column. The column's SQL collection type is PHONE_ARRAY, defined as VARRAY(5) OF VARCHAR2(20).SALE_HEADER contains SALE_ID and an initialized nested-table column named DETAIL_NEST. Its object elements include numeric attributes ITEM_QTY and DETAIL_AMOUNT.These names define this exercise's example schema. If your practice schema uses a different collection type name, use its declared type constructor. You can write your answer without a database. To execute it, connect to your own practice database with your assigned account and service name; no shared username or password is required here.
UPDATE that replaces customer 29's complete PHONE_LIST with exactly '1-800-444-5623' and '1-310-345-8899', in that order.UPDATE that sets ITEM_QTY to 453 for every element of sale 34's DETAIL_NEST whose DETAIL_AMOUNT equals 3.50. Leave other elements and other sales unchanged.If testing the statements, use disposable practice data with autocommit disabled. Inspect the affected rows and use ROLLBACK to undo the uncommitted practice changes.
ITEM_QTY = 453 for all detail elements belonging to sale 34. Identify which predicate you remove and which you keep.Use the varray type constructor to create the replacement value. For the nested table, use UPDATE TABLE(SELECT ...): the inner WHERE selects the sale, and the outer WHERE selects elements within that sale's collection.
The result page provides a model answer for comparison. It does not execute submitted SQL or calculate an automatic score.
Enter both required UPDATE statements and your answers to both questions, including the all-details variation. Select Submit to view your response alongside the solution.