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

oracle ´æ´¢¹ý³ÌµÄ»ù±¾Óï·¨

http://topic.csdn.net/t/20040818/16/3287013.html 
1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
    ²ÎÊý1 IN NUMBER,
    ²ÎÊý2 IN NUMBER
) IS|AS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
˵Ã÷£ºisÒ²¿É»»³Éas
2.SELECT INTO STATEMENT
  ½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ìõ
  ¼Ç¼£¬·ñÔòÅ׳öÒì³£(Èç¹ûûÓмǼÅ׳öNO_DATA_FOUND)
  Àý×Ó£º
  BEGIN
  SELECT col1,col2 into ±äÁ¿1,±äÁ¿2 from typestruct where xxx;
  EXCEPTION
  WHEN NO_DATA_FOUND THEN
      xxxx;
  END;
  ...
3.IF ÅжÏ
  IF V_TEST=1 THEN
    BEGIN
       do something
    END;
  END IF;
4.while Ñ­»·
  WHILE V_TEST=1 LOOP
  BEGIN
 XXXX
  END;
  END LOOP;
  µ¥Ñ­»·£º
LOOP 
  statements
END LOOP;
//һֱѭ»·Óï¾ä¶Î,³ý·ÇÏÔʾµÄÊäÈëEXIT / EXIT WHEN Óï¾ä½áÊøÑ­»·
      
  WHILEÑ­»·£º
WHILE condition LOOP
    statements
END LOOP;
example:
  count:=0;
  WHILE counter<6 LOOP 
    count :=count + 1 ;
  END LOOP ;
5.for Ñ­»·
FOR loop_variable IN [REVERSE] lower_bound..upper_bound LOOP
  statements;
END LOOP;
example:
  FOR id IN 3..6 LOOP
  DBMS_OUTPUT.PUT_LINE(id);
  END LOOP;
6.±äÁ¿¸³Öµ
  V_TEST := 123;
  ±äÁ¿Ãû   ±äÁ¿ÀàÐÍ £»/ £º = [³õʼÊýÖµ] £»
id   INTEGER ;
  name   VARCHAR2(20) :='BinMing';
* proname product.price%TYPE ; // (%TYPE) ±íʾproname µÄÀàÐÍÒªºÍproduct±íÖеÄpriceµÄÀ


Ïà¹ØÎĵµ£º

¹ØÓÚOracleµÄÐòÁУ¨Sequence£©Ê¹ÓÃ

OracleûÓÐ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐÍ£¬ÎÒÃÇÐèÒª½¨Á¢Ò»¸ö×Ô¶¯Ôö³¤µÄÐòÁкţ¬²åÈë¼Ç¼ʱҪ°ÑÐòÁкŵÄÏÂÒ»¸öÖµ¸³ÓÚ´Ë×ֶΣ¡
create sequence type_id increment by 1 start with 1;
Õâ¾äÖУ¬type_idΪÐòÁкŵÄÃû³Æ£¬Ã¿´ÎÔö³¤Îª1£¬ÆðʼÐòºÅΪ1¡£
Èç¹ûҪɾ³ýÐòÁУ¬ÓÃdrop sequence ÐòÁÐÃû¾Í¿ÉÒÔÁË£¡£¡
ÐòÁпÉÒÔ±£Ö¤¶à¸öÓû§¶ÔÍ¬Ò»Õ ......

OracleÊý¾Ý¿â·ÖÇø±í²Ù×÷·½·¨

http://www.diybl.com/course/7_databases/oracle/oraclejs/2007614/52942.html
ÕªÒª£ºÔÚ´óÁ¿ÒµÎñÊý¾Ý´¦ÀíµÄÏîÄ¿ÖУ¬¿ÉÒÔ¿¼ÂÇʹÓ÷ÖÇø±íÀ´Ìá¸ßÓ¦ÓÃϵͳµÄÐÔÄܲ¢·½±ãÊý¾Ý¹ÜÀí£¬±¾ÎÄÏêϸ½éÉÜÁË·ÖÇø±íµÄʹÓᣠ
¡¡¡¡ ÔÚ´óÐ͵ÄÆóÒµÓ¦ÓûòÆóÒµ¼¶µÄÊý¾Ý¿âÓ¦ÓÃÖУ¬Òª´¦ÀíµÄÊý¾ÝÁ¿Í¨³£¿ÉÒÔ´ïµ½¼¸Ê®µ½¼¸°ÙGB£¬ÓеÄÉõÖÁ¿ÉÒÔµ½T ......

oracle 8i,9iºÍ10g µÄÇø±ð

Oracle 9i±È8i¶àÁËÄÄЩÐÂÌØÐÔ£¿
 ¼òҪ˵£º
    9i¸üÒ×ÓÚ¹ÜÀí¡£
Ïêϸ˵£º
    ²¢·¢¼¯Èº£¬8i OPSÉý¼¶Îª9i RAC£¬8i½áµã¼äÓÃÓ²Å̽»»»ÐÅÏ¢£¬9i½áµã¼ä²ÉÓøßËÙÍøÏߵĻº´æÈÛºÏ(Cache Fusion)¼¼Êõ½»»»ÐÅÏ¢£¬½»»»ËÙ¶ÈÌá¸ß100±¶ÒÔÉÏ¡£
    9i¿ÉÒÔÔÚÏßÐÞ¸ÄÄں˲ÎÊýºÍÄÚ´æ·ÖÅä£ ......

oracle method

--single line method
select ascii('A') Big_A from dual;
select chr(65) A, chr(122) z, chr(223) ch3 from dual;
select concat('sigo','way') from dual;
select initcap('sigoway') from dual;
select instr('ababab','a',-1,2), instr('ababab','a',1,3) from dual;
select instrb('ababab','a',1,3) from dua ......

Oracle»ù±¾²Ù×÷

1.´´½¨±í¿Õ¼ä
  create tablespace test datafile'c:\test.dbf' size 10m;  //Ãû×Ö²»ÒªÎªÊý×Ö
2.´´½¨Óû§
create user userName identified by password;  //²»ÒªÎªÊý×Ö
3.¸øÓû§ÊÚȨ
grant dba to userName; --ÊÚÓèDBAȨÏÞ
grant unlimited tablespace to userName;--ÊÚÓè²»ÏÞÖƵıí¿Õ¼ä
grant sele ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ