I am trying to create a new table using a cursor and a select statements.
Declare
Cursor c1 is
select store_number from table1 where CLIENT_ID= 1 and ORG_ID = 1 ;
Type C1_TAB_TYPE is table of c1%ROWTYPE;
c1_list c1_TAB_TYPE;
Begin
For r1 in c1
Loop
select store_number
BULK COLLECT INTO c1_list from
(
SELECT store_number,
( (SDO_GEOM.SDO_AREA(SDO_GEOM.SDO_INTERSECTION(a.geometry,b.geometry, 0.005), 0.005, 'unit=sq_mile') /SDO_GEOM.SDO_AREA((a.geometry), 0.005, 'unit=sq_mile'))*100) Total_area
FROM table2 a, table1 b
Where store_number != r1.store_number
AND sdo_relate(a.geometry, b.geometry, 'mask=anyinteract') = 'TRUE');
For i in 1..c1_list.count loop
insert into temp_Prop_area
(STORE_NUMBER,TOTAL_AREA)
values (r1.store_number,Total_Area);
End Loop;
End Loop;
End;
Here I am using a store number to pass into a cursor.Now once have a store number ,I check want to get the area of overlapping between polygon for each store and the small polygons from table 1 over which the stores overlay. That area is called as Total_area. I am trying to pass this store number and total area in to the temp_Prop_area table.
But I wont be able to do since in my cursor type I just have store_number . So what could I be doing to fix this.
Thank You.