Thanks for the question, Carissa.
Asked: October 26, 2016 - 9:33 pm UTC
Last updated: November 06, 2016 - 1:05 am UTC
Version: 9
Viewed 1000+ times
You Asked
Im so thrilled to have come across your site! I need a pair of eyes to spot the issue. Im fairly new to Oracle databases. The following error appears in log files and I cant understand what is missing.
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT t.X AS LON,t.Y AS LAT FROM TABLE(SDO_UTIL.GETVERTICES(SDO_CS.TRANSFORM(SDO_GEOMETRY(2001,40977, SDO_POINT_TYPE(,,NULL),NULL,NULL),8307))) t]; nested exception is java.sql.SQLException: ORA-00936: missing expression
It refers to this SQL select statement that is used in an Eform to obtain XY coordinates and pull them back onto their respective fields on the eform.
SELECT t.X AS LON,t.Y AS LAT FROM TABLE(SDO_UTIL.GETVERTICES(SDO_CS.TRANSFORM(SDO_GEOMETRY(2001,40977, SDO_POINT_TYPE([xcoord],[ycoord],NULL),NULL,NULL),8307))) t
and Connor said...
Somehow those 'x' and 'y' values are not making it all the way through to your SQL. For example
SQL> SELECT t.X AS LON,t.Y AS LAT FROM TABLE(SDO_UTIL.GETVERTICES(SDO_CS.TRANSFORM(SDO_GEOMETRY(2001,40977, SDO_POINT_TYPE(,,NULL),NULL,NULL),8307))) t;
SELECT t.X AS LON,t.Y AS LAT FROM TABLE(SDO_UTIL.GETVERTICES(SDO_CS.TRANSFORM(SDO_GEOMETRY(2001,40977, SDO_POINT_TYPE(,,NULL),NULL,NULL),8307))) t
*
ERROR at line 1:
ORA-00936: missing expression
If they are provided, then it works as expected
SQL>
SQL> SELECT t.X AS LON,t.Y AS LAT FROM TABLE(SDO_UTIL.GETVERTICES(SDO_CS.TRANSFORM(SDO_GEOMETRY(2001,40977, SDO_POINT_TYPE(1,1,NULL),NULL,NULL),8307))) t;
LON LAT
---------- ----------
-141.21875 30.0099029
Rating
(1 rating)
Is this answer out of date? If it is, please let us know via a Comment