Skip to content

techtrail

Attempt to organize my tech notes

  • Home

Month: December 2018

Oracle function to parse XML attribute value

Function

CREATE
OR REPLACE
FUNCTION getxmlattr(xml IN VARCHAR2,
xpath IN VARCHAR2) RETURN VARCHAR2 IS num NVARCHAR2(100);
BEGIN
SELECT
EXTRACTVALUE(SYS.XMLTYPE.CREATEXML(xml), xpath) INTO
num
FROM
dual;

RETURN num;
END getxmlattr;

Sample Query

SELECT getxmlattr(‘<author name=”John Smith”>’,’//author/@name’) AS NAME FROM DUAL;

Result

NAME
John Smith

prmsheriff Uncategorized Leave a comment December 4, 2018 1 Minute

Archives

  • December 2018 (1)
  • November 2018 (2)
  • September 2018 (14)

Top Posts & Pages

  • Oracle function to parse XML attribute value
  • Restrict WebSphere to TLSv1.2 (IBM MDM AE)
  • BouncyCastle PGP Encryption
  • WebSphere App Server
  • Windows - Export installed programs list
  • JAX-WS Client
  • FormatXSDCForContract.java
  • FormatXSD.java
  • FormatXSD.java
  • IdGen.java
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • techtrail
    • Already have a WordPress.com account? Log in now.
    • techtrail
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Design a site like this with WordPress.com
Get started