1、在为H1038公司添加平衡段值时,值集列表中无法选到需要的平衡段值,进一步对其后台取值逻辑进行分析
SELECT *FROM (SELECT FLEXVALUES.FLEX_VALUE, FLEXVALUES.DESCRIPTIONFROM FND_FLEX_VALUES_VL FLEXVALUESWHERE FLEXVALUES.FLEX_VALUE_SET_ID = :1AND FLEXVALUES.SUMMARY_FLAG = 'N'AND NOT EXISTS(SELECT 'X'FROM GL_LEGAL_ENTITIES_BSVS LEBWHERE LEB.FLEX_VALUE_SET_ID = FLEXVALUES.FLEX_VALUE_SET_IDAND LEB.FLEX_SEGMENT_VALUE = FLEXVALUES.FLEX_VALUEAND LEB.LEGAL_ENTITY_ID IN(SELECT LCD.OBJECT_IDFROM GL_LEDGER_CONFIG_DETAILS LCD, GL_LEDGER_CONFIG_DETAILS LCD2WHERE LCD2.OBJECT_ID = :2AND LCD2.OBJECT_TYPE_CODE = 'LEGAL_ENTITY'AND LCD.CONFIGURATION_ID = LCD2.CONFIGURATION_IDAND LCD.OBJECT_TYPE_CODE = 'LEGAL_ENTITY'))AND NOT EXISTS(SELECT 'X'FROM GL_LEDGER_NORM_SEG_VALS NORMSEGVALS, GL_LEDGERS LGRWHERE NORMSEGVALS.LEDGER_ID IN(SELECT D2.OBJECT_IDFROM GL_LEDGER_CONFIG_DETAILS D1, GL_LEDGER_CONFIG_DETAILS D2WHERE D1.OBJECT_ID = :3AND D1.OBJECT_TYPE_CODE = 'LEGAL_ENTITY'AND D2.CONFIGURATION_ID = D1.CONFIGURATION_IDAND D2.OBJECT_TYPE_CODE <> 'LEGAL_ENTITY'AND D2.SETUP_STEP_CODE = 'NONE')AND NORMSEGVALS.SEGMENT_TYPE_CODE = 'B'AND (NORMSEGVALS.STATUS_CODE <> 'D' OR NORMSEGVALS.STATUS_CODE IS NULL)AND LGR.LEDGER_ID = NORMSEGVALS.LEDGER_IDAND LGR.BAL_SEG_VALUE_SET_ID = FLEXVALUES.FLEX_VALUE_SET_IDAND NORMSEGVALS.SEGMENT_VALUE = FLEXVALUES.FLEX_VALUE)) QRSLTWHERE ((UPPER(FLEX_VALUE) LIKE UPPER(:4)))ORDER BY FLEX_VALUE
2、原因是在分配的时候没有完全成功,有一些垃圾数据导致无法选择到平衡段,处理方式:删除垃圾数据重新分配
--删除两张表的数据
SELECT * FROM GL_LEDGER_NORM_SEG_VALS WHERE SEGMENT_VALUE LIKE '%H1038%'-- FOR UPDATE;SELECT * FROM GL_LEDGER_SEGMENT_VALUES T WHERE SEGMENT_VALUE LIKE '%H1038%'-- FOR UPDATE;