SQLite Forum

Bug ? Same query that works in shell produces constraint violation when run by a C program with sqlite3_{prepare,bind,step}
Login
As far as you have described the problem, I would agree it ought to work. I also know that parameter binding is very fundamental and well tested. So I think we need to see your bind calls. Unbound parameters default to NULL, so that is where I would focus attention.

You can test binding to a degree with the shell. See the .param meta-command and its help. But I suspect your C code is not doing the binding quite right.