oracle – ORA-02287:此处不允许使用序列号

前端之家收集整理的这篇文章主要介绍了oracle – ORA-02287:此处不允许使用序列号前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图从两个表中选择值并将它们插入一个表中,并计算每年总计的展示位置数.我一直收到一个错误,说这里不允许序列
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得到原因

The 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

猜你在找的Oracle相关文章