title: Use Cursor variable to insert with a loop in a store procedure
body: <p>I have a store procedure and I need to take all id´s from a table and insert new rows in other table with those id´s but i dont´t understand well the function cursor</p>
  
  <pre><code>PROCEDURE INSERTMDCGENERAL AS
  
   idCat NUMERIC;
   CURSOR cur IS
      SELECT ID_CAT_FILTROS_TALENTO into idCat FROM MDC_CAT_FILTROS_TALENTO;
  
    BEGIN 
  
      FOR v_reg IN cur LOOP
        INSERT INTO MDC_FILTROS_TALENTO(ID_FILTRO,ID_CAT_FILTROS_TALENTO)
                 VALUES(SEC_MDC_FILTROS_TALENTO.NextVal,idCat);    
      END LOOP;
  
  COMMIT;
  
  END INSERTMDCGENERAL;
  </code></pre>