- ·上一篇内容:解决Oracle启动但不能登录的问题
- ·下一篇内容:如何恢复ORACLE中被DROP的列
嵌套表的用法
嵌套表的用法
SQL> CREATE OR REPLACE TYPE tnt_names AS TABLE OF VARCHAR2(64);
2 /
类型已创建。
已用时间: 00: 00: 00.04
SQL> create table test_yct( id number(2), names tnt_names) nested table names store as test_yct_names;
表已创建。
已用时间: 00: 00: 00.02
SQL> insert into test_yct values(1, tnt_names('yuechaotian1', 'yuexingtian1', 'jinglitian1'));
已创建 1 行。
已用时间: 00: 00: 00.00
SQL> insert into test_yct values(2, tnt_names('yuechaotian2', 'yuexingtian2', 'jinglitian2'));
已创建 1 行。
已用时间: 00: 00: 00.00
SQL> col names format a60
SQL> select * from test_yct;
ID NAMES
---------- ------------------------------------------------------------
1 TNT_NAMES('yuechaotian1', 'yuexingtian1', 'jinglitian1')
2 TNT_NAMES('yuechaotian2', 'yuexingtian2', 'jinglitian2')
已用时间: 00: 00: 00.00
SQL> select y.id, c.* from test_yct y, table(y.names) c;
ID COLUMN_VALUE
---------- ----------------------------------------------------------------
1 yuechaotian1
1 yuexingtian1
1 jinglitian1
2 yuechaotian2
2 yuexingtian2
2 jinglitian2
已选择6行。
已用时间: 00: 00: 00.00
微信搜索“优雅的代码”关注本站的公众号,或直接使用微信扫描下面二维码关注本站公众号,以获取最新内容。
个人成长离不开各位的关注,你的关注就是我继续前行的动力。