No cache version.

Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

13.6.6 Cursors

MySQL supports cursors inside stored programs. The syntax is as in embedded SQL. Cursors have these properties:

  • Asensitive: The server may or may not make a copy of its result table

  • Read only: Not updatable

  • Nonscrollable: Can be traversed only in one direction and cannot skip rows

Cursor declarations must appear before handler declarations and after variable and condition declarations.

Example:

  1. CREATE PROCEDURE curdemo()
  2.   DECLARE a CHAR(16);
  3.   DECLARE b, c INT;
  4.   DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1;
  5.   DECLARE cur2 CURSOR FOR SELECT i FROM test.t2;
  6.   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
  7.  
  8.   OPEN cur1;
  9.   OPEN cur2;
  10.  
  11.   read_loop: LOOP
  12.     FETCH cur1 INTO a, b;
  13.     FETCH cur2 INTO c;
  14.     IF done THEN
  15.       LEAVE read_loop;
  16.     END IF;
  17.     IF b < c THEN
  18.       INSERT INTO test.t3 VALUES (a,b);
  19.     ELSE
  20.       INSERT INTO test.t3 VALUES (a,c);
  21.     END IF;
  22.   END LOOP;
  23.  
  24.   CLOSE cur1;
  25.   CLOSE cur2;

Find a PHP function
Error Infobrol

Can not display this page of the Infobrol website

Type of error (18-01)

Unknown format specifier "&"

Please try again in a few minutes…

Return to the home page




Steph