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
Why we use cross join?
What is vector point function?
What is benefit of creating memory optimized table?
Explain sql data types?
How you improve the performance of sql*loader? : aql loader
How do I create a sql script?
Can a procedure in a package be overloaded?
Why do we go for stored procedures?
how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba
what is a database lock ? : Sql dba
1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins
What is posting?
Can we change the table name in sql?
How to display Row Number with Records in Oracle SQL Plus?
Can we use threading in pl/sql?