mysql´æ´¢¹ý³Ì Àý×Ó Óαêcursor Ñ»·Ç¶Ì× ÊÂÎï
×òÌìÒªmysqlÖÐд´æ´¢¹ý³Ì·¢ÏÖÍøÉÏÓйØÓÚcursorÑ»·ÇÒÌ×µÄ×ÊÁϺÜÉÙ,ÏÖ·¢³ö±¾ÈËдµÄÀý×Ó,Ï£ÍûÄܶԴó¼ÒÓаïÖú.
¿´ÕÐ:
DELIMITER $$
USE `ad_db`$$
DROP PROCEDURE IF EXISTS `test`$$
CREATE DEFINER=`root`@`%` PROCEDURE `test`()
BEGIN
/** CPAЧ¹ûÊý */
DECLARE _tmpId1 INT;
DECLARE _tmpId2 VARCHAR(5000);
DECLARE not_found INT DEFAULT 0 ;-- ÊÇ·ñδÕÒµ½Êý¾Ý ±ê¼Ç
DECLARE cursor1 CURSOR FOR SELECT id from fhtest2 ; -- ²âÊÔÓÃÎÞÒµÎñ¹Øϵ
DECLARE cursor2 CURSOR FOR SELECT test from fhtest2 ;-- ²âÊÔÓÃÎÞÒµÎñ¹Øϵ
DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; -- Èç¹ûδÕÒµ½Êý¾Ý ½«±ê¼Ç¸ÄΪ²»¿ÉÓÃ
DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK; -- Òì³£Ìø³ö
START TRANSACTION; -- Æô¶¯ÊÂÎï
INSERT INTO fhtest2 (test) VALUES (' ¿ªÊ¼1 ');
INSERT INTO fhtest2 (test) VALUES (' ¿ªÊ¼2 ');
OPEN cursor1; -- Æô¶¯Óαê1
WHILE not_found = 0 DO
FETCH cursor1 INTO _tmpId1;-- »ñÈ¡Êý¾Ý
IF NOT not_found THEN
OPEN cursor2; -- Æô¶¯Óαê2
WHILE not_found = 0 DO
FETCH cursor2 INTO _tmpId2;-- »ñÈ¡Êý¾Ý
IF NOT not_found THEN
INSERT INTO fhtest2 (test) VALUES (CONCAT(' id + test= ',_tmpId1,_tmpId2));
END IF ;
END WHILE ;
CLOSE cursor2;
SET not_found = 0 ; -- ½« ±ê¼Ç¸ÄΪ0¼´¿ÉÓà ·ñÔòÖ»Ö´ÐÐÒ»´Î,ÒÔΪÄÚ²¿Ñ»·Ö´ÐÐÍê³Éºó not_found = 1,ËùÓÐÒª½«ÆäÖÃΪ0
END IF;
END WHILE;
CLOSE cursor1;
COMMIT;
END$$
DELIMITER ;
Ïà¹ØÎĵµ£º
Link from : http://www.5ilinux.com/blog/archives/000091.html
1.Ê×ÏÈÎÒÃǽ¨Á¢ÏàÓ¦µÄÓû§ºÍÓû§×é
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
2.²Ù×÷Êý¾Ý¿â
mysql mysql -uroot -ppassword
create database ftpdb
grant select, upd ......
SOURCE: CLICK HERE
±¾ÎĽ²ÊöSQL Server¡¢Oracle¡¢MySQL²é³öֵΪNULLµÄÌæ»»¡£
ÔÚSQL Server Oracle MySQLµ±Êý¾Ý¿âÖвé³öijֵΪNULLÔõô°ì?
1¡¢MSSQL: ISNULL()
Óï·¨
ISNULL ( check_expression , replacement_value )
²ÎÊý
check_expression
½«±»¼ì²éÊÇ·ñΪ NULLµÄ±í´ïʽ¡£check_expression ¿ÉÒÔÊÇÈκÎÀàÐ͵ġ£
re ......
Ò»Ö±Ïëдµã¶«Î÷£¬µ«È´³Ù³ÙûÓпªÊ¼£¬½ñÌìÎÞÒâÖлص½ERP100Õâ¸öÍøÕ¾£¬·¢ÏÖÓÐÁËQADµÄרÇø£¬ÓÚÊÇ£¬Ò»Ê±ÈÈѪ·ÐÌÚ£¬Ð´Á˵㶫Î÷£¬¾Í½è´Ë»ú»á½«ÄÚÈÝÒ²·¢µ½ÕâÀï°É£¬ºÇºÇ¡£
ÆäʵÄÚÈݶ¼ÊDZ¾ÈËдµÄ£¬²»¹ýΪÁËͼ·½±ã£¬ÔÚERP100ÖÐдÍêÁË£¬È»ºóÖ±½ÓCopyµ½ÕâÀ͵Á˵ãÀÁ£¬ºÇºÇ¡£
ÒÔÏÂÊÇÕýÎÄ£¬ÔÚERP100ÖеĵØÖ·ÊÇ
http://bbs.erp100.com ......
ÔÚʹÓÃWindowsÃüÁîÐвÙ×÷MySQLÊý¾Ý¿âµÄʱºò£¬ÒÔutf8¸ñʽ´æ´¢ÔÚMySQLÊý¾Ý¿âÖеÄÊý¾Ý£¬´ÓÃüÁîÐжÁÈ¡³öÀ´×ÜÊÇÂÒÂ룬ÏÔʾȫÊÇÎʺš£»òÕß´ÓÃüÁîÐвåÈëÐÂÊý¾Ý£¬½á¹ûÏà·´£¬ÔÚÃüÁîÐÐÖÐÏÔʾÊÇÕý³£µÄ£¬µ«ÊÇÔÚPHPMyAdminÖÐÈ´ÊÇÂÒÂë¡£
¡¡¡¡¾¹ýÉÏÍø²éÕÒÑо¿£¬·¢ÏÖmysqlµÄÃüÁîÐпͻ§¶Ë¸ù±¾ÎÞ·¨ÒÔutf-8µÄÐÎʽ·µ»ØÊý¾Ý£¬½â¾öÈçÏ¡£
¡¡¡¡² ......
Some problems encounted this afternoon, when trying to setup/test mysql capabilities on hypnos and virgil.
1.ERROR 2003 (HY000): Can't connect to MySQL server on 'server-name' (111)
access locally (i.e. from localhost) is fine, when trying remotely got this error. when tried with mysql++ library, ......