0

I am trying to print the output for the below sql block when it says c1_list is not a cursor. Could anyone tell me what I could be missing.

  Declare
  Cursor c1 is 
  select store_id ,geometry from TMCS.TMCS_All_Stores_TA  where CLIENT_ID= 1 and rownum <1;

  Type C1_TAB_TYPE is table of c1%ROWTYPE;      
  c1_list c1_TAB_TYPE;

    --   DBMS_OUTPUT.PUT_LINE('2012 Population--> '||c1_list(1).store_id); 

  Begin     
            For r1 in c1 
               Loop

               select  store_id ,geometry 
                BULK COLLECT INTO c1_list from
               (
                  select 
                  store_id, store_number ,geometry 
                  from TMCS.TMCS_ALL_STORES_TA
                  where client_id=1
                  and   SDO_RELATE(Geometry, r1.geometry,'mask=anyinteract') = 'TRUE'
                  and store_id != r1.store_id
               );


                     For r1 in c1_list
                     Loop
                     DBMS_OUTPUT.PUT_LINE('2012 Population--> '||r1.store_id);  
                      End Loop;
            End Loop;

  End;
1
  • Do you have set serveroutput on as first statement? If this is not you are looking for Could you please explain your question in detail? Commented Dec 4, 2013 at 18:11

1 Answer 1

2

c1_list is not a cursor, it is a variable. You can do it like this:

For i in c1_list.First..c1_list.Last loop
   DBMS_OUTPUT.PUT_LINE('2012 Population--> '||c1_list(i).store_id); 
end loop;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.