"record" 嵌套在 table 列中
Nested "record" in the table column
我们将调用 "pair" 一种在其定义中使用两种不同数据类型的数据类型
(分别为 "type1" 和 "type2")。
定义这样一种数据类型,指明它代表什么,并通过将这种类型的列添加到架构中的一个表来使用它。
我以为我会很快解决记录,但似乎我不能使用这种类型的数据或者我没有正确使用它。
有什么建议吗?
我是这样理解问题的;如果您发布自己的尝试可能会更好。
SQL> create or replace type t_pair_rec is object
2 (dob date,
3 name varchar2(10)
4 );
5 /
Type created.
SQL> create table test
2 (id number,
3 other t_pair_rec
4 );
Table created.
SQL> insert into test (id, other) values
2 (1, t_pair_rec(date '2020-01-28', 'Littlefoot'));
1 row created.
SQL> select * from test;
ID OTHER(DOB, NAME)
---------- ----------------------------------------
1 T_PAIR_REC('28.01.20', 'Littlefoot')
SQL>
我们将调用 "pair" 一种在其定义中使用两种不同数据类型的数据类型 (分别为 "type1" 和 "type2")。
定义这样一种数据类型,指明它代表什么,并通过将这种类型的列添加到架构中的一个表来使用它。
我以为我会很快解决记录,但似乎我不能使用这种类型的数据或者我没有正确使用它。
有什么建议吗?
我是这样理解问题的;如果您发布自己的尝试可能会更好。
SQL> create or replace type t_pair_rec is object
2 (dob date,
3 name varchar2(10)
4 );
5 /
Type created.
SQL> create table test
2 (id number,
3 other t_pair_rec
4 );
Table created.
SQL> insert into test (id, other) values
2 (1, t_pair_rec(date '2020-01-28', 'Littlefoot'));
1 row created.
SQL> select * from test;
ID OTHER(DOB, NAME)
---------- ----------------------------------------
1 T_PAIR_REC('28.01.20', 'Littlefoot')
SQL>