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 can we know the count/number of elements of an array? : Sql dba

665


What is a schema sql?

627


What is the difference between row level and statement level trigger?

621


Is left join inner or outer by default?

626


Where is sql database stored?

601






What is view? Can we update view

966


What does trigger mean in slang?

616


What are the query optimization techniques?

621


What are tables in sql?

633


What is materialized view in sql?

552


How do you use join?

612


What does 0 mean in sql?

614


Is sql a case sensitive language?

623


What is example of database?

612


How many types of privileges are available in sql?

849