oracle cursor_sharing²ÎÊý
ÏÈÀ´¿´¿´¹Ù·½ÎĵµÖжÔÕâ¸ö²ÎÊýµÄ½âÊÍ
CURSOR_SHARING
PropertyDescription
Parameter type
String
Syntax
CURSOR_SHARING = { SIMILAR | EXACT | FORCE }
Default value
EXACT
Modifiable
ALTER SESSION, ALTER SYSTEM
Basic
No
CURSOR_SHARING determines what kind of SQL statements can share the same cursors.
Values:
FORCE
Forces statements that may differ in some literals, but are otherwise identical, to share a cursor, unless the literals affect the meaning of the statement.
SIMILAR
Causes statements that may differ in some literals, but are otherwise identical, to share a cursor, unless the literals affect either the meaning of the statement or the degree to which the plan is optimized.
EXACT
Only allows statements with identical text to share the same cursor.
================================================================================
²ÎÊýcursor_sharingµÄ½âÊÍ
--------------------------------------
Õâ¸ö²ÎÊýµÄÉèÖã¬oracleÊÇΪÁËÂú×ãһЩÒÔÇ°¿ª·¢µÄ³ÌÐò£¬ÀïÃæÓдóÁ¿µÄsimilar statement£¬µ«ÊÇÖØдÓв»ÏÖʵµÄÇé¿öÏÂʹÓõÄÒ»¸ö²ÎÊý¡£
²¢ÇÒoracleÒ²²»½¨ÒéʹÓÃÕâ¸ö²ÎÊý¡£
ʲôʱºòÐèÒªÐÞ¸ÄÕâ¸ö²ÎÊýÄØ£¿ÐèÒªÂú×ãÒÔϵÄÌõ¼þ¡£
Ò»¸öÊÇÓÉÓÚ´óÁ¿µÄshared pool hit missÓ°ÏìÁËÓû§µÄÏìӦʱ¼ä£¨¾ÍÊǵ±Ç°µÄshared poolÎÞ·¨Âú×ã¹²ÏísqlÓï¾ä´æ´¢µÄÐèÒª,Alan:µ±Ç°libary cacheÖÐûÓÐÎÒÃÇËùÐèÒªÖØÓõÄexplainºÍsql£©£¬Èç¹ûûÓÐÕâ¸öÎÊÌ⣬ÄÇôÉèÖÃÕâ¸ö²ÎÊý£¬¿ÉÄÜ»áÔì³É¸üÔã¸âµÄÐÔÄÜ¡£Õâ¸ö²ÎÊýÖ»»á¼õÉÙparseµÄʱ¼ä¡£
ÁíÍâÒ»¸ö¾ÍÊÇÔÚÏÖÓгÌÐòÖÐÓдóÁ¿µÄsimilar statement£¬¿ÉÒÔͨ¹ýÉèÖÃÕâ¸ö²ÎÊýÀ´»ñµÃ±È½ÏºÃµÄÐÔÄÜ¡£
cursor_sharingÕâ¸ö²ÎÊýÓÐÈý¸öÖµ¿ÉÑ¡£¬exact¡¢similar¡¢force¡£µ±ÖµÎªexactʱΪĬÈÏÖµ£¬Ò²ÊÇoracleµÄĬÈÏ´¦Àí·½Ê½¡£¾ÍÊǵ±Ò»¸östatement parseµÄʱºò£¬Ê×Ïȵ½shared poolÇø²é¿´ÊÇ·ñÓÐexact statement´æÔÚ£¨¾ÍÊÇ¿´ÊÇ·ñÔÚshared poolÖÐÓк͵±Ç°Òª½âÎöµÄstatementÍêÈ«Ò»ÑùµÄÓï¾ä´æÔÚ£©£¬Èç¹û²»´æÔÚ£¬¾ÍÖ´ÐÐhard parse
Èç¹û¸Ã²ÎÊýÉèÖÃΪsimilar£¬ÄÇôÈç¹ûÔÚshared poolÖÐÎÞ·¨ÕÒµ½exact statementµÄ´æÔÚµÄʱºò£¬¾Í»áÔÚshared pool½øÐÐÒ»´ÎеIJéÕÒ£¬¾ÍÊDzéÕҺ͵±Ç°Òª½âÎöµÄÓï¾äÊÇ·ñÊÇsimilar statementµÄÓï¾ä¡£ÕâÀïÐèÒª¶Ôsimilar statement½øÐнâÊÍ£¬simila
Ïà¹ØÎĵµ£º
OracleµÄÔ¼Êø
* Èç¹ûij¸öÔ¼ÊøÖ»×÷ÓÃÓÚµ¥¶ÀµÄ×ֶΣ¬¼´¿ÉÒÔÔÚ×ֶ춶¨ÒåÔ¼Êø£¬Ò²¿ÉÒÔÔÚ±í¼¶¶¨ÒåÔ¼Êø£¬µ«Èç¹ûij¸öÔ¼Êø×÷ÓÃÓÚ¶à¸ö×ֶΣ¬
±ØÐëÔÚ±í¼¶¶¨ÒåÔ¼Êø
* ÔÚ¶¨ÒåÔ¼Êøʱ¿ÉÒÔͨ¹ýCONSTRAINT¹Ø¼ü×ÖΪԼÊøÃüÃû£¬Èç¹ûûÓÐÖ¸¶¨£¬ORACLE½«×Ô¶¯ÎªÔ¼Êø½¨Á¢Ä¬ÈϵÄÃû³Æ
¶¨Òåprimary keyÔ¼Êø(µ¥¸ö×ֶΣ©
create table ......
select myFunc(²ÎÊý1,²ÎÊý2..) to dual; --¿ÉÒÔÖ´ÐÐһЩҵÎñÂß¼
Ò»:OracleÖеĺ¯ÊýÓë´æ´¢¹ý³ÌµÄÇø±ð:
A:º¯Êý±ØÐëÓзµ»ØÖµ,¶ø¹ý³ÌûÓÐ.
B:º¯Êý¿ÉÒÔµ¥¶ÀÖ´ÐÐ.¶ø¹ý³Ì±ØÐëͨ¹ýexecuteÖ´ÐÐ.
C:º¯Êý¿ÉÒÔǶÈëµ½SQLÓï¾äÖÐÖ´ÐÐ.¶ø¹ý³Ì²»ÐÐ.
ÆäʵÎÒÃÇ¿ÉÒÔ½«±È½Ï¸´ÔӵIJéѯд³Éº¯Êý.È»ºóµ½´æ´¢¹ý³ÌÖÐÈ¥µ÷ÓÃÕâЩº¯Êý.
¶þ:È ......
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
¸ø³öÕûÊý,·µ»Ø¶ÔÓ¦µÄ×Ö·û;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;
ZH ......
ORDER BY ÅÅÐò
ASC ÉýÐò(ĬÈÏ)
DESC ½µÐò
select * from s_emp order by dept_id , salary desc
²¿ÃźÅÉýÐò£¬¹¤×ʽµÐò
¹Ø¼ü×ÖdistinctÒ²»á´¥·¢ÅÅÐò²Ù×÷¡£
select * from employee order by 1; //°´µÚÒ»×Ö¶ÎÅÅÐò
NULL±»ÈÏΪÎÞÇî´ó¡£order by ¿ÉÒÔ¸ú±ðÃû¡£
select table_name ......
As you may know, Oracle dropped support for Borland Compilers in OCI
some time back. Well, it isn't all that hard to set up again.
I'm running 9i Release 2 Enterprise Edition on this PC at work and I am
using Borland C++ Builder 6 to 'play' with OCI programming - I intend to
build a set of compo ......