Method Example II (Cont.)

SQL> select  value(x), x.inside(point_t(4, 2))  from  rects x; 

VALUE(X)(PT1(X, Y), PT2(X, Y))                 X.INSIDE(POINT_T(4,2))
------------------------------------------     ----------------------
RECTANGLE_T(POINT_T(1, 2), POINT_T(3, 4))            0
RECTANGLE_T(POINT_T(1, 1), POINT_T(6, 6))            1


SQL> select distinct  p.x, p.y  from  points p, rects r 
  2    where  r.inside(value(p)) > 0; 

         X          Y
---------- ----------
         1          4
         2          3
         4          4


SQL> select  value(p)  from  points p  where not exists ( 
  2    select * from  rects r  where  r.inside(value(p)) = 0); 

VALUE(P)(X, Y)
---------------------------------
POINT_T(2, 3)
POINT_T(1, 4)


SQL> update  rects r  set  pt2 = point_t(r.pt2.x+1, r.pt2.y+1) 
  2    where  r.area( ) < 24; 

1 row updated.


SQL> select  *  from  rects; 

PT1(X, Y)                 PT2(X, Y)
----------------------    ----------------------
POINT_T(1, 2)             POINT_T(4, 5)
POINT_T(1, 1)             POINT_T(6, 6)




      Why are green beans the most Zen of all vegetables?    
      Because they’ve found their inner peas.