[英]Why do some users and not others get ORA-01400: cannot insert NULL into primary key
I know how to fix it.我知道如何解决它。 I am just wondering why it worked on some developer machines and not others.
我只是想知道为什么它适用于某些开发人员机器而不是其他机器。 I have replaced actual names and values for clarity.
为了清楚起见,我已经替换了实际名称和值。
INSERT INTO MYTABLE (COL2, COL3, COL4, COL5, COL6)
SELECT 0, 1, 2, 3, 4
My fix is我的解决方法是
INSERT INTO MYTABLE (COL1, COL2, COL3, COL4, COL5, COL6)
SELECT MYTABLE_SEQ.NEXTVAL, 0, 1, 2, 3, 4
But why wasn't it necessary on all developer machines?但是为什么在所有开发人员机器上都没有必要呢?
The same table behaves the same way, so - if all of them (developers) used the same INSERT
statement, connected to the same database (user), they'd get the same result - either success or a failure.同一个表的行为方式相同,所以 - 如果他们(开发人员)都使用相同的
INSERT
语句,连接到同一个数据库(用户),他们会得到相同的结果 - 成功或失败。
However, if they have their own schemas, then it depends on the way they created target tables.但是,如果他们有自己的模式,那么这取决于他们创建目标表的方式。
Behaviour you described could be result of您描述的行为可能是由于
which then "automatically", in the background , populate that NOT NULL
column.然后在后台“自动”填充
NOT NULL
列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.