Gt
This works just like the Lt opcode except that the jump is taken if the content of register P3 is greater than the content of register P1.
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
6 of the 178 statements we compiled against the sample database use Gt. This is the one with the shortest program; the rows that use Gt are highlighted.
SELECT NOT (id > 5) FROM tracks
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 11 | 0 | 0 | |
| 1 | OpenRead | 1 | 19 | 0 | k(2,,) | 0 |
| 2 | Rewind | 1 | 10 | 1 | 0 | 0 |
| 3 | IdxRowid | 1 | 3 | 0 | 0 | |
| 4 | Integer | 1 | 2 | 0 | 0 | |
| 5 | Gt | 4 | 7 | 3 | 68 | |
| 6 | ZeroOrNull | 3 | 2 | 4 | 0 | |
| 7 | Not | 2 | 1 | 0 | 0 | |
| 8 | ResultRow | 1 | 1 | 0 | 0 | |
| 9 | Next | 1 | 3 | 0 | 1 | |
| 10 | Halt | 0 | 0 | 0 | 0 | |
| 11 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 12 | Integer | 5 | 4 | 0 | 0 | |
| 13 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Goto, Halt, IdxRowid, Init, Integer, Next, Not, OpenRead, ResultRow, Rewind, Transaction, ZeroOrNull.
What the SQLite documentation says
This works just like the Lt opcode except that the jump is taken if the content of register P3 is greater than the content of register P1. See the Lt opcode for additional information.
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.