如何将数据插入到架构中具有多个引用的对象关系表中
我有一个表,其模式为 Table(number, ref, ref, varchar2, varchar2,...)。
如何向该表中插入一行数据?
当我这样做时:
insert into table
values (1, select ref(p), ref(d), '239 F.3d 1343', '35 USC § 283', ...
from plaintiff p, defendant d
where p.name='name1' and d.name='name2');
我收到“缺少表达式”错误。
如果这样做:
insert into table
1, select ref(p), ref(d), ...
from plaintiff p, defendant
where p.name=...;
我会收到“缺少关键字值”错误。
I have a table with a schema of Table(number, ref, ref, varchar2, varchar2,...).
How would I insert a row of data into this table?
When I do:
insert into table
values (1, select ref(p), ref(d), '239 F.3d 1343', '35 USC § 283', ...
from plaintiff p, defendant d
where p.name='name1' and d.name='name2');
I get a "missing expression" error.
If I do:
insert into table
1, select ref(p), ref(d), ...
from plaintiff p, defendant
where p.name=...;
I get a "missing keyword VALUES" error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的插入语法已关闭。尝试:
一般来说,明确提及要插入的列是一个很好的做法,以避免以后列顺序发生变化时出现问题,并对代码进行自我记录:
Your syntax on the insert is off. Try:
In general, it's a good practice to explicitly mention the columns you're inserting into as well, to avoid problems later if the column order changes, as well as to self-document the code:
给定一个像这样的表...
我们可以像这样填充它...
...或者像这样...
REF 长得令人眼花缭乱:
SQL>从案例中选择*
2 /
Given a table like this ...
We can populate it like this ...
... or like this ...
The REFs are eye-wateringly long:
SQL> select * from cases
2 /