如果参数不存在,如何插入?

时间:2012-04-14 20:19:27

标签: actionscript-3 sqlite

当尝试执行以下指令时,我收到错误:SQLError:'错误#3115:SQL错误。',详细信息:'near'WHERE':语法错误',操作:'执行',detailID:'2003' 。有什么想法吗?谢谢!

                dbStatement.text = "INSERT INTO person (idPerson,image) VALUES (:idPerson,:image) " +
                "WHERE NOT EXISTS (SELECT idPerson FROM person WHERE idPerson=:idPerson)";
            dbStatement.parameters[":idPerson"] = person.idPerson; 
            dbStatement.parameters[":image"] = person.image; 
            dbStatement.execute();

1 个答案:

答案 0 :(得分:0)

您可能正在寻找INSERT OR REPLACE person ( ... ) VALUES( ... )