Posted By

avj on 06/20/11


Tagged

xml plslq


Versions (?)

working with XML (find out if element or attribute exists)


 / Published in: PL/SQL
 

  1. CREATE TABLE xtest01(col1 xmltype);
  2. INSERT INTO xtest01 VALUES ('<car><model>Audi TT</model></car>');
  3. INSERT INTO xtest01 VALUES ('<car model="BMW X5"/>');
  4. SELECT x.col1.EXTRACT('//car/model/text()').getstringval() FROM xtest01 x;
  5. SELECT x.col1.EXTRACT('//car/@model').getstringval() FROM xtest01 x;
  6. SELECT * FROM xtest01 x WHERE x.col1.EXISTSNODE('//car') = 1;

Report this snippet  

You need to login to post a comment.