'SDO_UTIL.TO_WKTGEOMETRY(GEOMETRY) Value Not Allowed Error
i have an object table and SRID 2000273
i execute the following query to get the wkt string of the geometry in the table
SELECT SDO_UTIL.TO_WKTGEOMETRY(GEOMETRY) FROM myTABLE
i get following errors;
ORA-24323: value not allowed
ORA-06512: location "MDSYS.MDPRVT_SRID",line 143
ORA-06512: location "MDSYS.SDO_UTIL", line 320
i insert mdsys.cs_srs table about my table's srid record
insert into MDSYS.cs_srs values ('TM 27 3 DERECE',2000273,2000273,'Oracle','PROJCS["TM 27 3 DERECE",GEOGCS["OpenGIS.European_Datum_1950",DATUM["OpenGIS.European_Datum_1950",SPHEROID["International 1924",6378388.000000,297.000000]],PRIMEM["Greenwich",0.000000],UNIT["Decimal Degree",0.01745329251994330]],PROJECTION["Transverse Mercator"],PARAMETER["Scale_Factor",1.000000],PARAMETER["Central_Meridian",27.000000],PARAMETER["False_Easting",500000.000000],PARAMETER["False_Northing",0],PARAMETER["Latitude_of_Origin",0],UNIT["Meter",1.000000000000]]',NULL);
What is the reason for this error? Where else should I check?
Solution 1:[1]
Your insert actually fails. The CS_SRS table (it is actually a view) has more columns than the ones you provide, and therefore, your insert fails as written:
SQL> insert into MDSYS.cs_srs values ('TM 27 3 DERECE',2000273,2000273,'Oracle','PROJCS["TM 27 3 DERECE",GEOGCS["OpenGIS.European_Datum_1950",DATUM["OpenGIS.European_Datum_1950",SPHEROID["International 1924",6378388.000000,297.000000]],PRIMEM["Greenwich",0.000000],UNIT["Decimal Degree",0.01745329251994330]],PROJECTION["Transverse Mercator"],PARAMETER["Scale_Factor",1.000000],PARAMETER["Central_Meridian",27.000000],PARAMETER["False_Easting",500000.000000],PARAMETER["False_Northing",0],PARAMETER["Latitude_of_Origin",0],UNIT["Meter",1.000000000000]]',NULL);
insert into MDSYS.cs_srs values ('TM 27 3 DERECE',2000273,2000273,'Oracle','PROJCS["TM 27 3 DERECE",GEOGCS["OpenGIS.European_Datum_1950",DATUM["OpenGIS.European_Datum_1950",SPHEROID["International 1924",6378388.000000,297.000000]],PRIMEM["Greenwich",0.000000],UNIT["Decimal Degree",0.01745329251994330]],PROJECTION["Transverse Mercator"],PARAMETER["Scale_Factor",1.000000],PARAMETER["Central_Meridian",27.000000],PARAMETER["False_Easting",500000.000000],PARAMETER["False_Northing",0],PARAMETER["Latitude_of_Origin",0],UNIT["Meter",1.000000000000]]',NULL)
*
ERROR at line 1:
ORA-00947: not enough values
Let's correct this by using an explicit column list. This is always safer, because the actual ordering of the columns is actually uncertain ...
Notice this insert is only possible when connected as a privileged user. So, let's connect as SYSTEM and do the update:
SQL> connect system/******@localdb
Connected.
SQL> insert into cs_srs (cs_name,srid,auth_srid,auth_name,wktext)
2 values (
3 'TM 27 3 DERECE',
4 2000273,
5 2000273,
6 'Oracle',
'PROJCS["TM 27 3 DERECE",GEOGCS["OpenGIS.European_Datum_1950",DATUM["OpenGIS.European_Datum_1950",SPHEROID["International 1924",6378388.000000,297.000000]],PRIMEM["Greenwich",0.000000],UNIT["Decimal Degree",0.01745329251994330]],PROJECTION["Transverse Mercator"],PARAMETER["Scale_Factor",1.000000],PARAMETER["Central_Meridian",27.000000],PARAMETER["False_Easting",500000.000000],PARAMETER["False_Northing",0],PARAMETER["Latitude_of_Origin",0],UNIT["Meter",1.000000000000]]'
8 );
1 row created.
SQL> commit;
Commit complete.
Now the conversion to WKT will work:
SQL> select SDO_UTIL.TO_WKTGEOMETRY(sdo_geometry(2001,2000273,sdo_point_type(449319,4445908,null),null,null)) from dual;
SDO_UTIL.TO_WKTGEOMETRY(SDO_GEOMETRY(2001,2000273,SDO_POINT_TYPE(449319,4445908
-------------------------------------------------------------------------------
POINT (449319.0 4445908.0)
1 row selected.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Albert Godfrind |
