SQLite VDBE opcode

NullRow

Move the cursor P1 to a null row if P2 is 0.

An example

13 of the 178 statements we compiled against the sample database use NullRow. This is the one with the shortest program; the rows that use NullRow are highlighted.

SELECT name FROM artists WHERE id IN (1, 2, 3)
addropcodep1p2p3p4p5
0Init02400
1OpenRead02020
2BeginSubrtn0200
3Once01500
4OpenEphemeral110k(1,)0
5Integer1300
6MakeRecord314D0
7IdxInsert14310
8Integer2300
9MakeRecord314D0
10IdxInsert14310
11Integer3300
12MakeRecord314D0
13IdxInsert14310
14NullRow1000
15Return2310
16Rewind12300
17Column1010
18IsNull12200
19SeekRowid02210
20Column0150
21ResultRow5100
22Next11700
23Halt0000
24Transaction00101
25Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: BeginSubrtn, Column, Goto, Halt, IdxInsert, Init, Integer, IsNull, MakeRecord, Next, Once, OpenEphemeral, OpenRead, ResultRow, Return, Rewind, SeekRowid, Transaction.

What the SQLite documentation says

Move the cursor P1 to a null row if P2 is 0. Any Column operations that occur while the cursor is on the null row will always write a NULL.

If cursor P1 is not previously opened, open it now to a special pseudo-cursor that always returns NULL for every column.

If P2 is not 0, then the nullRow flag on the pseudo-cursor is turned off.

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.

← Null · Offset →