如何解决如何使用 querydsl
我为下面的 Oracle SQL 查询编写了查询 DSL DB 查询,它工作正常,但是当结果字符串太长超过 4000 时,它会给我一个错误,所以我找到了另一种方法来做到这一点,它附在下面,我需要使用查询 DSL 编写该查询,但我不知道该怎么做,你能帮我做吗? 下面我附上了详细的查询。
sql listagg 查询
listagg(to_char(qTable.AVAIL_DATE,'DD.MM.YYYY'),',') within group (order by qTable.AVAIL_DATE asc) availableDate,
上面查询的querydsl代码
SQLExpressions.listagg( Expressions.stringTemplate(
"to_char({0},'{1s}')",qTable.availDate,ConstantImpl.create("DD.MM.YYYY")),"," ).withinGroup().orderBy( qTable.availDate ).getValue()
.as( "availableDate" ),
当字符串太长时,它会给我以下错误
ORA-01489: result of string concatenation is too long
01489. 00000 - "result of string concatenation is too long"
*Cause: String concatenation result is more than the maximum size.
*Action: Make sure that the result is less than the maximum size.
找到以下替代方法来完成上述任务而没有提到错误,需要帮助编写上述查询,如下所示。
SELECT RTRIM(XMLAGG(XMLELEMENT(E,').EXTRACT('//text()') ORDER BY colname).GetClobVal(),') AS LIST
FROM qTable;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。