gpt4 book ai didi

oracle - ORA-02287 : sequence number not allowed here

转载 作者:行者123 更新时间:2023-12-04 00:30:20 30 4
gpt4 key购买 nike

我试图从两个表中选择值并将它们插入到一个表中并计算每年的总展示次数。我一直收到一个错误,说这里不允许使用序列

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);

最佳答案

您可以在 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 - ORA-02287 : sequence number not allowed here,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34546009/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com