I have following oracle apex ajax callback process:
DECLARE
inspection_id number;
inner_id number;
BEGIN
inspection_id := apex_application.g_x01;
inner_id := apex_application.g_x02;
apex_debug.info('=====================================');
apex_debug.info('DELETE ENTRY WITH INSPECTION_ID: '||inspection_id||' AND INNER_ID: '||inner_id);
DELETE FROM CHLI_IMAGES WHERE (INSPECTION_ID = inspection_id AND INNER_ID = inner_id);
apex_debug.info('ROWS DELETED '|| SQL%ROWCOUNT);
apex_json.open_object;
apex_json.write('success', true);
apex_json.write('message', sqlerrm);
apex_json.write('INSPECTION_ID', inspection_id);
apex_json.write('INNER_ID', inner_id);
apex_json.write('result', true);
apex_json.close_object;
EXCEPTION
WHEN OTHERS THEN
apex_json.open_object;
apex_json.write('success', false);
apex_json.write('message', sqlerrm);
apex_json.close_object;
END;
And it is called by the js here:
apex.server.process("DeleteFromDB", {
x01: 0, //inspection_id
x02: 2, //inner_id
}, {
success: function (pData) {
console.log(pData);
if (pData.success === true) {
resolve(true);
}
},
error: function (request, status, error) {
console.log(request);
resolve(false);
}
});
The really weired things is that it does not work as expected. This code deletes not only rows with inespection = 0 & inner_id = 2. It also deletes every other row in table. The two ids comming correctly to the process I cheked it within debugging. The JS snippet is in a async loop, but I also checked within debugging that it runs only once.
The weired thing is that it only works with this static line:
DELETE FROM CHLI_IMAGES WHERE (INSPECTION_ID = 0 AND INNER_ID = 2);
Does oracle apex has a bug or do I overlook something always and always again.
Thanks in advance,
Filip.