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

beginÔÚsqlÖÐÊÇʲôÒâ˼

ÔÚ sql ÖÐ £¬begin ÓÃÓÚ×îÏÈÒ»¸öÊÂÎñ £¬¸ÃÊÂÎñ½« sql Óï¾ä·Ö×éµ½Ò»¸öÂß¼­µ¥Î»ÖÐ £¬ÒÔ±ã¶ÔÊý¾Ý¿âµÄ¸ü¸ÄÔÚÌύ֮ǰ¼á³ÖÔÝʱ״̬ £¬²¢ÔÊÐíÔÚ±¬·¢¹ýʧʱ»Ø¹ö¸ü¸Ä¡£ÊÂÎñͨ³£ÓÃÓÚÈ·±£Êý¾ÝÍêÕûÐÔ¡¢Ô­×ÓÐԺ͸ôÀëÐÔ¡£

BEGIN ÔÚ SQL ÖеļÄÒå

BEGIN ÔÚ SQL ÖÐÊÇÒ»¸öÊÂÎñ¿ØÖÆÓï¾ä £¬ÓÃÓÚ×îÏÈÒ»¸öÊÂÎñ¡£ËüָʾÊý¾Ý¿âÖÎÀíϵͳ (DBMS) ×îÏÈ´æ´¢ÓйØÕýÔÚÖ´ÐÐµÄ SQL Óï¾äµÄÐÅÏ¢ £¬ÕâЩÐÅÏ¢³ÆΪÊÂÎñÈÕÖ¾¡£

×÷ÓÃ

BEGIN Óï¾ä½« SQL Óï¾ä·Ö×éµ½Ò»¸öÂß¼­µ¥Î»£¨ÊÂÎñ£©ÖС£ÔÚÊÂÎñʱ´ú£º

¶ÔÊý¾Ý¿âËù×öµÄËùÓиü¸Ä¶¼ÊÇÔÝʱµÄ £¬Ö±µ½ÊÂÎñÌá½»»ò»Ø¹ö¡£

ÈôÊÇÊÂÎñʱ´ú±¬·¢¹ýʧ £¬Ôò¿ÉÒԻعöËùÓиü¸Ä £¬Ê¹Êý¾Ý¿â»Ö¸´µ½ÊÂÎñ×îÏÈÇ°µÄ״̬¡£

ÈôÊÇÊÂÎñÀÖ³ÉÍê³É £¬Ôò½«ÆäÌá½» £¬ÓÀÊÀµØÓ¦ÓöÔÊý¾Ý¿âµÄ¸ü¸Ä¡£

Óï·¨

BEGIN TRANSACTION;

µÇ¼ºó¸´ÖÆ

Ó÷¨

BEGIN Óï¾äͨ³£Óë COMMIT »ò ROLLBACK Óï¾äÒ»ÆðʹÓà £¬ÒÔ¿¢ÊÂÊÂÎñ¡£ÀýÈ磺

BEGIN TRANSACTION;
UPDATE customers SET balance = balance + 100 WHERE name = 'John Doe';
COMMIT TRANSACTION;

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖÐ £¬BEGIN Óï¾ä×îÏÈÒ»¸öÊÂÎñ £¬¸üвÙ×÷ÔÚÒ»¸öÊÂÎñÖÐÖ´ÐÐ £¬È»ºó COMMIT Óï¾ä½«¸ü¸ÄÓÀÊÀµØÓ¦Óõ½Êý¾Ý¿â¡£

ʲôʱ¼äʹÓà BEGIN£¿

Ó¦ÔÚÒÔÏÂÇéÐÎÏÂʹÓà BEGIN Óï¾ä£º

µ±ÐèҪȷ±£Êý¾ÝÍêÕûÐÔºÍÒ»ÖÂÐÔʱ¡£

µ±ÐèÒªÔ­×ÓÐÔ £¬¼´ËùÓвÙ×÷ҪôËùÓÐÀÖ³É £¬ÒªÃ´ËùÓÐʧ°Ü¡£

µ±ÐèÒª¸ôÀë £¬¼´ÊÂÎñÖ´Ðв»ÊÜÆäËû²¢·¢ÊÂÎñµÄÓ°Ïìʱ¡£

ÒÔÉϾÍÊÇbeginÔÚsqlÖÐÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ