 			target_table .. '.' .. factTableIndividualColumns[c][2] .. ' IS NULL))'
 		end
 		
-		insertStatement = insertStatement .. leftJoins .. ' WHERE NOT EXISTS (SELECT 1 FROM ' .. given_fact_table_name .. ' WHERE (' .. whereClauseKeyComparator .. ') AND (' .. whereNotExistsClause .. ')))'
+		insertStatement = insertStatement .. leftJoins .. ' WHERE NOT EXISTS (SELECT 1 FROM ' .. given_fact_table_name .. ' WHERE (' .. whereClauseKeyComparator .. ') AND (' .. whereNotExistsClause .. ')));'
 		
 		return insertStatement
 	end

			factTable[1][1] = dimensions[a][4] .. ' DECIMAL(10,0), ' .. factTable[1][1] .. ', FOREIGN KEY(' ..  dimensions[a][4] .. ') REFERENCES ' .. dimensions[a][1] ..'(' .. dimensions[a][3] .. ')'
		end
		
		factCreateStatements = 'CREATE OR REPLACE TABLE ' .. given_fact_table_name .. ' (' .. factTable[1][1] .. ')'
		
		return factCreateStatements
	end

		end

		for b = 1, #columns do
			insertStatement[#insertStatement+1] = {'INSERT INTO ' .. target_schema .. '.'  .. columns[b][1] .. '(' .. columns[b][2] .. ') (SELECT DISTINCT ' .. columns[b][2] .. ' FROM ' .. target_schema .. '.' .. target_table .. ' WHERE NOT EXISTS (SELECT 1 FROM ' .. columns[b][1] .. ' WHERE (' .. columns[b][3] .. ')));'}
		end
		
		return insertStatement
