我试图从两个表中选择值并将它们插入一个表中,并计算每年总计的展示位置数.我一直收到一个错误,说这里不允许序列
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,count(placement_id) FROM placement_two group by year);
你可以在
FAQ得到原因
原文链接:https://www.f2er.com/oracle/205071.htmlThe following are the cases where you can’t use a sequence:
For a SELECT Statement:
- 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