Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Type of data XML to Table

AlibuneMay 30 2018 — edited Jun 4 2018

Hi everyone!

I've having some trouble with XML again,

I followed these steps:

Selecting multiple XML data

INSERT INTO PPAINICIALESTIMATIVARECEITA (INTCODIGO,DECVALORANO1,DECVALORANO2,DECVALORANO3,DECVALORANO4)

with t (xmlcnts) as (

select xml from XML_TAB)

select x.* from t, xmltable( xmlnamespaces ('http://www.tce.sp.gov.br/audesp/xml/auxiliar' AS "aux",  

                          'http://www.tce.sp.gov.br/audesp/xml/generico' AS "gen",

                          'http://www.w3.org/2001/XMLSchema-instance' AS "xsi",

                          DEFAULT 'http://www.tce.sp.gov.br/audesp/xml/planejamento'),

                          '/PPAInicial/PPAConteudo/EstimativaReceitasPPA'   PASSING t.xmlcnts  COLUMNS

           TIPODOC1 VARCHAR2 (50) PATH 'Receita/Codigo',

           v1 varchar2(50)  path 'ValorAno1',

           v2 varchar2(50)  path 'ValorAno2',

           v3 varchar2(50)  path 'ValorAno3',

           v4 varchar2(50)  path 'ValorAno4') x;

And it works, but the values i need to put in DECVALORANO columns it's a decimal number, but when i use decimal instead of varchar i get the error ORA-01722 invalid number.

The XML it's like below, how can i put the data in decimal format?

<EstimativaReceitasPPA>

     <Receita Tipo="DIRETA">

          <Codigo>17000000</Codigo>

     </Receita>

     <ReceitaDeducao>1</ReceitaDeducao>

     <ValorAno1>178941923.38</ValorAno1>

     <ValorAno2>187889019.50</ValorAno2>

     <ValorAno3>197283470.50</ValorAno3>

     <ValorAno4>207147644.00</ValorAno4>

</EstimativaReceitasPPA>

This post has been answered by odie_63 on May 31 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2018
Added on May 30 2018
8 comments
2,054 views