all VALUES must have the same number of terms
(1) By Anurag Nair (AnuragNair) on 2022-06-07 11:41:53 [link] [source]
Hi when I load one data onto SQLite, I get an error saying "all VALUES must have the same number of terms". Can anyone help me solve this as its urgent.
(2) By curmudgeon on 2022-06-07 12:13:03 in reply to 1 [link] [source]
I'm guessing if you're using VALUES then each set must have the same number of values.
e.g.
insert into t values (3,2), (1,0)
is fine but
insert into t values (3,2), (1)
isn't.
(3) By Stephan Beal (stephan) on 2022-06-07 12:14:50 in reply to 1 [link] [source]
"all VALUES must have the same number of terms"
That happens when mismatched VALUES are passed to an insert, e.g.:
> insert into t(a) values(1),(2,3);
Parse error near line 1: all VALUES must have the same number of terms
Notice that the first one has 1 value and the 2nd one has 2 values.
If this is happening via an importer app, it sounds likely that your imported data has a varying number of columns. Importing generally requires that all rows have the same number of columns.
(4) By Keith Medcalf (kmedcalf) on 2022-06-07 12:24:26 in reply to 3 [source]
This is not related to the INSERT
statement, but rather to the VALUES [list of tuples]
. VALUES returns a projection. Projections must be square.
It does not matter where a non-square VALUES clause is used, it is invalid in all uses -- that is, directly or as part of another statement (it can be used anywhere).