字符串缓冲区太小

发布于 2024-08-27 11:58:49 字数 622 浏览 6 评论 0原文

我有 select:

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
wm_concat(px_dtct) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

但我收到错误 ORA-06502: PL/SQL: : 如果我要删除一个字符串,则字符串缓冲区太小,因为有时(当 v.accs= 3570 时) count(*) = 215 但是当我尝试跳过使用 wm_concat for v.accs= 3570 例如这样:

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
(case when v.accs = 3570 then wm_concat(px_dtct) else 'too many' end) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

我仍然有相同的错误消息。但为什么?

I have select:

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
wm_concat(px_dtct) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

but i get error ORA-06502: PL/SQL: : character string buffer too small if i'll remove one string, because sometimes (when v.accs= 3570) count(*) = 215
but when i try to skip using wm_concat for v.accs= 3570 for example this way:

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
(case when v.accs = 3570 then wm_concat(px_dtct) else 'too many' end) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

i still have the same error message. But why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

回眸一遍 2024-09-03 11:58:49

您连接查询的结果。此查询可能会产生很多行,因此最终您将用完字符串长度。也许连接不是这里的方法。当然取决于你想要实现什么。

You concatenate results from a query. This query can result in a lot of rows so eventually you will run out of string length. Maybe concatenation is not the way to go here. Depends on what you want to achieve of course.

风尘浪孓 2024-09-03 11:58:49

为什么?因为您仍然使用 wm_concat 表示 accs=3570...交换 CASE 表达式的 THEN 和 ELSE 部分

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
       (case when v.accs = 3570 then 'too many' else wm_concat(px_dtct) end) npx_DTCT
  from table v group by accs, currency, amount, drcr_ind

Why? Because you still use wm_concat for accs=3570... swap the THEN and ELSE part of your CASE expression

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,wm_concat(ids) npx_IDS,
       (case when v.accs = 3570 then 'too many' else wm_concat(px_dtct) end) npx_DTCT
  from table v group by accs, currency, amount, drcr_ind
南城旧梦 2024-09-03 11:58:49

首先,正如前面所说,您必须在查询中切换 thenelse 子句。
然后,我想您也应该类似地处理第二个 wm_concat,即与 ids 一起使用的那个。

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,
(case when v.accs = 3570 then 'too many' else wm_concat(ids) end) npx_IDS,
(case when v.accs = 3570 then 'too many' else wm_concat(px_dtct) end) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

最后,为什么您认为只有 v.accs = 3570 能够在您面前带来 06502 错误?我想你应该处理所有这些。

First, as it has already been told, you have to switch then and else clauses in your query.
Then, I guess you should also similarily process your second wm_concat, the one that works with ids.

select v.accs, v.currency,v.amount,v.drcr_ind, count(*) qua,
(case when v.accs = 3570 then 'too many' else wm_concat(ids) end) npx_IDS,
(case when v.accs = 3570 then 'too many' else wm_concat(px_dtct) end) npx_DTCT 
from table v
group by accs, currency, amount, drcr_ind

And, finally, why do you think that only v.accs = 3570 is able to bring 06502 error in front of you? I suppose you should handle all of them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文