XML Parsing in Postgresql - Mailing list pgsql-sql

From Abdul Hameedk
Subject XML Parsing in Postgresql
Date
Msg-id KL1PR04MB0999C40AC345478A1406D87FD80E0@KL1PR04MB0999.apcprd04.prod.outlook.com
Whole thread Raw
Responses Re: XML Parsing in Postgresql  (Lutz Horn <lutz.horn@posteo.de>)
Re: XML Parsing in Postgresql  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-sql

I have below xml content. In oracle we are having cursor to extract the xml in row format. Do we have same like in POSGRES.

<TABLES>

                <SEC_CALDAY> --Table name

                                <ROW> --3 rows formed with ROW tag

                                                <SEC_DID>123</SEC_DID>

                                                <SOURCE>TEXT</SOURCE>

                                                <DAYS>31</DAYS>

                                                <OCCR>24</OCCR>

                                                <SEC_POLICYDETAILSID>45678</SEC_POLICYDETAILSID>

                                </ROW>

                                <ROW>

                                                <SEC_DID>456</SEC_DID>

                                                <SOURCE>TEXT</SOURCE>

                                                <DAYS>31</DAYS>

                                                <OCCR>24</OCCR>

                                                <SEC_POLICYDETAILSID>45679</SEC_POLICYDETAILSID>

                                </ROW>

                                <ROW>

                                                <SEC_DID>789</SEC_DID>

                                                <SOURCE>TEXT</SOURCE>

                                                <DAYS>31</DAYS>

                                                <OCCR>24</OCCR>

                                                <SEC_POLICYDETAILSID>45680</SEC_POLICYDETAILSID>

                                </ROW>

                </SEC_CALDAY>

</TABLES>

 

Oracle cursor to parse and textract the xml in row format.

 

CURSOR C_XMLSEC_CALDAY (B_XMLDOC11 IN XMLTYPE)

IS

SELECT  EXTRACTVALUE (VALUE (T), '/ROW/SEC_DID')  SEC_DID

,   EXTRACTVALUE (VALUE (T), '/ROW/SOURCE')  SOURCE

,  EXTRACTVALUE (VALUE (T), '/ROW/DAYS') DAYS

,  EXTRACTVALUE (VALUE (T), '/ROW/OCCR') OCCR

,  EXTRACTVALUE (VALUE (T), '/ROW/SEC_POLICYDETAILSID') SEC_POLICYDETAILSID

FROM TABLE (XMLSEQUENCE (EXTRACT (B_XMLDOC11, '//ROW'))) T;

 

Please let me know the corresponding parsing query in Postgresql.

 

::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ---------------------------------------------------------------------------------------------------------------------------------------------------- ::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ----------------------------------------------------------------------------------------------------------------------------------------------------

pgsql-sql by date:

Previous
From: Андрей Жиденков
Date:
Subject: Re: FILTER clause for non-aggregate window functions
Next
From: Lutz Horn
Date:
Subject: Re: XML Parsing in Postgresql