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
Is truncate ddl or dml?
What is db journal file?
How to call a javascript function from pl sql?
What is sql*loader?
What are the sql commands?
Does inner join remove duplicates?
what is a table called, if it has neither cluster nor non-cluster index? What is it used for? : Sql dba
what is the difference between undefined value and null value? : Sql dba
List the ways to get the count of records in a table?
List different type of expressions with the example.
what is foreign key? : Sql dba
What is a trigger in sql?
How many row comparison operators are used while working with a subquery?
Does sql*plus also have a pl/sql engine?
define join and explain different type of joins? : Sql dba