Using a numbered parameter (such as ?4) more than once in an SQL statement
(1) By Tim Streater (Clothears) on 2020-05-20 14:44:29 [link]
Can a numbered parameter be used more than once in an SQL statement, such as: select * from mytable where id1=?1 and id2=?1 and ... I had a feeling I'd read somewhere that this works, but I can't find it now. I'd like to know that it's "works as intended and guaranteed", rather than "happens to work in this version but no promises for future versions". Thanks for an insight.
(2) By Richard Hipp (drh) on 2020-05-20 14:58:43 in reply to 1 [link]
It works as intended. And I don't at the moment know where I might clarify that point in the documentation.
(5) By Tim Streater (Clothears) on 2020-05-20 18:17:49 in reply to 2 [link]
On an unrelated note, when I mentioned this on the Xojo User Forum, the spell checker decided that you are, in reality, Richard Hippogriffs.
(3) By Larry Brasfield (LarryBrasfield) on 2020-05-20 15:21:08 in reply to 1
I have needed that feature, and relied upon it after examining the docs, specifically [Binding Values to Prepared Statements](https://sqlite.org/c3ref/bind_blob.html), at the paragraph beginning "The second argument is ...".
(4) By Tim Streater (Clothears) on 2020-05-20 16:24:45 in reply to 3 [link]
Ah thanks. I read that page earlier, but missed that sentence. Must be "Lockdown leads to soggy brain" syndrome.