All pastes #794682 Raw Edit

Unnamed

public text v1 · immutable
#794682 ·published 2007-11-23 10:34 UTC
rendered paste body
with t (educationeventid, xml_part, iter) as (
       select
               cast(educationeventid as varchar(255)) ,
               substr(substr(xml,641),
                       locate('<educationEventRef id="',
substr(rtrim(xml),641))), 1
       from hubble.educationevent
       where
       locate('<educationEventRef id="', substr(xml,641)) > 0
       union all
       select t.educationeventid,
           rtrim(substr(xml_part,
               locate('<educationEventRef id="', xml_part)+1)),
           iter+1
       from t
       where locate('<educationEventRef id="', xml_part) > 0
         and iter < 20
), tuples (t1, t2) as (
       select educationeventid,
               rtrim(substr(xml_part, locate('"', xml_part)+1,
               locate('"/>', xml_part) - (locate('"', xml_part)+1)))

       from t where iter > 1
)