在我的seletc查询中使用XMLAgg时遇到一个问题。 执行以下查询时,我没有得到完整的o / p:
select XMLELEMENT
("SAPC", XMLAgg
(XMLELEMENT
("AT",
XMLATTRIBUTES(dn.dn_num as MSISDN, ict.TEXT01 as IMEI, at1.TAC as TAC))))
from (select TAC,city from AT_Test at where city in
(select cc.CCCITY from
ccontact_all cc, contract_all ca where
cc.customer_id = ca.customer_id and
trunc(CO_INSTALLED) >= '30-MAY-2014') ) at1,
ccontact_all cc, contract_all ca, directory_number dn, contr_services_cap csc,
INFO_CONTR_TEXT ict where
cc.customer_id = ca.customer_id and
ca.co_id = csc.co_id and
at1.city = cc.CCCITY and
csc.dn_id = dn.dn_id and
ict.co_id = ca.co_id and
trunc(CO_INSTALLED) >= '30-MAY-2014';
我正在等待
<SAPC><AT MSISDN="213471000153" IMEI="123456789012" TAC="16003"></AT><AT MSISDN=
输出应该像
<SAPC>
<AT MSISDN="213471000154" IMEI="123456789012" TAC="16003"></AT>
<AT MSISDN=MSISDN="213471000155" IMEI="123456789014" TAC="16002"></AT>
<AT MSISDN="213471000156" IMEI="123456789013" TAC="16003"></AT>
</SAPC>
请帮助。
谢谢! HK Mishra
答案 0 :(得分:1)
set linesize 2000
会有所帮助。
答案 1 :(得分:0)
感谢回复。但我使用下面的查询进行一些更改,即我使用'rtrim'以及set linesize命令但没有得到正确的输出。
select rtrim(XMLELEMENT
("AT",
XMLAgg
(XMLELEMENT
("SAPC",
XMLATTRIBUTES(dn.dn_num as MSISDN, ict.TEXT01 as IMEI, at1.TAC as TAC)))))
from (select TAC,city from AT_Test at where city in
(select cc.CCCITY from
ccontact_all cc, contract_all ca where
cc.customer_id = ca.customer_id and
((to_date(co_installed,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS')) or (to_date(CCMODDATE,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS')) or (to_date(CO_MODDATE,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS'))))) at1,
ccontact_all cc, contract_all ca, directory_number dn, contr_services_cap csc,
INFO_CONTR_TEXT ict where
cc.customer_id = ca.customer_id and
ca.co_id = csc.co_id and
at1.city = cc.CCCITY and
csc.dn_id = dn.dn_id and
ict.co_id = ca.co_id and
ca.ch_status = 'a' and
((to_date(co_installed,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS')) or (to_date(CCMODDATE,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS')) or (to_date(CO_MODDATE,'SSSSS') between
to_date(36000,'SSSSS') and to_date(43200,'SSSSS')));
我得到的输出如下:
RTRIM(XMLELEMENT("AT",XMLAGG(XMLELEMENT("SAPC",XMLATTRIBUTES(DN.DN_NUMASMSISDN,ICT.TEXT01ASIMEI,AT1.TACASTAC)))))
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<AT><SAPC MSISDN="213470000095" IMEI="869763011575795" TAC="16001"></SAPC><SAPC MSISDN="213470000096" IMEI="869763011581041" TAC="16001"></SAPC><SAPC MSISDN="213470000098" IMEI="869763011578302" TAC="16001"></SAPC></AT>