I have a subflow in esql (IBM Websphere Message Broker) where I need to achieve something similar to select distinct
functionality.
Some background: I have a table in an Oracle database group_errcode_ref
. This table is pretty much a fixed link/mapping of ERROR_CODE
and ID
. ERROR_CODE
is unique, but ID
can be duplicated. For example error code 4000 and 4001 can both be linked to ID 1.
In my esql subflow, I have an array of error codes that varies based on the current data coming into the flow.
So what I need to do is I need to take the input error code array, and select the ID
for all the error codes in the array from my table group_errcode_ref
What I have now:
declare db rows;
set db.rows[] = (select d.ID from Database.group_errcode_ref as d where d.ERROR_CODE in (select D from errCodes.Code[] as D);
errCodes
is the array of error codes from the input. row
is an array of all IDs that correspond to the error codes.
This is fine, but I want to remove duplicates from the db.rows[]
array.
I'm not certain the best way to do this in esql, but it does not support distinct
. group by
, or order by