Hi,
I'm writing an oracle function to convert a ST_MULTILINESTRING to a ST_LINESTRING.
To reach that goal, the function would convert the input object to WKT format, then perform some modifications to resulting string and finally create the ST_LINESTRING:
CREATE OR REPLACE FUNCTION MFICA_LINHA (MULTILINHA IN SDE.ST_MULTILINESTRING) RETURN SDE.ST_LINESTRING IS LINHA SDE.ST_LINESTRING; BEGIN SELECT SDE.ST_LINEFROMTEXT(replace(replace(replace(replace(SDE.ST_ASTEXT(MULTILINHA),'((','('),'),(',','),'))',')'),'MULTILINESTRING','LINESTRING'), 0) INTO LINHA FROM DUAL; RETURN LINHA; END;
But it is getting the following error:
Error: PLS-00707: unsupported construct or internal error [2603]
Just to make sure that it youd work, I did:
SELECT SDE.ST_LINEFROMTEXT(LINE_TEXT, 0) LINE FROM ( SELECT replace(replace(replace(replace(MLINE_TEXT, '((','('),'),(',','),'))',')'),'MULTILINESTRING','LINESTRING') LINE_TEXT FROM ( SELECT SDE.ST_ASTEXT(MLINE) MLINE_TEXT FROM ( SELECT SDE.ST_MLINEFROMTEXT('MULTILINESTRING ((0 0, 1 1),(1 1, 2 2))', 0) MLINE FROM DUAL ) ) );
And I got a ST_SINGLELINE as expected.
In order to understand what would cause the creation funtion failure, I wrote a simpler version of the funciton:
CREATE OR REPLACE FUNCTION MFICA_LINHA (MULTILINHA IN SDE.ST_MULTILINESTRING) RETURN SDE.ST_LINESTRING IS LINHA SDE.ST_LINESTRING; BEGIN SELECT SDE.ST_LINEFROMTEXT('', 0) INTO LINHA FROM DUAL; RETURN LINHA; END;
Since it successful compiled, tryied:
CREATE OR REPLACE FUNCTION MFICA_LINHA (MULTILINHA IN SDE.ST_MULTILINESTRING) RETURN SDE.ST_LINESTRING IS LINHA SDE.ST_LINESTRING; BEGIN SELECT SDE.ST_LINEFROMTEXT(SDE.ST_ASTEXT(MULTILINHA), 0) INTO LINHA FROM DUAL; RETURN LINHA; END;
But I got the PLS-00707 error.
Why does my function creation fails, and why can't I use both ST_ASTEXT and ST_LINEFROMSTRING nestled?
Solved! Go to Solution.
The very same create function query which fails when using Oracle SQL Developer, works when I ran in SqlPlus.
So, it's a Oracle SQL Developler issue, 4.0.3.16 version.
The very same create function query which fails when using Oracle SQL Developer, works when I ran in SqlPlus.
So, it's a Oracle SQL Developler issue, 4.0.3.16 version.
In this Document
APPLIES TO:Oracle SQL Developer - Version 3.2 and laterInformation in this document applies to any platform. SYMPTOMSsql developer version: 3.2.20.09 Attempting to compile Function/Prucedure/Package in SQL Developer throws the following error: PLS-00707: unsupported construct or internal error [2603] This issue is not occuring in sqlplus. This issue occurs only for the 11g/11gr2 Database on SQL Developer. CAUSEIt seems to be caused by the parameter PL/SCOPE variable when it uses the value "IDENTIFIERS:ALL". More about PL/Scope can be found here: SOLUTION1. Go to Preferences in SQL Developer. |