Jaime Vasquez Milla
Jaime Vasquez Milla

Reputation: 17

How to check the SRID of my table - ORACLE

I have tables, but I need to know what SRID has. I tried to search the web, but I can't find how. I am starting with Oracle. Thank you

Upvotes: 0

Views: 5415

Answers (2)

GregStef
GregStef

Reputation: 441

The answer from Littlefoot is correct, but it will show you the SRID of only one row. There is no guarantee that all rows have the same SRID (this is something you must enforce).
So, I would drop the "where rownum = 1" clause and would use group by:

select s.geom.sdo_srid, count(*)  
from objekt_stup s  
group by s.geom.sdo_srid ;  

Upvotes: 0

Littlefoot
Littlefoot

Reputation: 142705

If that table has a column whose datatype is SDO_GEOMETRY:

SQL> desc objekt_stup
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID_STUP                                   NOT NULL NUMBER
 GEOM                                               PUBLIC.SDO_GEOMETRY   --> that's the column!
 <snip> 

Then:

SQL> select s.geom.sdo_srid
  2  from objekt_stup s
  3  where rownum = 1;

GEOM.SDO_SRID
-------------
         8307

SQL>

Pay attention to table's alias; it won't work without it:

SQL> select geom.sdo_srid
  2  from objekt_stup
  3  where rownum = 1;
 select geom.sdo_srid
        *
ERROR at line 1:
ORA-00904: "GEOM"."SDO_SRID": invalid identifier


SQL>

Upvotes: 2

Related Questions