CREATE OR REPLACE TYPE jgeocoord
AS OBJECT
EXTERNAL NAME 'GeoCoordJ'
LANGUAGE JAVA
USING SQLData
( latitude number external name 'latitude',
  longitude number external name 'longitude',
  MEMBER FUNCTION distance (other IN jgeocoord)
    RETURN NUMBER EXTERNAL
    NAME 'distance (GeoCoordJ) return double');
/
CREATE TABLE jcoordtable OF jgeocoord;
INSERT INTO jcoordtable VALUES (jgeocoord(50,0));
INSERT INTO jcoordtable VALUES (jgeocoord(-34,151));

SELECT x.distance(jgeocoord(51.5,0))
FROM jcoordtable x;
