ORA-02287:此处不允许使用序列号 [英] ORA-02287: sequence number not allowed here
本文介绍了ORA-02287:此处不允许使用序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从两张表中选择值,然后将它们插入一张表中,并计算每年的总展示位置数量.我不断收到错误消息,说明此处不允许使用序列
I am trying to select values from two tables and insert them into one table and calculate the number of placements in total per year. I keep getting an error saying sequence not allowed here
DROP table placement_cal CASCADE CONSTRAINTS;
CREATE TABLE placement_cal(
cal_id INTEGER NOT NULL,
year INTEGER,
no_of_placements INTEGER,
CONSTRAINT pk_cal_dim PRIMARY KEY (cal_id)
);
INSERT INTO placement_cal (
SELECT cal_id.nextval , EXTRACT(YEAR FROM start_date) , count(placement_id)
FROM placement
group by year);
INSERT INTO placement_cal (
SELECT cal_id.nextval , EXTRACT(YEAR FROM start_date) , count(placement_id)
FROM placement_two
group by year);
推荐答案
您可以在常见问题解答
以下是无法使用序列的情况:
The following are the cases where you can't use a sequence:
对于SELECT语句:
For a SELECT Statement:
- 在WHERE子句中
- 在GROUP BY或ORDER BY子句中
- 在DISTINCT子句中
- 与UNION或INTERSECT或MINUS一起
- 在子查询中
- In a WHERE clause
- In a GROUP BY or ORDER BY clause
- In a DISTINCT clause
- Along with a UNION or INTERSECT or MINUS
- In a sub-query
这篇关于ORA-02287:此处不允许使用序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文