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
What does joining a thread mean?
Which join is default?
How do you optimize a stored procedure in sql?
What is difference between rank () row_number () and dense_rank () in sql?
what is meant by nl2br()? : Sql dba
Where not exists in sql?
What is the difference between instead of trigger and after trigger?
Is there a 64 bit version of ssms?
Where can I learn sql for free?
What is a stored procedure in sql with example?
Can we join two tables without common column?
What is the purpose of the partition table?
What is the sql case statement?
Is sql pronounced sequel or sql?
Can a trigger call a stored procedure?