MySQL.CURSOR
DELIMITER
//
mysql> CREATE PROCEDURE processorders()
-> BEGIN
-> -- Declare the cursor
-> DECLARE ordernumbers
CURSOR
-> FOR
-> SELECT order_num
FROM orders;
->
-> -- Open the cursor
-> OPEN ordernumbers;
->
-> -- Close the cursor
-> CLOSE ordernumbers;
-> END//
Query OK, 0 rows affected (
0.00 sec)
mysql> DELIMITER ;
mysql> CALL processorders();
Query OK, 0 rows affected (
0.01 sec)
MySQL.CURSOR
标签: