6
create table xtest01(col1 xmltype);
insert into xtest01 values ('<car><model>Audi TT</model></car>');
insert into xtest01 values ('<car model="BMW X5"/>');

-- I know how to get Audi TT:

select x.col1.extract('//car/model/text()').getStringVal() from xtest01 x;

-- But how to get BMW X5?

1 Answer 1

9
select x.col1.extract('//car/@model').getStringVal() from xtest01 x;
Sign up to request clarification or add additional context in comments.

1 Comment

thanks! (this is the answer; I can accept it after some minutes, as pop-up says to me)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.