Oracle Using SDO AGGR UNION

From WickyWiki
Revision as of 08:26, 11 January 2012 by Wilbert (talk | contribs) (Created page with "Example using SDO_AGGR_UNION and SDOAGGRTYPE, the sourcetable kaartblad contains the final result of dividing an area in squares and subsquares. Each resulting subsquare has a sq...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example using SDO_AGGR_UNION and SDOAGGRTYPE, the sourcetable kaartblad contains the final result of dividing an area in squares and subsquares. Each resulting subsquare has a squareNr and a subsquareNr. The following query joins union of all subsquares of each squareNr

DROP TABLE Test;
CREATE TABLE Test (  Shape MDSYS.SDO_Geometry, INFORM VARCHAR2(400)  );

insert into test(shape, INFORM)
  select SDO_AGGR_UNION(SDOAGGRTYPE(t.shape, 0.00000005)), TRIM(TO_CHAR(Substr(t.bladnr,1,2),'00'))
    from kaartblad t
    group by squareNr
    order by squareNr;