Problem: How is this SQL suppose to work? I am getting a SQL0216N error and it does not make sense
I must be missing something here because this SQL is giving me SQL0216N error – The number of elements on each side of a predicate operator does not match. Predicate operator is “=”. SQLSTATE=428C4 and I don’t see why. Could someone here explain and correct please?
Here it is:
SELECT A.DBNAME, A.SCHEMA, A.TABLE_NAME, A.COLCOUNT, A.CRTIME
FROM DB2ADMIN.FSNDBTRK A
WHERE A.DBNAME = ‘DBAUDPYL’
AND A.TABLE_NAME NOT IN
(SELECT *
FROM DB2ADMIN.FSNDBTRK B
WHERE B.DBNAME = ‘DBAUDMST’)
;
I want to select only tables that are not found in another schema…differences between tables in one schema and another…simple, eh?
Solution : How is this SQL suppose to work? I am getting a SQL0216N error and it does not make sense
I’m still getting to grips with SQL so sorry if this is completely off the mark but could the fix be:
SELECT A.DBNAME, A.SCHEMA, A.TABLE_NAME, A.COLCOUNT, A.CRTIME
FROM DB2ADMIN.FSNDBTRK A
WHERE A.DBNAME = ‘DBAUDPYL’
AND A.TABLE_NAME NOT IN
(SELECT B.TABLE_NAME
FROM DB2ADMIN.FSNDBTRK B
WHERE B.DBNAME = ‘DBAUDMST’)
The change being in the select statement for your IN criteria.