Oracle SQLPlus:计算多列总和时的下划线格式

发布于 2024-09-18 15:59:58 字数 125 浏览 6 评论 0原文

我正在计算同一中断上的多个列的总和,但输出仅在最后一条记录和单个列的列总计之间显示破折号 (-) 下划线...并且它似乎始终是第二列正在计算总和。是否有原因以及将下划线格式应用于所有列的方法?

任何帮助将不胜感激。谢谢。

I am computing the sum of multiple columns on the same break, but the output only displays a dash (-) underline between the last record and the column totals for a single column only...and it appears to always be the second column upon which the sums are being computed. Is there a reason for this and a way to apply the underline format to all columns?

Any assistance would be greatly appreciated. Thanks.

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

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

发布评论

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

评论(1

野の 2024-09-25 15:59:58

这是我在 SQL*Plus 11.2 即时客户端中针对 10g 数据库得到的结果(我已经删除了一些详细信息行,因此总和实际上并不匹配)。

如果您的结果不匹配,我建议您发布更多详细信息(客户端版本、表和查询版本、示例输出...)

break on owner
compute SUM OF leaf_blocks on owner
compute SUM OF num_rows on owner

select owner, index_name, leaf_blocks, num_rows
from all_indexes
where owner in ('MDSYS','CTXSYS')
and num_rows > 0
order by owner, index_name;

OWNER       INDEX_NAME                     LEAF_BLOCKS  NUM_ROWS
----------- ------------------------------ ----------- ---------
CTXSYS      DRC$IDX_COLUMN                        1.00      1.00
            DRX$IXV_KEY                           1.00    118.00
            DRX$OAL_ID                            1.00    120.00
            SYS_IOT_TOP_9752                      1.00    114.00
            SYS_IOT_TOP_9778                      2.00    333.00
***********                                ----------- ---------
sum                                              23.00  1,275.00
MDSYS       SDO_COORD_OPS_COORD_OP_TYPE          12.00  2,244.00
            SDO_COORD_REF_SYS_KIND               21.00  4,384.00
            SDO_COORD_SYS_COORD_SYS_TYPE          1.00     65.00
            SDO_DATUMS_DATUM_TYPE                 2.00    530.00
            SYS_C003008                          15.00  4,384.00
            UNIQUE_STYLES                         1.00     78.00
            UNIT_OF_MEASURE_PRIM                  1.00    128.00
***********                                ----------- ---------
sum                                             137.00 32,202.00

This is what I get in SQL*Plus 11.2 instant client against a 10g database (I've trimmed out some detail lines, so the sums won't actually match).

If your results don't match, I suggest you post more details (client version, table and query versions, sample output...)

break on owner
compute SUM OF leaf_blocks on owner
compute SUM OF num_rows on owner

select owner, index_name, leaf_blocks, num_rows
from all_indexes
where owner in ('MDSYS','CTXSYS')
and num_rows > 0
order by owner, index_name;

OWNER       INDEX_NAME                     LEAF_BLOCKS  NUM_ROWS
----------- ------------------------------ ----------- ---------
CTXSYS      DRC$IDX_COLUMN                        1.00      1.00
            DRX$IXV_KEY                           1.00    118.00
            DRX$OAL_ID                            1.00    120.00
            SYS_IOT_TOP_9752                      1.00    114.00
            SYS_IOT_TOP_9778                      2.00    333.00
***********                                ----------- ---------
sum                                              23.00  1,275.00
MDSYS       SDO_COORD_OPS_COORD_OP_TYPE          12.00  2,244.00
            SDO_COORD_REF_SYS_KIND               21.00  4,384.00
            SDO_COORD_SYS_COORD_SYS_TYPE          1.00     65.00
            SDO_DATUMS_DATUM_TYPE                 2.00    530.00
            SYS_C003008                          15.00  4,384.00
            UNIQUE_STYLES                         1.00     78.00
            UNIT_OF_MEASURE_PRIM                  1.00    128.00
***********                                ----------- ---------
sum                                             137.00 32,202.00
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文