Subject | Insert error: count of column and variable list do not match |
---|---|
Author | |
Post date | 2017-12-29T14:32:14Z |
I'm trying to insert data from a query into a table however I receive the following error message:
SQL Message : -104
Invalid token
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Invalid command
count of column list and variable list do not match
The table is defined as:
CREATE GLOBAL TEMPORARY TABLE tmp_gdlmove
(
verid BIGINT,
level_num SMALLINT,
parentid BIGINT,
times_assigned SMALLINT,
journey CHAR(1)
)
ON COMMIT DELETE ROWS;
and the query I'm trying is defined as:
INSERT INTO tmp_gdlmove (verid, level_num, parentid, times_assigned)
VALUES((SELECT verid, level_num, parentid, count(*) as times_assigned
FROM (SELECT DISTINCT ass.verid, org.level_num, ass.ORGID, och.parentid,
org.org_nme
FROM ASSIGNMENT ass
INNER JOIN orgchart och on och.childid=ass.orgid
INNER JOIN organisation org on och.parentid=org.orgid
WHERE verid IN (3) AND level_num IN (1,2) and depth =1)
GROUP BY verid, level_num, parentid))
The select portion of the query returns the same number of columns as I have listed in the insert statement so I'm unsure why I receive this message.