title: Declaring a cursor after begin in oracle forms 10g
body: <p>I am writing the following code block :</p>
  
  <pre><code>select companyid into compid from person where signedin = 1;
  cursor getpending is select serviceid from servnego where companyid = compid and confirmed = 0;
  open getpending;
  loop
      exit when getpending%notfound;
      fetch getpending into servid;
      select servname into s from service where id = servid;
      add_list_element('homeadmin1.listpendingservice', counter2,s,s);
      counter2 := counter2 + 1;
  end loop;
  </code></pre>
  
  <p>This is a part of the code that is inside the begin/end. The cursor getpending depends on the value of the variable compid from the select statement right before it. When compiling I get an error on the cursor line : "Encountered the symbol getpending when expecting one of the following : ...", so there is an error on the declaration of the cursor in the begin part. How can I solve the issue? Any help will be appreciated.</p>