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

ORACLE °ó¶¨±äÁ¿Ó÷¨×ܽá

֮ǰ¶ÔORACLEÖеıäÁ¿Ò»Ö±Ã»¸öÌ«Çå³þµÄÈÏʶ£¬±ÈÈç˵ʹÓ㺡¢&¡¢&&¡¢DEIFINE¡¢VARIABLE……µÈµÈ¡£½ñÌìÕýºÃÏÐÏÂÀ´£¬ÉÏÍøËÑÁËËÑÏà¹ØµÄÎÄÕ£¬»ã×ÜÁËһϣ¬ÌùÔÚÕâÀ·½±ãѧϰ¡£
==================================================================================
 ÔÚoracle ÖУ¬¶ÔÓÚÒ»¸öÌá½»µÄsqlÓï¾ä,´æÔÚÁ½ÖÖ¿ÉÑ¡µÄ½âÎö¹ý³Ì, Ò»ÖÖ½Ð×öÓ²½âÎö,Ò»ÖÖ½Ð×öÈí½âÎö.
Ò»¸öÓ²½âÎöÐèÒª¾­½âÎö,ÖÆ¶¨Ö´Ðз¾¶,ÓÅ»¯·ÃÎʼƻ®µÈÐí¶àµÄ²½Öè.Ó²½âÊͲ»½ö½öºÄ·Ñ´óÁ¿µÄcpu£¬¸üÖØÒªµÄÊÇ»áÕ¼¾ÝÖØÒªµÄÃÇãÅ£¨latch£©×ÊÔ´£¬ÑÏÖØµÄÓ°ÏìϵͳµÄ¹æÄ£µÄÀ©´ó£¨¼´ÏÞÖÆÁËϵͳµÄ²¢·¢ÐУ©£¬¶øÇÒÒýÆðµÄÎÊÌâ²»ÄÜͨ¹ýÔö¼ÓÄÚ´æÌõºÍcpuµÄÊýÁ¿À´½â¾ö¡£Ö®ËùÒÔÕâÑùÊÇÒòΪÃÅãÅÊÇΪÁË˳Ðò·ÃÎÊÒÔ¼°ÐÞ¸ÄһЩÄÚ´æÇøÓò¶øÉèÖõģ¬ÕâЩÄÚ´æÇøÓòÊDz»Äܱ»Í¬Ê±Ð޸ġ£µ±Ò»¸ösqlÓï¾äÌá½»ºó£¬oracle»áÊ×Ïȼì²éһϹ²Ïí»º³å³Ø£¨shared pool£©ÀïÓÐûÓÐÓëÖ®ÍêÈ«ÏàͬµÄÓï¾ä£¬Èç¹ûÓеϰֻÐëÖ´ÐÐÈí·ÖÎö¼´¿É£¬·ñÔò¾ÍµÃ½øÐÐÓ²·ÖÎö¡£
 ¶øÎ¨Ò»Ê¹µÃoracle Äܹ»Öظ´ÀûÓÃÖ´Ðмƻ®µÄ·½·¨¾ÍÊDzÉÓð󶨱äÁ¿¡£°ó¶¨±äÁ¿µÄʵÖʾÍÊÇÓÃÓÚÌæ´úsqlÓï¾äÖеij£Á¿µÄÌæ´ú±äÁ¿¡£°ó¶¨±äÁ¿Äܹ»Ê¹µÃÿ´ÎÌá½»µÄsqlÓï¾ä¶¼ÍêȫһÑù¡£
 
1.
sqlplusÖÐÈçºÎʹÓð󶨱äÁ¿£¬¿ÉÒÔͨ¹ývariableÀ´¶¨Òå
SQL> select * from tt where id=1;
ID NAME
---------- ----------------------------------------
1 test
SQL> select * from tt where id=2;
ID NAME
---------- ----------------------------------------
2 test
SQL> variable i number;
SQL> exec :i :=1;
PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
SQL> select *from tt where id=:i;
ID NAME
---------- ----------------------------------------
1 test
SQL> exec :i :=2;
PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
SQL> select *from tt where id=:i;
ID NAME
---------- ----------------------------------------
2 test
SQL> print i;
I
----------
2
SQL> select sql_text,parse_calls from v$sql where sql_text like 'select * from t
t where id=%';
SQL_TEXT PARSE_CALLS
------------------------------------------------------------ -----------
select * from tt where id=2 1
select * from tt where id=1 1
select * from tt where id=:i 2
SQL>
´ÓÉÏÃæÊÔÑé·¢Ïְ󶨱äÁ¿iµÄʹÓÃʹ²éѯid=1ºÍi


Ïà¹ØÎĵµ£º

oracle ÎïÀí¶Á,Âß¼­¶ÁµÄÀí½â

Ò».ÎïÀí¶Á(physical read)
µ±Êý¾Ý¿éµÚÒ»´Î¶ÁÈ¡µ½,¾Í»á»º´æµ½buffer cache ÖÐ,¶øµÚ¶þ´Î¶ÁÈ¡ºÍÐ޸ĸÃÊý¾Ý¿éʱ¾ÍÔÚÄÚ´æbuffer cache ÁË ÒÔÏÂÊÇÀý×Ó:
1.1 µÚÒ»´Î¶ÁÈ¡:
C:"Documents and Settings"Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Feb 28 09:32:04 2008
Copyright (c) 19 ......

²»Óð²×°Oracle ClientÈçºÎʹÓÃPLSQL Developer

 http://www.cnblogs.com/sleepywang/archive/2009/10/13/1582654.html
1. ÏÂÔØoracleµÄ¿Í»§¶Ë³ÌÐò°ü£¨30M£©
      
Ö»ÐèÒªÔÚ
Oracle
ÏÂÔØÒ»¸ö½Ð
Instant Client Package
µÄÈí¼þ¾Í¿ÉÒÔÁË£¬Õâ¸öÈí¼þ²»ÐèÒª°²×°£¬Ö»Òª½âѹ¾Í¿ÉÒÔÓÃÁË£¬ºÜ·½±ã£¬¾ÍËã֨װÁËϵͳ»¹ÊÇ¿ÉÒÔÓõġ£
  ......

Oracle ³£Óú¯Êý×ܽá

 Ô´ÌùµØÖ·:http://topic.csdn.net/u/20090520/15/08a03d2e-a537-4c06-b79a-7e2f7ed5f898.html
1,
ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2. CHR ......

ORACLE to_char(),to_date()Ó÷¨

to_date() function
1.ÈÕÆÚ¸ñʽ²ÎÊý º¬Òå˵Ã÷ 
D Ò»ÖÜÖеÄÐÇÆÚ¼¸ 
DAY ÌìµÄÃû×Ö£¬Ê¹ÓÿոñÌî³äµ½9¸ö×Ö·û 
DD ÔÂÖеĵڼ¸Ìì 
DDD ÄêÖеĵڼ¸Ìì 
DY ÌìµÄ¼òдÃû 
IW ISO±ê×¼µÄÄêÖеĵڼ¸ÖÜ 
IYYY ISO±ê×¼µÄËÄλÄê·Ý 
YYYY ËÄλÄê·Ý 
YYY,YY,Y Äê·ÝµÄ×îºóÈýÎ ......

OracleµÄrownumÔ­ÀíºÍʹÓÃ(·ÖÒ³²éѯ)

 
ÒªÏÔʾ1µ½2ÐÐÔò¿ÉÒÔͨ¹ý
select * from dangan where rownum between 1 and 2
ÔÚOracle
ÖУ¬Òª°´Ìض¨Ìõ¼þ²éѯǰNÌõ¼Ç¼£¬Óøörownum
¾Í¸ã¶¨ÁË¡£
select *
from emp where rownum
<= 5
¶øÇÒÊéÉÏÒ²¸æ½ë£¬²»ÄܶÔrownum
ÓÃ">"£¬ÕâÒ²¾ÍÒâζ×Å£¬Èç¹ûÄãÏëÓÃ
select * from emp
where row ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ