4
I need to make a report from a database query. The problem is that the query returns more than 1000 expressions and presents the following error:
ORA-01795: the maximum number of expressions in a list is 1000.
Follow the query:
string idsAcoes = string.Join(",\n", listaAcoes.Select(a => a.IdAcao));
var sql = "SELECT l.LOGM_CD_USUA_OPERACAO, "
+ " l.LOGM_IN_OPERACAO, "
+ " l.LOGM_DT_OPERACAO, "
+ " l.LOGM_TX_DADO_INICIAL, "
+ " l.LOGM_TX_DADO_FINAL "
+ "FROM LOG_GESTAO_MUDANCA l, ACAO_MUDANCA am "
+ "WHERE l.LOGM_DS_OPERACAO = 'AcaoMudanca' "
+ " AND l.LOGM_TX_DADO_FINAL LIKE '<AcaoMudanca>%<Id>'||am.ACMU_SQ_ACAO_MDNC||'</Id>%<DataPrazo>%' "
+ " AND am.ACMU_SQ_ACAO_MDNC IN (" + idsAcoes + ") ";
resultado = _session
.CreateSQLQuery(sql)
.List<dynamic>();
Related question: https://answall.com/questions/249313/como-resolvero-erro-ora-01795-n%C3%Bamero-m%C3%A1ximo-de-express%C3%B5es-no-codeigniter
– George Wurthmann
Best scenario would be a subquery in place of the IN bringing the Ids from its source table. 'Acoes' list brings the Ids from where? It is a select in the same BD?
– George Wurthmann
I receive as parameter in the method, but the list comes from a query in the BD.
– GabrielGC