What are Nested Tables? How will u delete 5 rows from Nested
Tables

Answer Posted / keshav

CREATE Or Replace TYPE AddressType AS OBJECT (
street VARCHAR2(15),
city VARCHAR2(15),
state CHAR(2),
zip VARCHAR2(5)
);

CREATE Or Replace TYPE nested_table_AddressType AS TABLE OF AddressType;

CREATE TABLE employee (
id INTEGER PRIMARY KEY,
first_name VARCHAR2(10),
last_name VARCHAR2(10),
addresses nested_table_AddressType
)
NESTED TABLE
addresses
STORE AS
nested_addresses;

INSERT INTO employee VALUES (
1, 'Steve', 'Brown',
nested_table_AddressType(
AddressType('2 Ave', 'City', 'MA', '12345'),
AddressType('4 Ave', 'City', 'CA', '54321')
)
);

DELETE FROM TABLE (
SELECT addresses FROM employee WHERE id = 1
) addr
WHERE
VALUE(addr) = AddressType(
'4 Ave', 'City', 'CA', '54321'
);

Is This Answer Correct ?    16 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you explain an index number?

747


What is the difference between between and in condition operators?

726


How do you select unique values in sql?

709


What does select top 1 do in sql?

730


How to Declare Fixed Length String Value In PL SQL

843






What is server name sql?

804


What is an implicit commit?

762


Does sap use sql?

717


Show code of a cursor for loop.

772


Why do we use %rowtype & %type in plsql?

786


What are the two characteristics of a primary key?

669


How to get each name only once from an employee table?

807


Is it possible to create startup or shutdown trigger for on-schema?

780


Why schema is used in sql?

726


What is the non-clustered index in sql?

753