mysql过程游标
DELIMITER $$
DROP PROCEDURE IF EXISTS `heli`.`prodtest` $$
CREATE PROCEDURE `heli`.`prodtest` ()
BEGIN
/*局部变量的定义 declare*/
declare pid varchar(45) default '';
declare pq int default 0;
declare pk double default 0.0;
declare cur1 CURSOR FOR SELECT product_id,product_quantity,product_kg from productstock;
/* 游标异常后设置pid为NULL */
declare CONTINUE HANDLER FOR SQLSTATE '02000' SET pid = null;
/*开游标*/
OPEN cur1;
FETCH cur1 INTO pid,pq,pk;
WHILE (pid is not null) DO
/* dosomething */
select pid,pq,pk;
FETCH cur1 INTO pid,pq,pk;
END WHILE;
CLOSE cur1;
END $$
DELIMITER ;
相关文档:
mysql 4.1的改变造成的乱码解决方法
第一个方法:
MySQL 4.1 中文乱码的问题
最近要将 MySQL 4.0 升级到 MySQL 4.1 ,发现了中文乱码的问题,希望以下见解对大家有用。
1. MySQL 4.1 在文字上有很大改进,它有了 Character Set 与 Collation 的慨念。
2. 在 MySQL 4.0 ,一般的程式都会将文字以拉丁文 ( latin) ......
我的测试环境.基本上数据是瞬间同步,希望对大家有帮助
redhat 9.0
mysql3.23.57
mysql数据同步备份
A服务器: 192.168.1.2 主服务器master
B服务器: 192.168.1.3 副服务器slave
A服务器设置
#mysql –u root –p
mysql>GRANT FILE ON *.* TO backup@192.168.1 ......
1.install mysql
get mysql
http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# tar -zxvf mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# cd mysql-5.1.41-linux-i686-icc-glibc23
[root@localhost mysql]# vim RE ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......