NotFound
If P4==0 then register P3 holds a blob constructed by MakeRecord.
Jumps: P2 is an instruction address. In the listings here, a jump is drawn as an arc and the address is a link.
An example
2 of the 178 statements we compiled against the sample database use NotFound. This is the one with the shortest program; the rows that use NotFound are highlighted.
SELECT * FROM albums WHERE artist_id IN (SELECT id FROM artists WHERE country = ?)
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 30 | 0 | 0 | |
| 1 | OpenRead | 0 | 3 | 0 | 4 | 0 |
| 2 | Rewind | 0 | 29 | 0 | 0 | |
| 3 | BeginSubrtn | 0 | 1 | 0 | subrtnsig:1,C | 0 |
| 4 | Once | 0 | 17 | 2 | 0 | |
| 5 | OpenEphemeral | 2 | 1 | 0 | k(1,B) | 0 |
| 6 | Blob | 10000 | 2 | 0 | 0 | |
| 7 | OpenRead | 1 | 2 | 0 | 3 | 0 |
| 8 | Rewind | 1 | 16 | 0 | 0 | |
| 9 | Column | 1 | 2 | 3 | 0 | |
| 10 | Ne | 4 | 15 | 3 | BINARY-8 | 82 |
| 11 | Rowid | 1 | 5 | 0 | 0 | |
| 12 | MakeRecord | 5 | 1 | 3 | C | 0 |
| 13 | IdxInsert | 2 | 3 | 5 | 1 | 0 |
| 14 | FilterAdd | 2 | 0 | 5 | 1 | 0 |
| 15 | Next | 1 | 9 | 0 | 1 | |
| 16 | NullRow | 2 | 0 | 0 | 0 | |
| 17 | Return | 1 | 4 | 1 | 0 | |
| 18 | Column | 0 | 1 | 6 | 0 | |
| 19 | Copy | 6 | 7 | 0 | 0 | |
| 20 | Affinity | 7 | 1 | 0 | C | 0 |
| 21 | Filter | 2 | 28 | 7 | 1 | 0 |
| 22 | NotFound | 2 | 28 | 7 | 1 | 0 |
| 23 | Rowid | 0 | 8 | 0 | 0 | |
| 24 | Column | 0 | 1 | 9 | 0 | |
| 25 | Column | 0 | 2 | 10 | 0 | |
| 26 | Column | 0 | 3 | 11 | 0 | |
| 27 | ResultRow | 8 | 4 | 0 | 0 | |
| 28 | Next | 0 | 3 | 0 | 1 | |
| 29 | Halt | 0 | 0 | 0 | 0 | |
| 30 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 31 | Variable | 1 | 4 | 0 | 0 | |
| 32 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Affinity, BeginSubrtn, Blob, Column, Copy, Filter, FilterAdd, Goto, Halt, IdxInsert, Init, MakeRecord, Ne, Next, NullRow, Once, OpenEphemeral, OpenRead, ResultRow, Return, Rewind, Rowid, Transaction, Variable.
What the SQLite documentation says
If P4==0 then register P3 holds a blob constructed by MakeRecord. If P4>0 then register P3 is the first of P4 registers that form an unpacked record.
Cursor P1 is on an index btree. If the record identified by P3 and P4 is not the prefix of any entry in P1 then a jump is made to P2. If P1 does contain an entry whose prefix matches the P3/P4 record then control falls through to the next instruction and P1 is left pointing at the matching entry.
This operation leaves the cursor in a state where it cannot be advanced in either direction. In other words, the Next and Prev opcodes do not work after this operation.
See also: Found, NotExists, NoConflict, IfNoHope
From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.