OracleÖеİ󶨱äÁ¿
°ó¶¨±äÁ¿¾ÍÊÇÄܹ»Ìæ´úSQLÓï¾äÖг£Á¿µÄÌæ´ú±äÁ¿
×÷Óãº
°ó¶¨±äÁ¿Ö»ÊÇÆðµ½Õ¼Î»µÄ×÷Óã¬Í¬ÃûµÄ°ó¶¨±äÁ¿²¢²»Òâζ×ÅÔÚËüÃÇÊÇͬÑùµÄ£¬ÔÚ´«µÝʱҪ¿¼ÂǵÄÊÇ´«µÝµÄÖµÓë°ó¶¨±äÁ¿³öÏÖ˳ÐòµÄ¶Ô룬¶ø²»Êǰ󶨱ä Á¿µÄÃû³Æ¡£
°ó¶¨±äÁ¿ÊÇÔÚͨ³£Çé¿öÏÂÄÜÌáÉýЧÂÊ£¬·ÇÕý³£µÄÇé¿öÈçÏ£º
ÔÚ×Ö¶Î(°üÀ¨×ֶμ¯)½¨ÓÐË÷Òý£¬ÇÒ×Ö¶Î(¼¯)µÄ¼¯µÄÊƷdz£´ó£¨Ò²¾ÍÊÇÓиöÖµÔÚ×Ö¶ÎÖгöÏֵıÈÀýÌرðµÄ´ó£©µÄÇé¿öÏ£¬Ê¹Óð󶨱äÁ¿¿ÉÄܻᵼÖ²éѯ¼Æ»®´íÎó£¬Òò¶ø»áʹ²éѯЧÂʷdz£µÍ¡£ÕâÖÖÇé¿ö×îºÃ²»ÒªÊ¹Óð󶨱äÁ¿¡£
oracle ÖУ¬¶ÔÓÚÒ»¸öÌá½»µÄsqlÓï¾ä,´æÔÚÁ½ÖÖ¿ÉÑ¡µÄ½âÎö¹ý³Ì, Ò»ÖÖ½Ð×öÓ²½âÎö,Ò»ÖÖ½Ð×öÈí½âÎö.
ÔÚ¹²Ïí³ØÖдæÔÚµÄÊÇÈí½âÎö£¬¼´£ºÀàËÆÓÚPL/sql
Èí½âÎöºÍ°ó¶¨±äÁ¿£ºselect * from dept where id= :d_id;
oracle»áÊ×Ïȼì²éһϹ²Ïí»º³å³Ø£¨shared pool£©ÀïÓÐûÓÐÓëÖ®ÍêÈ«ÏàͬµÄÓï¾ä£¬Èç¹ûÓеĻ°Ö»ÐëÖ´ÐÐÈí·ÖÎö¼´¿É£¬·ñÔò¾ÍµÃ½øÐÐÓ²·ÖÎö¡£
¶øΨһʹµÃoracle Äܹ»Öظ´ÀûÓÃÖ´Ðмƻ®µÄ·½·¨¾ÍÊDzÉÓð󶨱äÁ¿¡£°ó¶¨±äÁ¿µÄʵÖʾÍÊÇÓÃÓÚÌæ´úsqlÓï¾äÖеij£Á¿µÄÌæ´ú±äÁ¿¡£°ó¶¨±äÁ¿Äܹ»Ê¹µÃÿ´ÎÌá½»µÄsqlÓï¾ä¶¼ÍêÈ«Ò»Ñù¡£
µ«ÊDz¢²»ÊÇÈκÎÇé¿ö϶¼ÐèҪʹÓð󶨱äÁ¿£¬ÏÂÃæÊÇÁ½ÖÖÀýÍâÇé¿ö£º
1£®¶ÔÓÚ¸ôÏ൱һ¶Îʱ¼ä²ÅÖ´ÐÐÒ»´ÎµÄSQLÓï¾ä£¬ÕâÊÇÀûÓð󶨱äÁ¿µÄºÃ´¦»á±»²»ÄÜÓÐЧÀûÓÃÓÅ»¯Æ÷¶øµÖÏû
2£®Êý¾Ý²Ö¿âµÄÇé¿öÏ¡£
°ó¶¨±äÁ¿²»Äܵ±×÷ǶÈëµÄ×Ö·û´®À´Ê¹Óã¬Ö»Äܵ±×÷Óï¾äÖеıäÁ¿À´Óᣲ»ÄÜÓð󶨱äÁ¿À´´úÌæ±íÃû¡¢¹ý³ÌÃû¡¢×Ö¶ÎÃûµÈ.
ÆÕͨsqlÓï¾ä£º
SELECT fname, lname, pcode from cust WHERE id = 674;
SELECT fname, lname, pcode from cust WHERE id = 234;
SELECT fname, lname, pcode from cust WHERE id = 332;
º¬°ó¶¨±äÁ¿µÄsql Óï¾ä£º
SELECT fname, lname, pcode from cust WHERE id = :cust_no;
Sql*plus ÖÐʹÓð󶨱äÁ¿£º
SQL> set timing on
SQL> variable x number;
SQL> exec :x :=8
PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
ÒÑÓÃʱ¼ä: 00: 00: 00.03
SQL> select * from A;
ID
----------
3
5
ÒÑÓÃʱ¼ä: 00: 00: 00.06
SQL> insert into A values(:x);
ÒÑ´´½¨ 1 ÐС£
ÒÑÓÃʱ¼ä: 00: 00: 00.01
SQL> select * f
Ïà¹ØÎĵµ£º
extent--×îС¿Õ¼ä·ÖÅ䵥λ --tablespace management
block --×îСi/oµ¥Î» --segment management
create tablespace james
datafile '/export/home/oracle/oradata/james.dbf'
size 100M ¡¡¡¡¡¡¡¡¡¡¡¡--³õʼµÄÎļþ´óС¡¡
autoextend On¡¡¡¡¡¡¡¡ --×Ô¶¯Ôö³¤
next 10M¡ ......
££Õª×Ô¡¶PB8.0½ø½×ƪ¡·
ÔÚ°²×°ÁËOracle¿Í»§¶Ë³ÌÐòºó£¬ÔÚOracle°²×°Ä¿Â¼ÏÂÓÐÈçÏÂĿ¼ºÍÎļþÊÇÁ¬½ÓOracleÊý¾Ý¿â·þÎñÆ÷Ëù±ØÐèµÄ£º£¨×îºÃ±£³ÖĿ¼²ã´Î¹Øϵ½á¹¹£©
Oracle\BINĿ¼ÒÔ¼°ÏÂÃæµÄËùÓÐDLLÎļþ£¬²¢ÇÒ±£Ö¤Ó¦ÓóÌÐò¿ÉÒÔÕÒµ½¸ÃĿ¼£¬¼´¸ÃĿ¼ ......
SQL ServerÀïµÄ ISNULL Óë Oracle ÖÐµÄ NULLIF²»Í¬:
SQL Server ÖÐÓÐÁ½¸ö²ÎÊý£¬Óï·¨£º
ISNULL(check_expression, replacement_value)
check_expression Óë replacement_value Êý¾ÝÀàÐͱØÐëÒ»ÖÂ
Èç¹û check_expression Ϊ NULL£¬Ôò·µ»Ø replacement_v ......
ºÜ¶àÅóÓÑÔÚJava¿ª·¢ÖУ¬Ê¹ÓÃOracleÊý¾Ý¿âµÄʱºò£¬¾³£»áÅöµ½ÓÐORA-01000: maximum open cursors exceeded.µÄ´íÎó¡£
ʵ¼ÊÉÏ£¬Õâ¸ö´íÎóµÄÔÒò£¬Ö÷Òª»¹ÊÇ´úÂëÎÊÌâÒýÆðµÄ¡£
ora-01000: maximum open cursors exceeded.
±íʾÒѾ´ïµ½Ò»¸ö½ø³Ì´ò¿ªµÄ×î´óÓαêÊý¡£
ÕâÑùµÄ´íÎóºÜÈÝÒ׳öÏÖÔÚJava´úÂëÖеÄÖ÷ÒªÔÒòÊÇ£ºJava´úÂëÔÚÖ´ ......
Êý¾ÝÀàÐÍ
²ÎÊý
ÃèÊö
char(n)
n=1 to 2000×Ö½Ú
¶¨³¤×Ö·û´®£¬n×Ö½Ú³¤£¬Èç¹û²»Ö¸¶¨³¤¶È£¬È±Ê¡Îª1¸ö×Ö½Ú³¤£¨Ò»¸öºº×ÖΪ2×Ö½Ú£©
varchar2(n)
n=1 to 4000×Ö½Ú
¿É±ä³¤µÄ×Ö·û´®£¬¾ßÌ嶨ÒåʱָÃ÷×î´ó³¤¶Èn£¬
ÕâÖÖÊý¾ÝÀàÐÍ¿ÉÒÔ·ÅÊý×Ö¡¢×ÖĸÒÔ¼°ASCIIÂë×Ö·û¼¯(»òÕßEBCDICµÈÊý¾Ý¿âϵͳ½ÓÊܵÄ×Ö·û¼¯±ê×¼)ÖеÄËùÓзûºÅ¡£
Èç¹ ......