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

ORACLE°ó¶¨±äÁ¿µÄʹÓà ժ³­×ÔһƬÌû×Ó

±¾ÎÄÀ´×Ôhttp://www.cnblogs.com/rootq/articles/1177562.html
Oracle Êý¾Ý¿âµÄ°ó¶¨±äÁ¿ÌØÐÔ¼°Ó¦ÓÃ
¹Ø¼ü´Ê:
°ó¶¨±äÁ¿(binding variable),¹²Ïí³Ø(shared buffer pool), SGA(system global area);
ÔÚ¿ª·¢Ò»¸öÊý¾Ý¿âϵͳǰ,ÓÐË­¶ÔOracle ϵͳÁ˽âºÜ¶à,ÓÈÆäÊÇËüµÄÌØÐÔ,ºÃÏóºÜÉÙ°É;¶Ô³õѧÕßÀ´½²,Õâ¸üÊDz»¿ÉÄܵÄÊÂÇé;½ö½ö¼òµ¥ÕÆÎÕÁËSQLµÄд·¨,¾Í¿ªÊ¼ÁËÊý¾Ý¿âµÄ¿ª·¢,Æä½á¹ûÖ»ÄÜÊÇ¿ª·¢Ò»¸öûÓÐЧÂÊ,ҲûÓпÉÀ©Õ¹µÄϵͳ;
Òò´Ë,ÎÒдÕâ¸öÖ÷ÌâÒ²ÊÇÏ£ÍûÈôó¼Ò¸ü¶àµØÕÆÎÕOracleÊý¾Ý¿âµÄÌØÐÔ,´Ó¶øÔڼܹ¹Ò»¸öÐÂϵͳʱ,ÄÜ¿¼ÂÇϵͳµÄ¿ÉÀ©Õ¹,¿ÉÉìËõÐÔ,Ò²¼æ¹ËϵͳµÄЧÂʺÍÎȶ¨;
ʹÓð󶨱äÁ¿ÊÇOracleÊý¾Ý¿âµÄÌØÐÔÖ®Ò»;ÓÚÊÇ´ó¼ÒÒªÎÊ,ΪʲôʹÓÃ,ÔõÑùʹÓÃ,ËüµÄʹÓÃÏÞÖÆÌõ¼þÊÇʲô?ÎһᰴÕÕÕâÑùµÄÏ뷨ȥ½â´ð´ó¼ÒµÄÒÉÎÊ,ÎÒÒ²»áÒÔ¾ÙÀý×ӵķ½Ê½À´»Ø´ðÕâЩÎÊÌâ;
1. ΪʲôʹÓð󶨱äÁ¿?
ÕâÊǽâ¾öOracleÓ¦ÓóÌÐò¿ÉÉìËõÐÔµÄÒ»¸ö¹Ø¼ü»·½Ú;¶øOracleµÄ¹²Ïí³Ø¾Í¾ö¶¨ÁË¿ª·¢ÈËÔ±±ØÐëʹÓð󶨱äÁ¿;Èç¹ûÏëÒªOracle ÔËÐмõÂý,ÉõÖÁÍêÈ«ÖÕÖ¹,ÄǾͿÉÒÔ²»Óð󶨱äÁ¿;
ÕâÀï¾ÙÀý˵Ã÷ÉÏÊöÎÊÌâ;
ΪÁ˲éѯһ¸öÔ±¹¤´úºÅÊÇ123,Äã¿ÉÒÔÕâÑù²éѯ:
select * from emp where empno=’123’;
ÄãÒ²¿ÉÒÔÕâÑù²éѯ:
select * from emp where empno=:empno;
ÏóÎÒÃÇÍù³£Ò»Ñù,Äã²éѯԱ¹¤’123’Ò»´ÎÒÔºó,ÓпÉÄÜÔÙÒ²²»ÓÃ;½Ó×ÅÄãÓпÉÄܲéѯԱ¹¤’456’,È»ºó²éѯ’789’µÈµÈ;Èç¹û²éѯʹÓÃÏóµÚÒ»¸ö²éѯÓï¾ä,Äãÿ´Î²éѯ¶¼ÊÇÒ»¸öеIJéѯ(ÎÒÃǽÐËüÓ²±àÂëµÄ²éѯ·½·¨);Òò´Ë,Oracleÿ´Î±ØÐë·ÖÎö,½âÎö,°²È«¼ì²é, ÓÅ»¯µÈµÈ;
µÚ¶þ¸ö²éѯÓï¾äÌṩÁ˰󶨱äÁ¿:empno,ËüµÄÖµÔÚ²éѯִÐÐʱÌṩ,²éѯ¾­¹ýÒ»´Î±àÒëºó,²éѯ·½°¸´æ´¢ÔÚ¹²Ïí³ØÖÐ,¿ÉÒÔÓÃÀ´¼ìË÷ºÍÖØÓÃ;ÔÚÐÔÄܺÍÉìËõÐÔ·½Ãæ,ÕâÁ½ÕߵIJîÒìÊǾ޴óµÄ,ÉõÖÁÊǾªÈ˵Ä;ͨË׵㽲,¾Í²»ÊÇÒ»¸ö¼¶±ð;
µÚÒ»¸ö²éѯʹÓõÄƵÂÊÔ½¸ß,ËùÏûºÄµÄϵͳӲ¼þ×ÊÔ´Ô½´ó,´Ó¶ø½µµÍÁËÓû§µÄʹÓÃÊýÁ¿;ËüÒ²»á°ÑÓÅ»¯ºÃµÄÆäËü²éѯÓï¾ä´Ó¹²Ïí³ØÖÐÌß³ö;¾ÍÏóÒ»¸öÀÏÊó»µÁËÒ»¹øÌÀËƵÄ,ϵͳµÄÕûÌåÐÔÄܽµµÍ; ¶øÖ´Ðа󶨱äÁ¿,Ìá½»Ïàͬ¶ÔÏóµÄÍêÈ«ÏàͬµÄ²éѯµÄÓû§(Õâ¾ä»°,´ó¼ÒÌýÆðÀ´±È½ÏÄÑÀí½â,ËæºóÎÒ»á¸ø³öÏêϸµÄ½âÊÍ),Ò»´ÎÐÔʹÓþͿÉÖظ´Ê¹ÓÃ,ÆäЧÂʲ»ÑÔ¶úÓï; ´ò¸öÐÎÏóµÄ±ÈÓ÷À´Ëµ,µÚÒ»¸ö²éѯ¾ÍÏóÒ»´ÎÐÔʹÓõĿê×Ó,¶øµÚ¶þ¸ö²éѯÏóÊÇÌú¿ê×Ó,ֻҪϴ¸É¾»,ÕÅÈýÀîËĶ¼ÄÜÓÃ,ºÏÀíÓÐЧµØʹÓÃÁË×ÊÔ´;
ÏÂÃæ¾ÙÀý×ÓÈ¥ÏêϸÂÛÖ¤ÉÏÊöµÄÎÊÌâ,²»Ê¹Óð󶨱äÁ¿ÎªÉú²¡×´¿ö:
ÕâÊÇÒ»¸öÎ


Ïà¹ØÎĵµ£º

oracle¡¢proxool¡¢hibernateʹÓÃ×ܽá

¿ªÊ¼ÔÚmyeclipse6.5ÖÐDB BROWERн¨ÁËÒ»¸öÊý¾Ý¿âÁ¬½Ó£¬Èçͼ£º
Ò»Á¬½Ó£¬±¨³öÁËÁ½¸ö´íÎó£º
1. ORA-00604 error occurred at recursive SQL level string.
2.ORA-12705: invalid or unknown NLS parameter value.
²é×ÊÁϺó½â¾ö£¨ÆÚ¼äÎÒ»¹¸Ä¹ýtestÓû§µÄÁ¬½ÓȨÏÞ£©£º
½«MyEclipseÖÐeclipseĿ¼ÏµÄeclipse.iniÎļþ£¬° ......

oracleѧϰ±Ê¼Ç2 ±íµÄ»ù±¾²Ù×÷

Oracle±íµÄ¹ÜÀí
±íÃûºÍÁÐÃûµÄÃüÃû¹æÔò£º
1±ØÐëÒÔ×Öĸ¿ªÍ·
2³¤¶È²»Äܳ¬¹ý30¸ö×Ö·û
3²»ÄÜʹÓÃOracleµÄ±£Áô×Ö
4Ö»ÄÜʹÓÃÈçÏÂ×Ö·û£ºA-Z,a-z,0-9,$,#µÈ
OracleÖ§³ÖµÄÊý¾ÝÀàÐÍ£º
1char ¶¨³¤£¬×î´ó2000×Ö·û
Àý×Ó£ºchar(10) ‘Ïþ»Ô’ Ç°Ëĸö×Ö·û·Å’Ïþ»Ô’£¬ºóÌíÁù¸ö¿Õ¸ñ²¹È«
2varchar2(20) ±ä³¤£¬×î´ ......

oracleÐÐÁÐת»»£¨×ª£©

1¡¢¹Ì¶¨ÁÐÊýµÄÐÐÁÐת»»
Èç
student subject grade
--------- ---------- --------
student1 ÓïÎÄ 80
student1 Êýѧ 70
student1 Ó¢Óï 60
student2 ÓïÎÄ 90
student2 Êýѧ 80
student2 Ó¢Óï 100
……
ת»»Îª
ÓïÎÄ Êýѧ Ó¢Óï
student1 80 70 60
student2 90 80 100
……
Óï¾äÈçÏ£ºs ......

oracle cursor ÓαêÓ÷¨

Óα꣺
ÓÃÀ´²éѯÊý¾Ý¿â£¬»ñÈ¡¼Ç¼¼¯ºÏ£¨½á¹û¼¯£©µÄÖ¸Õ룬¿ÉÒÔÈÿª·¢ÕßÒ»´Î·ÃÎÊÒ»Ðнá¹û¼¯£¬ÔÚÿÌõ½á¹û¼¯ÉÏ×÷²Ù×÷¡£
·ÖÀࣺ
¾²Ì¬Óα꣺
·ÖΪÏÔʽÓαêºÍÒþʽÓαꡣ
REFÓα꣺
ÊÇÒ»ÖÖÒýÓÃÀàÐÍ£¬ÀàËÆÓÚÖ¸Õë¡£
ÏÔʽÓα꣺
 CURSOR ÓαêÃû ( ²ÎÊý ) [·µ»ØÖµÀàÐÍ] IS
  Select Óï¾ä
ÉúÃüÖÜÆÚ£º
1.´ò¿ªÓαê(OP ......

һЩoracleµÄÃüÁî¼°º¯Êý °üÀ¨decodeµÈ


 1¡¢set linesize 100;  ÉèÖó¤¶È   
 2¡¢set pagesize 30;   ÉèÖÃÿҳÏÔʾÊýÄ¿   
 3¡¢em a.sql  ´ò¿ª¼Çʱ¾     
 4¡¢@ a Ö´ÐÐÎļþaÖеĴúÂ룬¿ÉÖ¸¶¨ÎļþµÄ·¾¶ @d:a.txt ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ