我正在尝试使用带有 where 子句的游标。它与我假设的简单光标应该没有太大不同。我在我的情况下尝试了以下但似乎没有打印任何输出。
Declare
BG_TOTAL number;
SDO_GEOM varchar2 ;
cursor c1 is
select
SDO_GEOM.SDO_AREA(GEOMETRY, 0.005,'unit = SQ_MILE')
from <tablename>
where SITE_ID= 8;
Type SITE_TAB_TYPE is table of c1%ROWTYPE;
SITE_LIST SITE_TAB_TYPE;
Begin
open c1;
FETCH c1 BULK COLLECT INTO SITE_LIST;
close c1;
DBMS_OUTPUT.PUT_LINE(SITE_LIST(1).SDO_GEOM);
Exception
When others then
DBMS_OUTPUT.PUT_LINE(sqlerrm);
End;
[Error] Execution (3: 11): ORA-06550: line 3, column 11:
PLS-00215: String length constraints must be in range (1 .. 32767)
ORA-06550: line 7, column 5:
PLS-00487: Invalid reference to variable 'SDO_GEOM'
ORA-06550: line 7, column 5:
PLS-00487: Invalid reference to variable 'SDO_GEOM'
ORA-06550: line 22, column 40:
PLS-00302: component 'SDO_GEOM' must be declared
ORA-06550: line 22, column 6:
PL/SQL: Statement ignored