发表于: DB/ES | 作者: | 日期: 2008/11/22 03:11

当插入值需要从另外一张表中检索得到的时候,如下语法的sql语句已经不能完成该功能:
insert into my_table(id, name) value ((select seq_my_table.nextval from dual), ‘runto30’);
会报“ORA-02287: sequence number not allowed here”的错误,可以使用如下语句来完成:
insert into my_table(id, name) select seq_my_table.nextvalue, ‘runto30’ from dual;

参考:http://www.dbforums.com/printthread.php?t=380997

: https://blog.darkmi.com/2008/11/22/526.html

本文相关评论 - 1条评论都没有呢
Post a comment now » 本文目前不可评论

No comments yet.

Sorry, the comment form is closed at this time.