PL/SQL (MOSC)

MOSC Banner

Extract from XML string

edited Aug 11, 2023 10:20AM in PL/SQL (MOSC) 5 commentsAnswered ✓

Greetings all,

I am trying to extract value from an XML, I think I need to use Regex substr but unsure how.

I am trying to extract value between <inActiveFlg> so far I have this:

execute:

select substr('<latestBoStatus>ACTIVE</latestBoStatus><inActiveFlg>false</inActiveFlg><Min>80</Min><Max>105</Max>',instr('<latestBoStatus>ACTIVE</latestBoStatus><inActiveFlg>false</inActiveFlg><Min>80</Min><Max>105</Max>','<inActiveFlg>',1,1)+1)from dual;


returns:

false

but if change the query with a true value it returns:

true<

sometimes the tag <inActiveFlg >will not be present as well, how can I fix this query to only show false or true when tag is present?

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center