Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PL/SQLѧϰ±Ê¼ÇÆß


Oracle9iÒì³£´¦Àí·ÖΪϵͳԤ¶¨ÒåÒì³£´¦ÀíºÍ×Ô¶¨ÒåÒì³£´¦ÀíÁ½²¿·Ö¡£
×Ô¶¨ÒåÒì³£´¦Àí
1.¶¨ÒåÒì³£´¦Àí
declare Òì³£Ãû exception;
2.´¥·¢Òì³£´¦Àí
raise Òì³£Ãû
3.´¦ÀíÒì³£
exception
when Òì³£Ãû1 then
    Òì³£´¦ÀíÓï¾ä¶Î1;
when Òì³£Ãû2 then
    Òì³£´¦ÀíÓï¾ä¶Î2;
ʾÀý£º
set serveroutput on
declare
   salaryerror  exception;
   tempsal scott.emp.sal%type;
begin
   select sal into tempsal 
   from scott.emp 
   where empno=7566;
   if tempsal<900 or tempsal>2600  then
      raise salaryerror;
   end if;    
   exception
   when salaryerror  then
     dbms_output.put_line('нˮ³¬³ö·¶Î§');
end; 


Ïà¹ØÎĵµ£º

.net³ÌÐòÔ±ËùÐèÕÆÎÕµÄsql£¬»ù±¾¼¼ÇÉ(2)

1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private :  ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
    protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
    public :    ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
    internal:  ÔÚÍ¬Ò ......

PL/SQLѧϰ±Ê¼ÇËÄ


ÊÂÎñÊÇOracle9iÖнøÐÐÊý¾Ý¿â²Ù×÷µÄ»ù±¾µ¥Î»£¬ÔÚPL/SQL³ÌÐòÖУ¬¿ÉÒÔʹÓÃ3¸öÊÂÎñ´¦Àí¿ØÖÆÃüÁî¡£
1. commitÃüÁî
commitÊÇÊÂÎñÌá½»ÃüÁî¡£Oracle9iÊý¾Ý¿âÖУ¬Îª±£Ö¤Êý¾ÝÒ»ÖÂÐÔ£¬ÔÚÄÚ´æÖÐΪÿ¸ö¿Í»§»ú½¨Á¢¹¤×÷Çø£¬¿Í»§»ú¶ÔÊý¾Ý¿â½øÐвÙ×÷µÄÊÂÎñ¶¼ÔÚ¹¤×÷ÇøÍê³É£¬Ö»ÓÐÖ´ÐÐcommitÃüÁîºó£¬¹¤×÷ÇøÄÚµÄÐÞ¸ÄÄÚÈݲÅдÈëµ½Êý¾Ý¿âÉÏ£¬³Æ ......

PL/SQLѧϰ±Ê¼ÇÎå


ÓαêÊÇ´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´µÄÊý¾Ý£¬ÒÔÁÙʱ±íµÄÐÎʽ´æ·ÅÔÚÄÚ´æÖУ¬ÔÚÓαêÖÐÓÐÒ»¸öÊý¾ÝÖ¸Õ룬ÔÚ³õʼ״̬ÏÂÖ¸ÏòÊ׼Ǽ£¬ ÀûÓÃfetchÓï¾äÒƶ¯¸ÃÖ¸Õ룬´Ó¶ø¶ÔÓαêÖеÄÊý¾Ý½øÐи÷ÖÖ²Ù×÷¡£
1.¶¨ÒåÓαê
cursor ÓαêÃû is selectÓï¾ä;
2.´ò¿ªÓαê
open ÓαêÃû;
3.ÌáÈ¡ÓαêÊý¾Ý
fetch ÓαêÃû into ±äÁ¿Ãû1, ±äÁ¿Ãû2, ....;
»ò ......

PL/SQLѧϰ±Ê¼ÇÁù


1.´´½¨¹ý³Ì
create or replace procedure ¹ý³ÌÃû as
   ÉùÃ÷Óï¾ä¶Î;
begin
   Ö´ÐÐÓï¾ä¶Î;
exception
   Òì³£´¦ÀíÓï¾ä¶Î;
end;
2. ´ø²ÎÊýµÄ¹ý³Ì
²ÎÊýÀàÐÍ3ÖÖ
in²ÎÊý£º¶ÁÈë²ÎÊý£¬Ö÷³ÌÐòÏò¹ý³Ì´«µÝ²ÎÊýÖµ
out²ÎÊý£ºÊä³ö²ÎÊý£¬¹ý³ÌÏòÖ÷³ÌÐò´«µÝ²ÎÊýÖµ
in out²ÎÊý£ºË«Ïò²ÎÊý
¶¨Òå ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ