Merge funktioniert nicht für CLOB. Es funktioniert nur für kleine Zeichenfolgenwerte. In der folgenden SQL sind: eai_msg, msg_req_text, msg_req_rply alle CLOB.
Wenn ich Daten wie "etwas" übergebe, funktioniert es.
Es funktioniert nicht für die Eingabe von 1200+ Zeichen:
"merge into some_table msg using (select 1 from DUAL) d "
+ "on (msg.corr_id= :correlationId) "
+ "when matched then "
+ "update set msg.rptg_id = :rptgId, "
+ "eai_rcvd_date = :receivedDate, "
+ "msg.eai_msg_text = :msgText, "
+ "msg.msg_req_text = :request, "
+ "msg.msg_rply_text = :reply, "
+ "msg.eai_svc_name = :serviceName, "
+ "msg.eqmt_cnt = :eqmtCount "
+ "when not matched then "
+ "insert (RPTG_ID, EAI_RCVD_DATE, EAI_MSG_TEXT, MSG_REQ_TEXT, MSG_RPLY_TEXT, EAI_SVC_NAME, EQMT_CNT, CORR_ID,MSG_KEY) "
+ "values (:rptgId, :receivedDate, :msgText, :request,:reply,:serviceName, :eqmtCount, :correlationId,:msgKey)"
Hier ist meine Speichermethode in Dao
public int saveEaiData(final SaveOriginalEAIRequestDto saveOriginalEaiDto) {
NCDateTime eaiReceivedDateTime = saveOriginalEaiDto.getEaiReceivedDateTime();
MapSqlParameterSource paramMap = new MapSqlParameterSource();
paramMap.addValue("msgKey", sequence.nextLongValue());
paramMap.addValue("rptgId", saveOriginalEaiDto.getReportingId());
if (eaiReceivedDateTime != null) {
paramMap.addValue("receivedDate", eaiReceivedDateTime.getCalendarUTC());
} else {
paramMap.addValue("receivedDate", null);
}
paramMap.addValue("msgText", saveOriginalEaiDto.getEaiText(), Types.CLOB);
paramMap.addValue("request", saveOriginalEaiDto.getRequestText(), Types.CLOB);
paramMap.addValue("reply", saveOriginalEaiDto.getReplyText(), Types.CLOB);
paramMap.addValue("serviceName", saveOriginalEaiDto.getEaiServiceName());
paramMap.addValue("eqmtCount", saveOriginalEaiDto.getEquipmentCount());
paramMap.addValue("correlationId", saveOriginalEaiDto.getCorrelationId());
try {
return getSimpleJdbcTemplate().update(MERGE_ORIGINAL_EAI_MSG_RECEIVED, paramMap);
} catch (Exception e) {
throw new IllegalStateException("Exception occured in saveEaiData" + e);
}
}