Link to home
Start Free TrialLog in
Avatar of Paul Wills
Paul WillsFlag for South Africa

asked on

PreparedStatement update does not update on NULL values

Hi Experts

I am trying to update a field with NULL values without success, but If I put an empty String the update works. The problem with putting an empty string is - my column field "fruitname" accepts unique values. I am using JDBC. see below what I am trying to do.

update fruits_tbl set uxservernames=concat(fruitname, \r\n'" + fruitname + "') where fruit_id=" +fruit_id)

The columns

fruit_id (INT) PRK | fruitname (VARCHAR(255) | fruitdescr VARCHAR(255)|

The fruitname column can hold a NULL value.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In my experience MySQL NULL does not match an empty string of zero length.   However if the columns are defined NOT NULL DEFAULT '' an empty string will match.