Create table
create table locations(
loc_name varchar2(200) not null,
loc_coordinates sdo_geometry
)
Table created.
insert into locations values ('Munich', apex_spatial.point(11.5174, 48.17571))
1 row(s) inserted.
insert into locations values ('Vienna', apex_spatial.point(16.3688, 48.20254))
1 row(s) inserted.
insert into locations values ('San Francisco', apex_spatial.point(-122.4194200, 37.7749300 ))
1 row(s) inserted.
insert into locations values ('London', apex_spatial.point( -0.15307, 51.54931))
1 row(s) inserted.
select
b.loc_name,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
)
from locations a, locations b
where a.loc_name='Munich'
LOC_NAME | SDO_GEOM.SDO_DISTANCE(A.LOC_COORDINATES,B.LOC_COORDINATES,1,'UNIT=KM') | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 |
---|
select loc_from, "London", "Munich", "San Francisco", "Vienna" from
(
select
a.loc_name as loc_from,
b.loc_name as loc_to,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
) dist
from locations a, locations b
)
pivot (sum(dist) for loc_to in (
'Munich' as "Munich",
'San Francisco' as "San Francisco",
'Vienna' as "Vienna",
'London' as "London"
)
)
order by 1
LOC_FROM | London | Munich | San Francisco | Vienna | London | 0 | 917.830786273456 | 8634.126955229 | 1241.42203199386 | Munich | 917.830786273456 | 0 | 9452.33377799365 | 360.664673043316 | San Francisco | 8634.126955229 | 9452.33377799365 | 0 | 9646.92272199942 | Vienna | 1241.42203199386 | 360.664673043316 | 9646.92272199942 | 0 |
---|
Create table
create table locations(
loc_name varchar2(200) not null,
loc_coordinates sdo_geometry
)
Table created.
insert into locations values ('Munich', apex_spatial.point(11.5174, 48.17571))
1 row(s) inserted.
insert into locations values ('Vienna', apex_spatial.point(16.3688, 48.20254))
1 row(s) inserted.
insert into locations values ('San Francisco', apex_spatial.point(-122.4194200, 37.7749300 ))
1 row(s) inserted.
insert into locations values ('London', apex_spatial.point( -0.15307, 51.54931))
1 row(s) inserted.
select
b.loc_name,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
)
from locations a, locations b
where a.loc_name='Munich'
LOC_NAME | SDO_GEOM.SDO_DISTANCE(A.LOC_COORDINATES,B.LOC_COORDINATES,1,'UNIT=KM') | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 |
---|
select loc_from, "London", "Munich", "San Francisco", "Vienna" from
(
select
a.loc_name as loc_from,
b.loc_name as loc_to,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
) dist
from locations a, locations b
)
pivot (sum(dist) for loc_to in (
'Munich' as "Munich",
'San Francisco' as "San Francisco",
'Vienna' as "Vienna",
'London' as "London"
)
)
order by 1
LOC_FROM | London | Munich | San Francisco | Vienna | London | 0 | 917.830786273456 | 8634.126955229 | 1241.42203199386 | Munich | 917.830786273456 | 0 | 9452.33377799365 | 360.664673043316 | San Francisco | 8634.126955229 | 9452.33377799365 | 0 | 9646.92272199942 | Vienna | 1241.42203199386 | 360.664673043316 | 9646.92272199942 | 0 |
---|
Create table
create table locations(
loc_name varchar2(200) not null,
loc_coordinates sdo_geometry
)
ORA-00955: name is already used by an existing objectMore Details: https://docs.oracle.com/error-help/db/ora-00955
insert into locations values ('Munich', apex_spatial.point(11.5174, 48.17571))
1 row(s) inserted.
insert into locations values ('Vienna', apex_spatial.point(16.3688, 48.20254))
1 row(s) inserted.
insert into locations values ('San Francisco', apex_spatial.point(-122.4194200, 37.7749300 ))
1 row(s) inserted.
insert into locations values ('London', apex_spatial.point( -0.15307, 51.54931))
1 row(s) inserted.
select
b.loc_name,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
)
from locations a, locations b
where a.loc_name='Munich'
LOC_NAME | SDO_GEOM.SDO_DISTANCE(A.LOC_COORDINATES,B.LOC_COORDINATES,1,'UNIT=KM') | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 |
---|
select loc_from, "London", "Munich", "San Francisco", "Vienna" from
(
select
a.loc_name as loc_from,
b.loc_name as loc_to,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
) dist
from locations a, locations b
)
pivot (sum(dist) for loc_to in (
'Munich' as "Munich",
'San Francisco' as "San Francisco",
'Vienna' as "Vienna",
'London' as "London"
)
)
order by 1
LOC_FROM | London | Munich | San Francisco | Vienna | London | 0 | 3671.323145093824 | 34536.507820916 | 4965.68812797544 | Munich | 3671.323145093824 | 0 | 37809.3351119746 | 1442.658692173264 | San Francisco | 34536.507820916 | 37809.3351119746 | 0 | 38587.69088799768 | Vienna | 4965.68812797544 | 1442.658692173264 | 38587.69088799768 | 0 |
---|
Create table
create table locations(
loc_name varchar2(200) not null,
loc_coordinates sdo_geometry
)
Table created.
insert into locations values ('Munich', apex_spatial.point(11.5174, 48.17571))
1 row(s) inserted.
insert into locations values ('Vienna', apex_spatial.point(16.3688, 48.20254))
1 row(s) inserted.
insert into locations values ('San Francisco', apex_spatial.point(-122.4194200, 37.7749300 ))
1 row(s) inserted.
insert into locations values ('London', apex_spatial.point( -0.15307, 51.54931))
1 row(s) inserted.
select
b.loc_name,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
)
from locations a, locations b
where a.loc_name='Munich'
LOC_NAME | SDO_GEOM.SDO_DISTANCE(A.LOC_COORDINATES,B.LOC_COORDINATES,1,'UNIT=KM') | Munich | 0 | Vienna | 360.664673043316 | San Francisco | 9452.33377799365 | London | 917.830786273456 |
---|
select loc_from, "London", "Munich", "San Francisco", "Vienna" from
(
select
a.loc_name as loc_from,
b.loc_name as loc_to,
sdo_geom.sdo_distance(
a.loc_coordinates,
b.loc_coordinates,
1,
'unit=km'
) dist
from locations a, locations b
)
pivot (sum(dist) for loc_to in (
'Munich' as "Munich",
'San Francisco' as "San Francisco",
'Vienna' as "Vienna",
'London' as "London"
)
)
order by 1
LOC_FROM | London | Munich | San Francisco | Vienna | London | 0 | 917.830786273456 | 8634.126955229 | 1241.42203199386 | Munich | 917.830786273456 | 0 | 9452.33377799365 | 360.664673043316 | San Francisco | 8634.126955229 | 9452.33377799365 | 0 | 9646.92272199942 | Vienna | 1241.42203199386 | 360.664673043316 | 9646.92272199942 | 0 |
---|