replace values in update statement
Posted on 2003-02-20
I have an update statement that looks like this:
update facility set country_code = ? where facility_id = 1
this questionmark is evaluated by Java based on the user entered values. Since Country_code is a string, if the user does not enter any values, java tries to put in '' (2 single quotes)....however country_code is a foreign key so the statement will blow up...
What I need is a way to evaluate what is being put in place of the question mark....if it is anything other than '', then I want to leave it alone, if it is '', then I want to insert a NULL.
Does that makes sense?