I am trying to delete multiple records from TABLE A that exits in list of ids in TABLE B as follows:
List<ulong> ids = new List<ulong> {1, 2};
string deleteQuery = string.Format(
@"DELETE FROM TABLE_A WHERE EXISTS
(SELECT id FROM TABLE_B WHERE checkpoint_id IN :idList)");
Session.CreateQuery(deleteQuery).SetParameterList("idList", ids).ExecuteUpdate();
I get the following Exception:
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 2, column 100
If I put the list hardcoded [IN (1,2)] it works.
What do I miss?
Found the problem:
I needed an extra brackets arround the :idList.