我正在尝试从表 A 中删除多条记录,这些记录在表 B 中的 id 列表中退出,如下所示:
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();
我得到以下异常:
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 2, column 100
如果我将列表硬编码 [IN (1,2)] 它可以工作。我想念什么?