HaltIfNull
Check the value in register P3.
An example
12 of the 178 statements we compiled against the sample database use HaltIfNull. This is the one with the shortest program; the rows that use HaltIfNull are highlighted.
INSERT OR REPLACE INTO genres VALUES ('Jazz', 'Swing')| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 12 | 0 | 0 | |
| 1 | OpenWrite | 1 | 9 | 0 | k(1,) | 0 |
| 2 | String8 | 0 | 2 | 0 | Jazz | 0 |
| 3 | String8 | 0 | 3 | 0 | Swing | 0 |
| 4 | Null | 0 | 1 | 0 | 0 | |
| 5 | HaltIfNull | 1299 | 2 | 2 | genres.name | 1 |
| 6 | Affinity | 2 | 2 | 0 | BB | 0 |
| 7 | SCopy | 2 | 5 | 0 | 0 | |
| 8 | SCopy | 3 | 6 | 0 | 0 | |
| 9 | MakeRecord | 5 | 2 | 4 | 0 | |
| 10 | IdxInsert | 1 | 4 | 5 | 1 | 17 |
| 11 | Halt | 0 | 0 | 0 | 0 | |
| 12 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 13 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Affinity, Goto, Halt, IdxInsert, Init, MakeRecord, Null, OpenWrite, SCopy, String8, Transaction.
What the SQLite documentation says
Check the value in register P3. If it is NULL then Halt using parameter P1, P2, and P4 as if this were a Halt instruction. If the value in register P3 is not NULL, then this routine is a no-op. The P5 parameter should be 1.
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.