SELECT EXTRACTVALUE(COLUMN_VALUE, '//[local-name()=''ParamCd'']') ,…
- User
SELECT EXTRACTVALUE(COLUMN_VALUE, '//[local-name()=''ParamCd'']') , EXTRACTVALUE(COLUMN_VALUE, '//[local-name()=''ParamVal'']') INTO V_PAR_NAME, V_PAR_VALUE FROM TABLE(XMLSEQUENCE(XMLTYPE(P_BODY_PARAMETERS) .EXTRACT('//[local-name()=''ParamItem'']'))) PARAMETERSS WHERE EXTRACTVALUE(COLUMN_VALUE, '//[local-name()=''ParamCd'']') = EVENT_PAR.EP_PARAM_NO can you illustrate it to me ?
- Assistant
This SQL query is used to extract specific values from an XML document and store them in variables. Here is an illustration of how it works:
-
The query starts by selecting the two values that will be extracted from the XML document: ParamCd and ParamVal. These values will be stored in the variables V_PAR_NAME and V_PAR_VALUE, respectively.
-
The XML document that will be processed is provided in the P_BODY_PARAMETERS variable.
-
The XML document is converted to an XMLType using the XMLTYPE function.
-
The XML document is then filtered using the EXTRACT function with the XPath expression '//[local-name()='ParamItem']'. This expression extracts all the ParamItem nodes from the XML document.
-
The XMLSEQUENCE function is used to convert the extracted ParamItem nodes into a sequence of XMLType values.
-