The update
method of Android's SQLiteDatabase
class would require that you use ContentValues
, which supports only literal values, not arbitrary SQL expressions.
Just use execSQL
:
db.execSQL("UPDATE table1 SET f1=substr(f2,1,length(f2)-3) WHERE f1 like ? || '%'",
new Object[] { "xxx" });