SQLite VDBE opcode

IfNullRow

Check the cursor P1 to see if it is currently pointing at a NULL row.

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

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

SELECT total FROM sales
addropcodep1p2p3p4p5
0Init01200
1OpenRead017040
2Rewind01100
3IfNullRow0910
4Column0220
5Column0330
6RealAffinity3000
7Multiply3210
8TypeCheck116sales0
9ResultRow1100
10Next0301
11Halt0000
12Transaction00101
13Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Goto, Halt, Init, Multiply, Next, OpenRead, RealAffinity, ResultRow, Rewind, Transaction, TypeCheck.

What the SQLite documentation says

Check the cursor P1 to see if it is currently pointing at a NULL row. If it is, then set register P3 to NULL and jump immediately to P2. If P1 is not on a NULL row, then fall through without making any changes.

If P1 is not an open cursor, then this opcode is a no-op.

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.

← IfNotZero · IfPos →