Set foreign key column with default value to null
Posted by: Fredrik Tyboni
Date: February 10, 2017 07:34AM

I have a table with a column defined like

refId INTEGER NOT NULL DEFAUlT 0

If I try to set it to null using a "database tool" (in this case Sequel Pro 1.1.2), by issuing

update mytable set refId = null;

it works fine, and the column gets set to the default value of 0. However, if I try to issue exactly the same update via the JDBC driver from Java, I get

java.sql.SQLIntegrityConstraintViolationException: Column 'refId' cannot be null

This seems very strange to, not sure if it's a bug?

Options: ReplyQuote


Subject
Written By
Posted
Set foreign key column with default value to null
February 10, 2017 07:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.