I am not sure what do you mean but if you want to compare the password which is in the database with the one(old password) given by the user,
do the following steps,
1.Get the password from the database as a
String and store it in a variable.
2.Compare that variable with the one entered by
user.
3.If both are same update the column with the new
password.
4.If not send an error message.