我们如何在 oracle 数据库表中创建数组,我需要在 java 中获取数据
How we create an array in oracle database tables and i need to fetch data in java
我正在创建一个 table,其中包含 id primary 和 contact_id(外键)等字段,我想要两个数组,一个用于 mail_id,一个用于 phone 数字我该怎么做?
您可以通过创建 type
的 字符串数组 来实现:
SQL> create type arr_str is varray(10) of varchar2(10);
2 /
Type created
SQL> create table ContactProperties(
2 id int primary key,
3 contact_id int references contact(id),
4 email_id arr_str,
5 "number" arr_str);
Table created
P.S。 number
是 保留关键字 ,如果用作 table.
的列名,则必须用引号引起来
您可以通过创建 type
的 字符串数组 来实现:
SQL> create type arr_str is varray(10) of varchar2(10);
2 /
Type created
SQL> create table ContactProperties(
2 id int primary key,
3 contact_id int references contact(id),
4 email_id arr_str,
5 "number" arr_str);
Table created
P.S。 number
是 保留关键字 ,如果用作 table.