INSERT INTO INT_TBL_2 (product_id, UR_id, lang_code, country_code, named_obj_class,
named_obj_phonemes, total_phonemes, total_named_objects)
SELECT product_id, UR_id, lang_code, country_code, named_obj_class,
SUM(named_obj_phonemes), SUM(total_phonemes), SUM(total_named_objects)
FROM INT_TBL_1
WHERE named_obj_class = "city"
GROUP BY product_id, UR_id, lang_code, country_code, named_obj_class
我的查询会在Oracle开发人员手动运行时生成正确的结果。但是,当通过C ++代码调用时,相同的查询会产生重复5000次的结果。
请注意,表INT_TBL_2
在插入之前始终为空(新创建)。