在Oracle SQL开发人员中获取错误,试图打印XML

发布于 2025-01-21 23:31:26 字数 774 浏览 0 评论 0原文

我正在尝试打印以下XML,因为


plco_id是a-006884-2

trt_numc是103

trt_familyc是1

trt_days是2513

NeoAdjuvant是0


plco_id is a-008288-4

trt_numc是104

trt_familyc is 104 trt_familyc is 1

trtt_days

is 3331 is 3331


neoad. 但是,

我遇到了一个错误。我相信我的循环是正确的,因为我需要在此特定问题上使用隐式光标。我想我可能必须在打印中使用rpad()才能正确打印出来,但我不确定。代码附加在下面。事先感谢您的帮助!

XML代码是此

“在此处输入图像描述”

”在此处输入图像说明”

I am trying to print the following XML as


PLCO_ID is A-006884-2

Trt_numc is 103

Trt_familyc is 1

Trt_days is 2513

Neoadjuvant is 0


PLCO_ID is A-008288-4

Trt_numc is 104

Trt_familyc is 1

Trt_days is 331

Neoadjuvant is 0


Etc. etc.

However, I have been getting an error. I believe my loop is correct as I need to use an implicit cursor for this particular problem. I think I may have to use rpad() in my print to have it print out correctly but I'm not sure. The code is attached below. Thanks in advance for the help!

The XML code is this

enter image description here

enter image description here

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

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

发布评论

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

评论(1

ぃ弥猫深巷。 2025-01-28 23:31:26
begin
    for x in (select j.onepatient.extract('//PLCO_ID/text()').getstringval() as PLCO_ID, 
    j.onepatient.extract('//trt_numc/text()').getstringval()as Trt_numc, j.onepatient.extract('//trt_familyc/text()').getstringval() as Trt_familyc, 
    j.onepatient.extract('//trt_days/text()').getstringval() as Trt_days,j.onepatient.extract('//neoadjuvannt/text()').getstringval() as Neoadjuvant 
    from treatment_xml j)
    loop
        dbms_output.put_line('PLCO_ID        is: '||x.PLCO_ID ||chr(10) ||'Trt_numc       is: '||x.Trt_numc ||chr(10) ||
        'Trt_familyc    is: ' || x.Trt_familyc || chr(10) || 'Trt_days       is: ' || x.Trt_days|| chr(10)||
        'Neoadjuvant    is: ' || x.Neoadjuvant || chr(10));
    end  loop;
end;/
begin
    for x in (select j.onepatient.extract('//PLCO_ID/text()').getstringval() as PLCO_ID, 
    j.onepatient.extract('//trt_numc/text()').getstringval()as Trt_numc, j.onepatient.extract('//trt_familyc/text()').getstringval() as Trt_familyc, 
    j.onepatient.extract('//trt_days/text()').getstringval() as Trt_days,j.onepatient.extract('//neoadjuvannt/text()').getstringval() as Neoadjuvant 
    from treatment_xml j)
    loop
        dbms_output.put_line('PLCO_ID        is: '||x.PLCO_ID ||chr(10) ||'Trt_numc       is: '||x.Trt_numc ||chr(10) ||
        'Trt_familyc    is: ' || x.Trt_familyc || chr(10) || 'Trt_days       is: ' || x.Trt_days|| chr(10)||
        'Neoadjuvant    is: ' || x.Neoadjuvant || chr(10));
    end  loop;
end;/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文