当SDO_ORDINATES数组中插入一个超过1000个坐标的SDO_GEOMETRY时,可能引发该错误。举例来说,该错误可能由下面所示的SQL语句引发:
- SQL> INSERT INTO sales_regions VALUES
- (
- 1000,
- SDO_GEOMETRY
- (
- 2004, - A multipoint geometry
- 8307,
- NULL,
- SDO_ELEM_INFO_ARRAY(1, 1, 1100), -- this geometry has 1100 points
- SDO_ORDINATE_ARRAY -- store the ordinates
- (
- 1,1, 1,1, 1,1, 1,1, 1,1 , -- repeat this line 99 times
- ......
- 1,1, 1,1, 1,1, 1,1, 1,1
- )
- )
- );
- ERROR at line 5:
- ORA-00939: too many arguments for function
补救措施:这是一个SQL级别的限制。可以通过创建一个保存该几何体的PL/SQL变量(在下面的代码中被称为geom)来避免这一错误,之后将该变量绑定到INSERT SQL语句中:
- SQL>
- DECLARE
- geom SDO_GEOMETRY; -- PL/SQL variable to store the geometry with >999 ordinates
- BEGIN
- -- construct the geometry here
- geom :=
- SDO_GEOMETRY
- (
- 2004, 8307, NULL,
- SDO_ELEM_INFO_ARRAY(1, 1, 1100),
- SDO_ORDINATE_ARRAY
- (
- 1,1, 1,1, 1,1, 1,1, 1,1 , -- repeat this line 99 times
- --
- 1,1, 1,1, 1,1, 1,1, 1,1
- )
- );
- -- store the geometry in the sales_regions table using dynamic SQL
- EXECUTE IMMEDIATE
- 'INSERT INTO sales_regions VALUES (1000, :gm )' USING geom;
- END;
- /
- PL/SQL procedure successfully completed.