-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
mrezaei@stripped wrote:
> I have a table that has a NOT NULL column. Using command line sql, the
> following statement will generate an error:
>
> update TableNulls set descNotNull=NULL
>
> If I write this as a prepared statement:
> "update TableNulls set descNotNull=?"
>
> and then:
> statement.setNull(1, java.sql.Types.VARCHAR);
> stm.executeUpdate();
>
> The statement executes with no errors. I would expect to get an exception
> in this case (other drivers/rdbms' behave that way).
>
> MySql 4.1 nightly, InnoDb tables
> JDBC driver: 3.0.6
>
> Thanks
> Mohammad Rezaei
> Starpoint Solutions
>
This is a known design decision in MySQL. If you set a column that is
marked as 'NOT NULL' to NULL, it is set to an implicit default value, see:
http://www.mysql.com/doc/en/Design_Limitations.html
-Mark
- --
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/
For technical support contracts, visit https://order.mysql.com/?ref=mmma
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <mark@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+cQ9ztvXNTca6JD8RAtZmAJoDqqSI8jvbgjU9acUcHJG724NEVACdGRQk
ntwInDwT2Bt4R7nbnN2QPe8=
=eERN
-----END PGP SIGNATURE-----