SQLite VDBE opcode

Move

Move the P3 values in register P1..P1+P3-1 over into registers P2..P2+P3-1.

An example

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

SELECT album_id, count(*), sum(ms) FROM tracks GROUP BY album_id
addropcodep1p2p3p4p5
0Init03900
1Noop1200
2Integer0200
3Null0550
4Gosub43500
5OpenRead04040
6OpenRead250k(2,,)0
7Rewind223700
8DeferredSeek2000
9Column2060
10Compare561k(1,B)0
11Jump1216120
12Gosub32700
13Move6510
14IfPos23800
15Gosub43500
16AggStep009count(0)0
17Column03110
18AggStep01110sum(1)1
19If12100
20Column2070
21Integer1100
22Next2801
23Gosub32700
24Goto03800
25Integer1200
26Return3000
27IfPos12900
28Return3000
29AggFinal900count(0)0
30AggFinal1010sum(1)0
31Copy71200
32Copy91310
33ResultRow12300
34Return3000
35Null07100
36Integer0100
37Return4000
38Halt0000
39Transaction00101
40Null0550
41Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: AggFinal, AggStep, Column, Compare, Copy, DeferredSeek, Gosub, Goto, Halt, If, IfPos, Init, Integer, Jump, Next, Noop, Null, OpenRead, ResultRow, Return, Rewind, Transaction.

What the SQLite documentation says

Move the P3 values in register P1..P1+P3-1 over into registers P2..P2+P3-1. Registers P1..P1+P3-1 are left holding a NULL. It is an error for register ranges P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error for P3 to be less than 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.

← MemMax · Multiply →