使用select不允许使用SQL Oracle Sequence

时间:2017-11-28 03:11:57

标签: sql oracle

使用以下方法创建序列:

CREATE SEQUENCE customers_seq
 START WITH     1000
 INCREMENT BY   1
 NOMAXVALUE
 ORDER;

但是当我尝试这个时

SELECt customers_seq.Nextval from dual

我收到了这个错误:

ORA-02201: sequence not allowed here
02201. 00000 -  "sequence not allowed here"
*Cause:    An attempt was made to reference a sequence in a from-list.
*Action:   A sequence can only be referenced in a select-list.
Error at Line: 8 Column: 34

如何解决此错误?

1 个答案:

答案 0 :(得分:1)

我明白了为什么从双重选择不起作用。 我在select * from user_sequences中有一个名为dual的序列。

我做的是“丢弃序列双重” 然后再次工作