【问题标题】:Convert XmlType into CLOB in Oracle Stored Procedure在 Oracle 存储过程中将 XmlType 转换为 CLOB
【发布时间】:2015-03-01 08:17:03
【问题描述】:

在我的过程中,我的变量 l_outxml 包含一个 XMLType 值。我想把它转换成 CLOB 类型。我怎样才能做到这一点?如果我更改变量的数据类型,则会引发错误:

PL/SQL:ORA-00932:不一致的数据类型:预期的 NUMBER 得到了 -

谁能帮我做这个?

CREATE OR REPLACE
PROCEDURE "test_Dinesh_page_1"
(
i_LRE_PeerGroup_ID IN out number
)
as
l_outxml xmltype := NULL;

 BEGIN
    with xmldata as (
      select es.d_reportentity_id
      , es.d_reportperiod_id
      , es.avgoralhealthscore
      , es.ScorePercentile
      , es.CostPMPM
      , es.topClaimPercent
      , es.topClaimState
      , l.LKP_reportEntity_PeerGroup_id
      , l.d_PeerGroup_ID
      , rp.EndYear
      , rp.EndQuarter
         from   f_ReportEntityScore es
          join  LKP_ReportEntity_PeerGroup l
              on es.d_reportperiod_id = l.d_reportperiod_id
              and es.d_reportEntity_id = l.d_reportEntity_id
          join  d_reportPeriod rp
              on es.d_reportperiod_id = rp.d_reportperiod_id
          where l.LKP_reportEntity_PeerGroup_id = i_LRE_PeerGroup_ID      
    )
    select xmlelement("ReportPage"
      , xmlelement("PageNumber",1)
      , (select xmlforest(
          cast(round(x.avgoralhealthscore,0) as int) as "DentalScore"
          , x.ScorePercentile as "DentalREINPercentile"
        )
        from xmldata x
        where x.LKP_reportEntity_PeerGroup_id = i_LRE_PeerGroup_ID
      )
    )   
     into l_outxml
    from dual;
end;

【问题讨论】:

    标签: xml oracle clob


    【解决方案1】:

    使用xmlelement(...).getClobVal() 转换为CLOB。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-30
    • 2013-10-10
    • 1970-01-01
    • 2021-08-17
    • 1970-01-01
    • 2022-07-06
    • 1970-01-01
    • 2018-03-25
    相关资源
    最近更新 更多