SQLite VDBE opcode

Add

Add the value in register P1 to the value in register P2 and store the result in register P3.

An example

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

SELECT ms / 1000, ms % 1000, ms * 2, ms - 1, ms + 1 FROM tracks
addropcodep1p2p3p4p5
0Init01600
1OpenRead04040
2Rewind01500
3Column0360
4Divide7610
5Column0360
6Remainder7620
7Column0360
8Multiply8630
9Column0360
10Subtract9640
11Column0360
12Add9650
13ResultRow1500
14Next0301
15Halt0000
16Transaction00101
17Integer1000700
18Integer2800
19Integer1900
20Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Divide, Goto, Halt, Init, Integer, Multiply, Next, OpenRead, Remainder, ResultRow, Rewind, Subtract, Transaction.

What the SQLite documentation says

Add the value in register P1 to the value in register P2 and store the result in register P3. If either input is NULL, the result is NULL.

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.

← Abortable · AddImm →