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

plsqlÖÐelseµÄÓ÷¨

pl/sql ÖÐ else ×Ó¾äÔÚ if-then-else Óï¾äÖÐÖ¸¶¨Ìõ¼þΪ¼ÙʱµÄÌæ»»Ö´Ðз¾¶£¬Ó﷨Ϊ£ºif condition then ´úÂë¿é 1 else ´úÂë¿é 2 end if¡£ËüµÄÓ÷¨°üÀ¨£ºÖ¸¶¨Ìõ¼þΪ¼ÙʱµÄ²Ù×÷¡¢´¦Àí²î±ðЧ¹ûºÍ´¦ÀíÌØÊâÇéÐΡ£

PL/SQL ÖÐ ELSE ×Ó¾äµÄÓ÷¨

ELSE ×Ó¾äÓÃÓÚÔÚ PL/SQL ¿ØÖÆÓï¾ä£¨Èç IF-THEN-ELSE£©ÖÐÖ¸¶¨µ±Ìõ¼þΪ¼ÙʱµÄÌæ»»Ö´Ðз¾¶¡£

Óï·¨

IF condition THEN
  -- ´úÂë¿é 1 -- ÈôÊÇÌõ¼þΪÕ棬ÔòÖ´ÐÐ
ELSE
  -- ´úÂë¿é 2 -- ÈôÊÇÌõ¼þΪ¼Ù£¬ÔòÖ´ÐÐ
END IF;

µÇ¼ºó¸´ÖÆ

Ó÷¨

ELSE ×Ó¾äÔÚÒÔÏÂÇéÐÎÏÂʹÓãº

µ±ÐèÒªÔÚÌõ¼þ²»Öª×ãʱִÐÐÌض¨²Ù×÷ʱ¡£

µ±ÐèÒªÔÚÁ½ÖÖ»ò¸ü¶àÖÖ¿ÉÄܵÄЧ¹ûÖ®¼ä¾ÙÐÐÑ¡Ôñʱ¡£

µ±ÐèÒª´¦ÀíÌõ¼þΪ¼ÙµÄÌØÊâÇéÐÎʱ¡£

ʾÀý

-- ¼ì²éÒ»¸öÊý×ÖÊÇ·ñÊÇżÊý
DECLARE
  number NUMBER := 10;
BEGIN
  IF number MOD 2 = 0 THEN
    DBMS_OUTPUT.PUT_LINE('¸ÃÊý×ÖÊÇżÊý¡£');
  ELSE
    DBMS_OUTPUT.PUT_LINE('¸ÃÊý×ÖÊÇÆæÊý¡£');
  END IF;
END;

µÇ¼ºó¸´ÖÆ

Êä³ö:

¸ÃÊý×ÖÊÇżÊý¡£

µÇ¼ºó¸´ÖÆ

×¢ÖØ:

ELSE ×Ó¾äÊÇ¿ÉÑ¡µÄ¡£ÈôÊDz»Ìṩ£¬Ôòµ±Ìõ¼þΪ¼Ùʱ£¬¿ØÖÆÁ÷³Ì½«¼ÌÐøÖ´ÐкóÐø´úÂë¡£

ELSE ×Ó¾äÖ»ÄÜÓë IF Óï¾äÒ»ÆðʹÓá£

ELSE ×Ó¾ä¿ÉÒÔǶÌ×ÔÚÆäËû IF Óï¾äÖС£

ELSE ×Ó¾ä¿ÉÒÔÓë ELSIF ×Ó¾äÒ»ÆðʹÓã¬ÒÔʵÏÖ¸üÖØ´óµÄ·ÖÖ§Âß¼­¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ