0

我正在尝试执行以下查询

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上的教程中引用了代码。我无法发现错误。

任何人都可以提出补救措施吗?

4

2 回答 2

1

您可以查看此http://www.sqlite.org/lang_createtrigger.html链接,它会对您有所帮助。

于 2013-05-27T08:06:01.390 回答
1

尝试给出一个;beforeEND声明。

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;";

希望能帮助到你。

于 2013-05-27T08:08:18.320 回答