Posted By

xaviles on 12/29/09


Tagged

mysql cursor MANEJO


Versions (?)

MANEJO CURSOR MYSQL


 / Published in: MySQL
 

Esquema basico manejo cursores en MYSQL

  1. DECLARE idone INT DEFAULT 0;
  2. /* Incluir aqui Todas las variables del cursor*/
  3.  
  4. DECLARE docs CURSOR FOR /* aƱadir aqui la sentencia SQL */ ;
  5.  
  6. DECLARE CONTINUE HANDLER FOR NOT FOUND SET idone = 1;
  7.  
  8. OPEN docs;
  9. REPEAT
  10. FETCH docs INTO /* asignacion valores cursor a variables */ ;
  11. IF NOT idone THEN
  12. /* INCLUIR AQUI TODO EL CODIGO PARA CADA REGISTRO DEL CURSOR */
  13. END IF;
  14. UNTIL idone END REPEAT;
  15. CLOSE docs;

Report this snippet  

You need to login to post a comment.