Oracle 18c:

I can extract the startpoint X coordinate from an SDO\_GEOMETRY using `SHAPE.SDO_ORDINATES(1)` in a custom PL/SQL function:

```
with 
function startpoint_x(shape in sdo_geometry) return number 
is
begin
  return 
  shape.sdo_ordinates(1); 
end;

select
  startpoint_x(shape) as startpoint_x
from
  (select sdo_geometry('linestring(1 2, 3 4, 5 6)') as shape 
   from dual)

STARTPOINT_X
------------
           1

```

But if I try do that purely in an SQL query, I get an error:

```
select
  (shape).sdo_ordinates(1) as startpoint_x
from
  (select sdo_geometry('linestring(1 2, 3 4, 5 6)') as shape 
   from dual)

ORA-00904: "MDSYS"."SDO_GEOMETRY"."SDO_ORDINATES": invalid identifier

```

For what it's worth, if I were to remove the (1) and instead select the entire `sdo_ordinates` attribute, then that would work:

```
select
  (shape).sdo_ordinates as ordinates 
from
  (select sdo_geometry('linestring(1 2, 3 4, 5 6)') as shape 
   from dual)

ORDINATES
------------------------
SDO_ORDINATE_ARRAY(1, 2)

```

[db<>fiddle](https://dbfiddle.uk/?rdbms=oracle_18&fiddle=38d5b18e84128afb886810bdbec7a982)

But of course, that's not what I want. I want to get the startpoint X coordinate as a number.

Why does `SHAPE.SDO_ORDINATES(1)` work in PL/SQL, but not in an SQL query?

---

Somewhat related: [Get X & Y coordinates from GEOM\_SEGMENT\_START\_PT()](https://community.oracle.com/tech/apps-infra/discussion/4499536/get-x-y-coordinates-from-geom-segment-start-pt#latest)