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

oracle PL SQLѧϰ°¸Àý£¨¶þ£©

¡¾ÑµÁ·6.1¡¿¡¡Ê¹ÓÃÒþʽÓαêµÄÊôÐÔ£¬Åж϶ԹÍÔ±¹¤×ʵÄÐÞ¸ÄÊÇ·ñ³É¹¦¡£
²½Öè1£ºÊäÈëºÍÔËÐÐÒÔϳÌÐò£º
BEGIN
  UPDATE emp SET sal=sal+100 WHERE empno=1234;
  IF SQL%FOUND THEN
       DBMS_OUTPUT.PUT_LINE('³É¹¦Ð޸ĹÍÔ±¹¤×Ê£¡');
       ROLLBACK;
  ELSE
       
        DBMS_OUTPUT.PUT_LINE('Ð޸ĹÍÔ±¹¤×Êʧ°Ü£¡');
  END IF;
END;
  ÔËÐнá¹ûΪ£º
  Ð޸ĹÍÔ±¹¤×Êʧ°Ü£¡
  PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
  ²½Öè2£º½«¹ÍÔ±±àºÅ1234¸ÄΪ7788£¬ÖØÐÂÖ´ÐÐÒÔÉϳÌÐò£º
  ÔËÐнá¹ûΪ£º
  ³É¹¦Ð޸ĹÍÔ±¹¤×Ê£¡
  PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
  ËµÃ÷£º±¾ÀýÖУ¬Í¨¹ýSQL%FOUNDÊôÐÔÅжÏÐÞ¸ÄÊÇ·ñ³É¹¦£¬²¢¸ø³öÏàÓ¦ÐÅÏ¢¡£
=================================================================
¡¾ÑµÁ·7.1¡¿  ÓÃÓαêÌáÈ¡emp±íÖÐ7788¹ÍÔ±µÄÃû³ÆºÍÖ°Îñ¡£
DECLARE   
  v_ename VARCHAR2(10);
  v_job VARCHAR2(10);
  CURSOR emp_cursor IS
  SELECT ename,job from emp WHERE empno=7788;
BEGIN
    OPEN emp_cursor;
    FETCH emp_cursor INTO v_ename,v_job;
    DBMS_OUTPUT.PUT_LINE(v_ename||','||v_job);
    CLOSE emp_cursor;
END;
  Ö´Ðнá¹ûΪ:
  SCOTT,ANALYST
  PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£?
  ËµÃ÷£º¸Ã³ÌÐòͨ¹ý¶¨ÒåÓαêemp_cursor£¬ÌáÈ¡²¢ÏÔʾ¹ÍÔ±7788µÄÃû³ÆºÍÖ°Îñ¡£
  ×÷Ϊ¶ÔÒÔÉÏÀý×ӵĸĽø£¬ÔÚÒÔÏÂѵÁ·ÖвÉÓÃÁ˼Ǽ±äÁ¿¡£
================================================================
  ¡¾ÑµÁ·7.2¡¿  ÓÃÓαêÌáÈ¡emp±íÖÐ7788¹ÍÔ±µÄÐÕÃû¡¢Ö°ÎñºÍ¹¤×Ê¡£
DECLARE
  CURSOR emp_cursor IS  SELECT ename,job,sal from emp WHERE empno=7788;
  emp_record emp_cursor%ROWTYPE;
BEGIN
    OPEN emp_cursor;   
    FETCH emp_cursor INTO emp_record;
    DBMS_OUTPUT.PUT_LINE(emp_record.ename||'


Ïà¹ØÎĵµ£º

SQL server 2005ѧϰ±Ê¼Ç(ÊÓͼ)


Ò»£®ÊÓͼ(VIEW)
¶¨Ò壺ÊÓͼÊÇÒ»ÕÅÐéÄâµÄ±í£¬ÆäÄÚÈÝÊÇ´ÓÒ»ÕÅ»ò¶àÕűíÖвéѯµÃÀ´µÄ½á¹û¼¯¡£
ÃèÊö£ºÊÓͼÊÇ´æ´¢ÔÚϵͳĿ¼ÖеÄÐÅÏ¢£¬Ëý²¢Ã»ÓÐÕæÕý´æ´¢Êý¾Ý£¬¶øÊÇÒÑ´æ±íµÄͶӰ¡£ÊÓͼµÄÊôÐÔÊÇ°´ÕÕÒ»¸ö²éѯµÄ¹æ¶¨´ÓÒ»¸ö»òÕ߶à¸ö±íÖе¼³öµÄ£¬ÊÇÒÑ´æ±íµÄ¹ýÂËÆ÷¡£ËýÊÇÒ»ÕÅ“Ðé±í”£¬´ÓÒ»Õűí»òÕ߶àÕűíÖÐÅÉÉú³öÀ´µÄ£¬Æä ......

¡¾×ܽ᡿oracle»Ö¸´Îóɾ³ýÊý¾Ý£¬½â³ýËø¶¨µÄµÈsqlÓï¾ä

1.Ôø¾­²»Ð¡ÐÄ°Ñ¿ª·¢¿âµÄÊý¾Ý¿â±íÈ«²¿É¾³ý£¬µ±Ê±ÏŵÄÒªËÀ¡£½á¹ûÕÒµ½ÏÂÃæµÄÓï¾ä»Ö¸´µ½ÁË1¸öСʱ֮ǰµÄÊý¾Ý£¡ºÜ¼òµ¥¡£
×¢ÒâʹÓùÜÀíÔ±µÇ¼ϵͳ£º
select * from ±íÃû as of timestamp sysdate-1/12 //²éѯÁ½¸öСʱǰµÄij±íÊý¾Ý£¡¼ÈÈ»Á½Ð¡Ê±ÒÔÇ°µÄÊý¾Ý¶¼µÃµ½ÁË£¬¼ÌÐøÔõô×ö£¬ÖªµÀÁË°É¡£¡£

Èç¹ûdropÁË±í£¬Ôõô°ì£¿£¿¼ûÏ ......

Ò»´Îoracle supportµÄΣ»úÏÖ³¡´¦Àí£¨Ö®¶þ£©

ÌìÓв»²â·çÔÆ£¬
IBM µÄÖж˴ÅÅÌÕóÁÐÕâ´ÎÓÖÈÇ»öÁË¡£ÔÚ΢ÂëÉý¼¶µÄʱºò£¬
DS4800 ·¢Éú¹ÊÕÏ¡£µ¼Öµ±Ê±ÔÚÕą̂¿âÉϵļ¸Ì×Éú²ú¿â±¨´íÁË¡£
IBM¹¤³Ìʦ°ÑÕóÁйÊÕϻָ´ºó£¬ÅÄÅÄƨ¹É×ßÈË£¬ÕóÁÐÉϵÄÊý¾ÝÓÖµÃÎÒÃÇÀ´Ïë°ì·¨ÇÀ¾ÈÁË¡£¡£¡£¡£
»¹ºÃÓÐoracle supportµÄÖ§³ÖÎÒÃÇ×îÖÕ»¯½âÁËÕâ´ÎΣ»ú¡£ÏÂÎÄÏêϸ½éÉÜÁËÕû¸ö»Ö¸´µÄ¹ý³Ì¡£
oracle¹¤ ......

oracle nvl decode

SELECT
DECODE(ÁÐ,0,'Q'1,'P',2,'O')¡¡AS ret
from dual
--·ÖÎö: µ± ÁÐ=0ʱ,½«"Q"¸³Öµ
--µ± ÁÐ =1ʱ,½«"P"¸³Öµ
--µ± ÁÐ=2ʱ,½«"O"¸³Öµ
--NVL()º¯Êý:
--NVL(ARG,VALUE)´ï±êÈç¹ûÇ°ÃæµÄARGֵΪNULLÄÇô·µ»ØµÄֵΪºóÃæµÄVALUE¶þÕß½áºÏʹÓÃ:
DECODE(NVL(±äÁ¿ ''),'','-','OK')
//·ÖÎö:
--Èô ±äÁ¿ ÊÇ·ñΪ¿Õ.ÈôΪ¿Õ¸³¸ø¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ