`

ORA-00939: 函数参数过多(转自51CTO)

阅读更多

当SDO_ORDINATES数组中插入一个超过1000个坐标的SDO_GEOMETRY时,可能引发该错误。举例来说,该错误可能由下面所示的SQL语句引发:

  1. SQL> INSERT INTO sales_regions VALUES 
  2. (  
  3. 1000,  
  4. SDO_GEOMETRY  
  5. (  
  6. 2004, - A multipoint geometry  
  7. 8307,  
  8. NULL,  
  9. SDO_ELEM_INFO_ARRAY(1, 1, 1100), -- this geometry has 1100 points  
  10. SDO_ORDINATE_ARRAY -- store the ordinates  
  11. (  
  12. 1,1, 1,1, 1,1, 1,1, 1,1 , -- repeat this line 99 times  
  13. ......  
  14. 1,1, 1,1, 1,1, 1,1, 1,1  
  15. )  
  16. )  
  17. );  
  18. ERROR at line 5:  
  19. ORA-00939: too many arguments for function 

补救措施:这是一个SQL级别的限制。可以通过创建一个保存该几何体的PL/SQL变量(在下面的代码中被称为geom)来避免这一错误,之后将该变量绑定到INSERT SQL语句中:

 

  1. SQL>  
  2. DECLARE 
  3. geom SDO_GEOMETRY; -- PL/SQL variable to store the geometry with >999 ordinates  
  4. BEGIN 
  5. -- construct the geometry here  
  6. geom :=  
  7. SDO_GEOMETRY  
  8. (  
  9. 2004, 8307, NULL,  
  10. SDO_ELEM_INFO_ARRAY(1, 1, 1100),  
  11. SDO_ORDINATE_ARRAY  
  12. (  
  13. 1,1, 1,1, 1,1, 1,1, 1,1 , -- repeat this line 99 times  
  14. --  
  15. 1,1, 1,1, 1,1, 1,1, 1,1  
  16. )  
  17. );  
  18.  
  19. -- store the geometry in the sales_regions table using dynamic SQL  
  20. EXECUTE IMMEDIATE  
  21. 'INSERT INTO sales_regions VALUES (1000, :gm )' USING geom;  
  22. END;  
  23. /  
  24. PL/SQL procedure successfully completed. 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics