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

oracle ±Ê¼Ç VI Ö®Óαê (CURSOR)

 Óαê(CURSOR),ºÜÖØÒª
Óαê:ÓÃÓÚ´¦Àí¶àÐмǼµÄÊÂÎñ
ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú(handle)»òÖ¸Õë,¼òµ¥Ëµ£¬Óαê¾ÍÊÇÒ»¸öÖ¸Õë
1 ´¦ÀíÏÔʽÓαê
  ÏÔʽÓα괦ÀíÐè 4¸ö PL/SQL ²½Öè,ÏÔʾÓαêÖ÷ÒªÓÃÓÚ´¦Àí²éѯÓï¾ä
  (1) ¶¨ÒåÓαê
  ¸ñʽ:  CURSOR cursor_name [(partment[,parameter]...)] IS select_statement;
   ¶¨ÒåµÄÓα겻ÄÜÓÐ INTO ×Ó¾ä
  (2) ´ò¿ªÓαê
   OPEN cursor_name[...];
  PL/SQL ³ÌÐò²»ÄÜÓà OPEN Óï¾äÖØ¸´´ò¿ªÒ»¸öÓαê
  (3)ÌáÈ¡ÓαêÊý¾Ý
   FETCH cursor_name INTO {variable_list | record_variable};
  (4) ¹Ø±ÕÓαê
   CLOSE cursor_name;
  Àý 1 ²éѯǰ 10 ÃûÔ±¹¤µÄÐÅÏ¢  
   declare
    --¶¨ÒåÓαê
    cursor c_cursor is select last_name,salary  from employees where rownum < 11 order by salary;
    v_name employees.last_name%type;
    V_sal employees.salary%type;
 
    begin
      --´ò¿ªÓαê
      open c_cursor;
      -- ÌáÈ¡ÓαêÊý¾Ý
      fetch c_cursor into v_name,v_sal;
       while c_cursor %found loop
             dbms_output.put_line(v_name || ':' || v_sal);
             fetch c_cursor into v_name,v_sal;
        end loop;
  
       --¹Ø±ÕÓαê
       close c_cursor;
   end;
----------------------------------
 Á·Ï°: ÊäÈ벿ÃźŠdep_id,²éѯ¸Ã²¿Ãŵį½¾ù¹¤×Ê : avg_sal,Ô±¹¤¹¤×ÊΪ salary
       Èô salary < avg_sal - 500 ¹¤×ÊÕÇ 500
       Èô avg_sal - 500 <= salary < avg_sal + 500 ¹¤×ÊÕÇ 300
       Èô


Ïà¹ØÎĵµ£º

Oracle×Ö·û¼¯ÐÞ¸ÄÎÊÌâ

 ¾­³£ÓÐͬÊÂ×ÉѯoracleÊý¾Ý¿â×Ö·û¼¯Ïà¹ØµÄÎÊÌ⣬ÈçÔÚ²»Í¬Êý¾Ý¿â×öÊý¾ÝÇ¨ÒÆ¡¢Í¬ÆäËüϵͳ½»»»Êý¾ÝµÈ£¬³£³£ÒòΪ×Ö·û¼¯²»Í¬¶øµ¼ÖÂÇ¨ÒÆÊ§°Ü»òÊý¾Ý¿âÄÚÊý¾Ý±ä³ÉÂÒÂë¡£ÏÖÔÚÎÒ½«oracle×Ö·û¼¯Ïà¹ØµÄһЩ֪ʶ×ö¸ö¼òµ¥×ܽᣬϣÍû¶Ô´ó¼Ò½ñºóµÄ¹¤×÷ÓÐËù°ïÖú¡£
¡¡¡¡Ò»¡¢Ê²Ã´ÊÇoracle×Ö·û¼¯
¡¡¡¡Oracle×Ö·û¼¯ÊÇÒ»¸ö×Ö½ÚÊý¾ÝµÄ½âÊÍ ......

Oracle Stream Replication¼¼Êõ


Stream ÊÇOracle µÄÏûÏ¢¶ÓÁÐ(Ò²½ÐOracle Advanced Queue)¼¼ÊõµÄÒ»ÖÖÀ©Õ¹Ó¦ÓᣠOracle µÄÏûÏ¢¶ÓÁÐÊÇͨ¹ý·¢²¼/¶©Ôĵķ½Ê½À´½â¾öʼþ¹ÜÀí¡£Á÷¸´ÖÆ(Stream replication)Ö»ÊÇ»ùÓÚËüµÄÒ»¸öÊý¾Ý¹²Ïí¼¼Êõ£¬Ò²¿ÉÒÔ±»ÓÃ×÷Ò»¸ö¿ÉÁé»î¶¨ÖƵĸ߿ÉÓÃÐÔ·½°¸¡£ Ëü¿ÉÒÔʵÏÖÁ½¸öÊý¾Ý¿âÖ®¼äÊý¾Ý¿â¼ ......

Oracle ÃÜÂëÎļþѧϰ

½ñÌìÔÚÍøÉÏÂҹ䣬¿´µ½Ò»Æª²»´íµÄÎÄÕ£¬¹ØÓÚORACLEÃÜÂëÎļþµÄ£¬ÀíÂÛѧϰ+¸öÈËʵ¼ù£¬ºÇºÇ£¬¸´ÖƹýÀ´£¬·½±ãÒÔºóѧϰ¡£
===============================================================================
ÀíÂÛ²¿·Ö
Oracle¹ØÏµÊý¾Ý¿âϵͳÒÔÆä׿ԽµÄÐÔÄÜ»ñµÃÁ˹㷺µÄÓ¦Ó㬶ø±£Ö¤Êý¾Ý¿â°²È«ÐÔÊÇÊý¾Ý¿â¹ÜÀí¹¤×÷µÄÖØÒªÄÚÈÝ¡£±¾ ......

oracleµÄ¹éµµÄ£Ê½

Ò»¡£²é¿´oracleÊý¾Ý¿âÊÇ·ñΪ¹éµµÄ£Ê½£º
1.select name,log_mode from v$database;
NAME               LOG_MODE
------------------ ------------------------
QUERY           NOARCHIVELO ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ