Shawn
What I need is that if I pass say 10 parameters/variables to a query, I only want to update the column/field if the value passed is NOT NULL. On Wed, Oct 30, 2013 at 3:41 AM, Shawn Green <shawn.l.gr...@oracle.com>wrote: > Hi, > > On 10/29/2013 9:52 PM, h...@tbbs.net wrote: > >> 2013/10/29 11:35 -0400, Shawn Green >>>> >>>>>> >>>>> My favorite technique is the COALESCE function for this on a >> column-by-column basis >> >> SET FieldName1 = Now(), FieldName2 = COALESCE(:MyVariable, FieldName2) >> <<<<<<<< >> but if MyVariable is NULL, FieldName1 reflects the attempt to change, not >> change. >> >> >> > The way I understood the second explanation was like this. > > He wants to update a row of data. The FieldName1 field is always updated > to the current date and time. If any of the new values (passed in via > variables) are not NULL for a specific column, replace the value on the row > with the new value otherwise maintain the current value. > > He may yet mean something completely different than how I read it the > second time. > > -- > Shawn Green > MySQL Senior Principal Technical Support Engineer > Oracle USA, Inc. - Hardware and Software, Engineered to Work Together. > Office: Blountville, TN > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql > >