mysql - SQL Error #1064 with Begin Statement -
sql
begin update gcm_users set gcm_regid="fff" user_id=8; if sql%rowcount = 0 insert gcm_users (gcm_regid, user_id) values ("dsdtrytujytetgeryrtyh", "8"); end if; end;
error : #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'update gcm_users set gcm_regid="dsdtrytujytetgeryrtyh" user_id=8' @ line 2
edit:
------------------------------------------------------------ | id | user_id | gcm_regid | created_at | status | ------------------------------------------------------------ | 1 | 22 | ********* | 2015-04-25 13:13:39 | 1 | | 2 | 33 | ********* | 2015-04-25 13:13:39 | 1 | | 3 | 13 | ********* | 2015-04-25 13:13:39 | 1 | | 4 | 12 | ********* | 2015-04-25 13:13:39 | 1 | | 5 | 67 | ********* | 2015-04-25 13:13:39 | 1 | | 6 | 65 | ********* | 2015-04-25 13:13:39 | 1 | ------------------------------------------------------------
can please me fix error?
string literals in sql denoted single quotes ('
), not double quotes ("
):
begin update gcm_users set gcm_regid='fff' user_id=8; if sql%rowcount = 0 insert gcm_users (gcm_users, user_id) values ('dsdtrytujytetgeryrtyh', 8); end if; end;
Comments
Post a Comment