有两个表的游标

时间:2013-11-19 17:13:14

标签: oracle11g cursor

我正在尝试使用游标用select语句选择所有值。现在,一旦我根据此select语句中的商店编号执行此操作,我想选择所有相互重叠/互动的功能(SDO_RELATE

以下是SQL块。

Declare 
  BG_TOTAL number;
 l_area number  ;
 STORE_NUMBER number;
 cursor c1 is 
    select *
     from table 1
      where CLIENT_ID= 1 and status is null and rownum < 2 ;

  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;

    For i in 1..SITE_LIST.count loop

    Select
   a.store_number,a.client_id,a.geometry
    from table 2 a, SITE_LIST b
    where SITE_LIST(i).STORE_NUMBER
    AND SDO_Relate(a.geometry,b.geometry,'mask=anyinteract') = 'TRUE';

0 个答案:

没有答案