137.Oracle数据库SQL开发之 集合——填充集合元素
欢迎转载,转载请标明出处:http://blog.csdn.net/notbaron/article/details/50180787
1. 填充变长数组元素
INSERT语句向customers_with_varray表中添加行。
如下:
INSERT INTO customers_with_varray VALUES (
1, 'Steve','Brown',
t_varray_address(
'2 StateStreet, Beantown, MA, 12345',
'4 HillStreet, Lost Town, CA, 54321'
)
);
INSERT INTO customers_with_varray VALUES (
2, 'John','Smith',
t_varray_address(
'1 HighStreet, Newtown, CA, 12347',
'3 NewStreet, Anytown, MI, 54323',
'7 MarketStreet, Main Town, MA, 54323'
)
);
插入2行。
2. 填充嵌套表元素
用INSERT语句向CUSTOMERS_WITH_NESTED_TABLE中添加行,
插入如下:
INSERT INTO customers_with_nested_table VALUES (
1, 'Steve','Brown',
t_nested_table_address(
t_address('2 State Street', 'Beantown', 'MA', '12345'),
t_address('4 Hill Street', 'Lost Town', 'CA', '54321')
)
);
INSERT INTO customers_with_nested_table VALUES (
2, 'John','Smith',
t_nested_table_address(
t_address('1 High Street', 'Newtown', 'CA', '12347'),
t_address('3 New Street', 'Anytown', 'MI', '54323'),
t_address('7 Market Street', 'Main Town', 'MA', '54323')
)
);
插入两行。