×ðÁú¿­Ê±¹ÙÍøµÇ¼

mysqlÖÐcallµÄÓ÷¨

mysql ÖÐ call Óï¾äÓÃÓÚŲÓô洢Àú³Ì»òº¯Êý£¬ÓÃÓÚ½ç˵Ԥ½ç˵µÄ sql Óï¾ä×é¡£°ì·¨ÈçÏ£º1. ½¨Éè´æ´¢Àú³Ì»òº¯Êý £»2. ±àд call Óï¾ä£¬Ö¸ÃüÃû³ÆºÍ²ÎÊý £»3. Ö¸¶¨Óë²ÎÊýÀàÐÍÎÂ˳ÐòÏàÆ¥ÅäµÄ²ÎÊýÖµ £»4. Ö´ÐÐ call Óï¾ä¡£

MySQL ÖÐ CALL µÄÓ÷¨

CALL Óï¾äÓÃÓÚŲÓô洢Àú³Ì»òº¯Êý£¬´æ´¢Àú³Ì»òº¯Êý°üÀ¨Ò»×éÔ¤ÏȽç˵µÄ SQL Óï¾ä¡£CALL Óï¾äµÄÓï·¨ÈçÏ£º

CALL [schema_name.]procedure_name(argument_list);

µÇ¼ºó¸´ÖÆ

ÆäÖУº

schema_name ÊÇ´æ´¢Àú³Ì»òº¯ÊýËùÔÚµÄģʽÃû³Æ£¨¿ÉÑ¡£©

procedure_name ÊÇ´æ´¢Àú³Ì»òº¯ÊýµÄÃû³Æ

argument_list ÊÇ´æ´¢Àú³Ì»òº¯ÊýµÄ²ÎÊýÁÐ±í£¨¿ÉÑ¡£©

ÏÂÃæÏêϸÏÈÈÝʹÓà CALL Óï¾äµÄ°ì·¨£º

1. ½¨Éè´æ´¢Àú³Ì»òº¯Êý

ÔÚŲÓô洢Àú³Ì»òº¯Êý֮ǰ£¬ÐèÒªÏȽ¨ÉèËü¡ £¿ÉÒÔʹÓà CREATE PROCEDURE »ò CREATE FUNCTION Óï¾ä½¨Éè¡£

2. ±àд CALL Óï¾ä

ʹÓà CALL Óï¾äŲÓô洢Àú³Ì»òº¯Êýʱ£¬ÐèÒªÖ¸¶¨ÆäÃû³ÆºÍ²ÎÊý£¨ÈôÊÇÐèÒª£©¡£

3. Ö¸¶¨²ÎÊý

´æ´¢Àú³Ì»òº¯Êý¿ÉÒÔ½ÓÊܲÎÊý¡£ÔÚ CALL Óï¾äÖУ¬²ÎÊýÖµ±ØÐèÓë´æ´¢Àú³Ì»òº¯ÊýÖÐÉùÃ÷µÄ²ÎÊýÀàÐÍÎÂ˳ÐòÏàÆ¥Åä¡£

4. Ö´ÐÐ CALL Óï¾ä

CALL Óï¾ä¿ÉÒÔͨ¹ýÒÔÏ·½·¨Ö´ÐУº

ÔÚ MySQL ÏÂÁîÌáÐÑ·ûÏÂÖ´ÐУºCALL procedure_name(argument_list);

ÔÚÓ¦ÓóÌÐòÖÐ×÷Ϊ SQL Óï¾äÖ´ÐÐ

ʾÀý

ÒÔÏÂʾÀýŲÓÃÃûΪ get_customer_details µÄ´æ´¢Àú³Ì£¬¸Ã´æ´¢Àú³Ì»ñÈ¡Ö¸¶¨¿Í»§µÄÏêϸÐÅÏ¢£º

CALL get_customer_details(10);

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖУ¬10 ÊÇÒª»ñÈ¡ÆäÏêϸÐÅÏ¢µÄ¿Í»§ ID¡£´æ´¢Àú³Ì·µ»ØÒ»¸öЧ¹û¼¯£¬ÆäÖаüÀ¨¸Ã¿Í»§µÄÏêϸÐÅÏ¢¡£

×¢ÖØ£º

CALL Óï¾ä·µ»ØÒ»¸öÓï¾äÍê³É±ê¼Ç£¬Ö¸Ê¾ÊÇ·ñÀÖ³ÉÖ´ÐÐÁË´æ´¢Àú³Ì»òº¯Êý¡£

ÈôÊÇ´æ´¢Àú³Ì»òº¯Êý·µ»ØÈκÎÊä³ö²ÎÊý»òЧ¹û¼¯£¬¿ÉÒÔʹÓà SELECT Óï¾ä¼ìË÷ËüÃÇ¡£

ÒÔÉϾÍÊÇmysqlÖÐcallµÄÓ÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ