I have the following table:
SomeName
ID number(8) not null,
Field1 varchar2(50) not null,
Field2 varchar2(50) not null,
Field3 varchar2(50) not null
In this table I have the following rows:
ID,Field1,Field2,Field3
12,'text1','text2','text3'
Now I want to update only the field2 (with an ajax request):
HTTP PUT http://host/DataService/SomeName(12M)
Accept: application/json, text/javascript, */*
Content-Type: application/json; charset=utf-8
{ Field2: 'updated field 2' }
I would have expected that this would translate to:
update sometable
set field2 = 'updated field 2'
where id = '12'
but it doesn't. Instead I receive an error that says that field1 and field3 can not be null. Is there an easy way around this, so that only the columns specified in the request get updated? Do I have to select the affected row first in order to complete the missing values (which I don't want for performance reasons)? I also don't want to store the not affected columns in hidden fields on the client side, just to get the update to work. I'm using the EFOracleProvider with EF4.
Any Ideas?