我正在尝试执行以下查询
String CREATE_TRIGGER_DELETE_PATIENT =
"CREATE TRIGGER " + KEY_USERID
+" BEFORE DELETE ON " + TABLE_USERS
+" FOR EACH ROW BEGIN "
+" DELETE FROM "+ TABLE_RECORDS
+" WHERE " + KEY_USERID
+ " = " + KEY_RECORDID +" END;";
但是,“END”附近有一个错误(1):语法错误。
我使用http://android-pro.blogspot.sg/2010/10/using-sqlite-database-with-android.html上的教程引用代码。我无法发现错误。
任何人都可以提出补救措施吗?
答案 0 :(得分:1)
您可以查看此http://www.sqlite.org/lang_createtrigger.html链接,这对您有帮助。
答案 1 :(得分:1)
尝试在;
声明之前提供END
。
String CREATE_TRIGGER_DELETE_PATIENT =
"CREATE TRIGGER " + KEY_USERID
+" BEFORE DELETE ON " + TABLE_USERS
+" FOR EACH ROW BEGIN "
+" DELETE FROM "+ TABLE_RECORDS
+" WHERE " + KEY_USERID
+ " = " + KEY_RECORDID +"; END;";
希望它有所帮助。