Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

x and y coords from point type in sql?

523861Sep 26 2011 — edited Mar 23 2012
Hi all,

sorry for a potentially newbie spatial question.

Is there any reason why we can't select the x and y coords from a point type within SQL but rather have to use pl/sql if we want to split the geometry object out?
SQL> create table geom_foo (locn sdo_geometry);

Table created.

SQL>
SQL> insert INTO GEOM_FOO values (SDO_GEOMETRY(
  2                      2001,
  3                      8307,
  4                      SDO_POINT_TYPE(-180, -90, NULL),
  5                      NULL,
  6                      NULL));

1 row created.

SQL>
SQL> commit;

Commit complete.

SQL>
SQL> select locn.sdo_point.x
  2    from geom_foo;
select locn.sdo_point.x
       *
ERROR at line 1:
ORA-00904: "LOCN"."SDO_POINT"."X": invalid identifier


SQL>
SQL> declare
  2     v_locn sdo_geometry;
  3  begin
  4
  5     select locn
  6       into v_locn
  7       from geom_foo;
  8
  9     dbms_output.put_line(v_locn.sdo_point.x);
 10
 11  end;
 12     /
-180

PL/SQL procedure successfully completed.
This post has been answered by Barbara Boehmer on Sep 26 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2012
Added on Sep 26 2011
4 comments
4,563 views