Is This Content Helpful?
We're glad to know this article was helpful.
When constructing a Well-Known Text (WKT) representation of a geometry in a SQL statement, the following Oracle error may display:
SELECT SDE.ST_ASTEXT(SDE.ST_GEOMETRY(point ('
|| x || ' ' || y
|| ' ) '',' || srid
|| ')) from DUAL';
ORA-20004: Error generating shape from text: Shape has too many parts (-5).
ORA-06512: at line 54
The following pieces of SQL syntax show a common way for constructing WKT strings. WKT is constructed by concatenating literal text strings and numeric variables casted to text either implicitly (in the first example) or explicitly (in the second example).
'point ( ' || x || ' ' || y || ' )'
'point ( ' || to_char(x) || ' ' || to_char(y) || ' )'
It is possible to force the decimal point to be a period by using the optional parameters of Oracle’s TO_CHAR function. For complete information on the options available in the TO_CHAR function, refer to Oracle's documentation. Here is an example:
'point ( ' || TO_CHAR(x,'99999D99', NLS_NUMERIC_CHARACTERS = ".,") ||
' ' || TO_CHAR(y,'99999D99', NLS_NUMERIC_CHARACTERS = ".,") || ' )'