SQLite VDBE opcode

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 = ?)
addropcodep1p2p3p4p5
0Init03000
1OpenRead03040
2Rewind02900
3BeginSubrtn010subrtnsig:1,C0
4Once01720
5OpenEphemeral210k(1,B)0
6Blob10000200
7OpenRead12030
8Rewind11600
9Column1230
10Ne4153BINARY-882
11Rowid1500
12MakeRecord513C0
13IdxInsert23510
14FilterAdd20510
15Next1901
16NullRow2000
17Return1410
18Column0160
19Copy6700
20Affinity710C0
21Filter228710
22NotFound228710
23Rowid0800
24Column0190
25Column02100
26Column03110
27ResultRow8400
28Next0301
29Halt0000
30Transaction00101
31Variable1400
32Goto0100

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.

← NotExists · NotNull →