Another idea would be to use a datastore and avoid "embedded sql" in your code, by doing something similar to this:
Steps:
1) You create a datawindow object in the IDE with a string array or number array argument.
2) Then in code, create the datastore and assign the dataobject of 1)
3) Do a retrieve of that datastore, passing a string- or number array as the parameter.
4) Then delete all rows with one line of code: RowsMove()
5) Update the datastore
6) commit or rollback your changes depending on the outcome of the Update() statement.
7) destroy the datastore
// ----------------------------------- CODE -------------------------------
long ll_idList[] // this example assumes your id's are numeric
datastore lds_delete
// your code to fill ll_idList[]
.....
.....
// 2)
lds_delete = create datastore
lds_delete.dataobject = 'd_name_of_dw_created_in_step_1'
lds_delete.setTransObject(SQLCA)
// 3)
if lds_delete.Retrieve(ll_idList) > 0 then
// 4)
lds_delete.RowsMove(1, lds_delete.rowcount(), Primary!, lds_delete, 1, Delete!)
// 5)
if lds_delete.Update() = 1 then
// 6)
COMMIT;
else
// 6)
ROLLBACK;
end if
end if
// 7)
destroy lds_delete