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

OracleǧÍòÌõ¼Ç¼²åÈëÓë²éѯС½á

 
×î½ü×öÁ˸öÏîÄ¿£¬ÊµÏÖ¶Ô´æÔÚǧÍòÌõ¼Ç¼µÄ¿â±í½øÐвåÈë¡¢²éѯ²Ù×÷¡£Ô­ÒÔΪ¶ÔÊý¾Ý¿âµÄ²åÈë¡¢²éѯÊǼþºÜÈÝÒ×µÄÊ£¬¿É²»Öªµ±Êý¾Ý´ïµ½°ÙÍòÉõÖÁǧÍòÌõ¼¶±ðµÄʱºò£¬ÕâÒ»ÇÐËƺõ±äµÃÏ൱À§ÄÑ¡£¼¸¾­ÕÛÌÚ£¬×ÜËãÍê³ÉÁËÈÎÎñ¡£
¡¡¡¡1¡¢±ÜÃâʹÓÃHibernate¿ò¼Ü
¡¡¡¡HibernateÓÃÆðÀ´ËäÈ»·½±ã£¬µ«¶ÔÓÚº£Á¿Êý¾ÝµÄ²Ù×÷ÏÔµÃÁ¦²»´ÓÐÄ¡£
¡¡¡¡¹ØÓÚ²åÈ룺
¡¡¡¡ÊÔ¹ýÓÃHibernateÒ»´ÎÐÔ½øÐÐ5ÍòÌõ×óÓÒÊý¾ÝµÄ²åÈ룬ÈôIDʹÓÃsequence·½Ê½Éú³É£¬Hibernate½«·Ö5Íò´Î´ÓÊý¾Ý¿âÈ¡µÃ5Íò¸ösequence£¬¹¹Ôì³ÉÏàÓ¦¶ÔÏóºó£¬ÔÙ·ÖÎåÍò´Î½«Êý¾Ý±£´æµ½Êý¾Ý¿â¡£»¨ÁËÎÒÊ®·ÖÖÓʱ¼ä¡£Ö÷ÒªµÄʱ¼ä²»ÊÇ»¨ÔÚ²åÈëÉÏ£¬¶øÊÇ»¨ÔÚ5Íò´Î´ÓÊý¾Ý¿âÈ¡sequenceÉÏ£¬ÅªµÃÎÒÏ൱ÓôÃÆ¡£ËäÈ»ºóÀ´°ÑIDÉú³É·½Ê½¸Ä³Éincrease½â¾öÁËÎÊÌ⣬µ«»¹ÊǶÔÄÇÊ®·ÖÖӵĵȴýÐÄÓÐÓà¼Â¡£
¡¡¡¡¹ØÓÚ²éѯ£º
¡¡¡¡Hibernate¶ÔÊý¾Ý¿â²éѯµÄÖ÷Ҫ˼Ï뻹ÊÇÃæÏò¶ÔÏóµÄ£¬Õ⽫ʹÐí¶àÎÒÃDz»ÐèÒª²éѯµÄÊý¾ÝÕ¼ÓÃÁË´óÁ¿µÄϵͳ×ÊÔ´£¨°üÀ¨Êý¾Ý¿â×ÊÔ´ºÍ±¾µØ×ÊÔ´£©¡£ÓÉÓÚ¶ÔHibernateµÄÆ«°®£¬±¾×Ų»Å×Æú¡¢²»·ÅÆúµÄ×÷·ç£¬×öÁË°üÀ¨ÅäSQL£¬¸Ä½øSQLµÈµÈµÄÏ൱¶àµÄ³¢ÊÔ£¬¿É¶¼ÒÔʧ°Ü¸æÖÕ£¬²»µÃ²»ÈÌÍ´¸î°®ÁË¡£
¡¡¡¡2¡¢Ð´²éѯÓï¾äʱ£¬Òª°Ñ²éѯµÄ×Ö¶ÎÒ»Ò»Áгö
¡¡¡¡²éѯʱ²»ÒªÊ¹ÓÃÀàËÆselect * from x_tableµÄÓï¾ä£¬Òª¾¡Á¿Ê¹ÓÃselect id,name from x_table£¬ÒÔ±ÜÃâ²éѯ³ö²»ÐèÒªµÄÊý¾ÝÀË·Ñ×ÊÔ´¡£¶ÔÓÚº£Á¿Êý¾Ý¶øÑÔ£¬Ò»¸ö×Ö¶ÎËùÕ¼ÓõÄ×ÊÔ´ºÍ²éѯʱ¼äÊÇÏ൱¿É¹ÛµÄ¡£
¡¡¡¡3¡¢¼õÉÙ²»±ØÒªµÄ²éѯÌõ¼þ
¡¡¡¡µ±ÎÒÃÇÔÚ×ö²éѯʱ£¬³£³£ÊÇǰ̨Ìá½»Ò»¸ö²éѯ±íµ¥µ½ºǫ́£¬ºǫ́½âÎöÕâ¸ö±íµ¥£¬¶øºó½øÐвéѯ²Ù×÷¡£ÔÚÎÒÃǽâÎö±íµ¥Ê±£¬ÎªÁË·½±ãÆð¼û£¬³£³£Ï²»¶½«Ò»Ð©²»ÐèÒª²éѯµÄÌõ¼þÓÃÓÀÕæµÄÌõ¼þÀ´´úÌ棨È磺select count(id) from x_table where name like ‘%’£©£¬ÆäʵÕâÑùµÄSQL¶Ô×ÊÔ´µÄÀË·ÑÊÇÏ൱¿Éŵġ£ÎÒÊÔ¹ý¶ÔÓÚͬÑùµÄ½üһǧÍòÌõ¼Ç¼µÄ²éѯÀ´Ëµ£¬Ê¹ÓÃselect count(id) from x_table ½øÐбí²éѯÐèÒª11Ã룬¶øʹÓÃselect count(id) from x_table where name like ‘%’È´»¨ÁË33Ãë¡£
¡¡¡¡4¡¢±ÜÃâÔÚ²éѯʱʹÓñíÁ¬½Ó
¡¡¡¡ÔÚ×öº£Á¿Êý¾Ý²éѯʱ£¬Ó¦¾¡Á¿±ÜÃâ±íÁ¬½Ó£¨ÌرðÊÇ×ó¡¢ÓÒÁ¬½Ó£©£¬Íò²»µÃÒÑÒª½øÐбíÁ¬½Óʱ£¬±»Á¬½ÓµÄÁíÒ»ÕűíÊý¾ÝÁ¿Ò»¶¨²»ÄÜÌ«´ó£¬ÈôÁ¬½ÓµÄÁíÒ»ÕűíÒ²ÊÇÊýÍòÌõµÄ»°£¬ÄǹÀ¼Æ¿ÉÒÔ¿¼ÂÇÖØÐÂÉè¼Æ¿â±íÁË£¬ÒòΪÄÇÐèÒªµÈ´ýµÄʱ¼ä¾ö²»ÊÇÕý³£Óû§ËùÄÜÈÌÊܵġ£
¡¡¡¡5¡¢Ç¶Ìײéѯʱ£¬¾¡¿ÉÄܵØÔÚµÚÒ»´Îselect¾Í°Ñ²éѯ·¶Î§Ëõµ½×îС
¡¡¡¡ÔÚÓÐ


Ïà¹ØÎĵµ£º

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

1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
    ²ÎÊý1 IN NUMBER,
    ²ÎÊý2 IN NUMBER
) IS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
2.SELECT INTO STATEMENT
  ½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ì ......

Oracle Connect ByÓ÷¨

Oracle Connect ByÓ÷¨
 
oracleÖеÄselectÓï¾ä¿ÉÒÔÓÃSTART WITH...CONNECT BY PRIOR×Ó¾äʵÏֵݹé²éѯ£¬connect by Êǽṹ»¯²éѯÖÐÓõ½µÄ£¬Æä»ù±¾Óï·¨ÊÇ£º
select ... from <TableName>
where <Conditional-1>
start with <Conditional-2>
connect by <Conditional-3>
;
<Conditi ......

ORACLE´ø²ÎÈ«Á¬½Ó

    
  select * from (
  select cw2.NO WHOLENO,sp1.ARGUMENTNAME TYPENAME,sp2.ARGUMENTNAME BRANDNAME,sp3.ARGUMENTNAME STYLENAME,sp4.ARGUMENTNAME DEPART,so.OPERATORNAME USERNAME
  from COM_WHOLE_INFO cw2,SYS_OPERATOR so, SYS_PUBLICARGUMENT sp1, SYS_PUBLICARGUMEN ......

¡¾×ª¡¿ ORACLE ·ÖÇø±í PARTITION table

ORACLE ·ÖÇø±í PARTITION table
http://blog.chinaunix.net/u/6889/showart_315897.html
1.1 ·ÖÇø±íPARTITION table
ÔÚORACLEÀïÈç¹ûÓöµ½Ìرð´óµÄ±í£¬¿ÉÒÔʹÓ÷ÖÇøµÄ±íÀ´¸Ä±äÆäÓ¦ÓóÌÐòµÄÐÔÄÜ¡£
1.1.1 ·ÖÇø±íµÄ½¨Á¢£º
ij¹«Ë¾µÄÿÄê²úÉú¾Þ´óµÄÏúÊۼǼ£¬DBAÏò¹«Ë¾½¨Òéÿ¼¾¶ÈµÄÊý¾Ý·ÅÔÚÒ»¸ö·ÖÇøÄÚ£¬ÒÔÏÂʾ·¶µÄÊǸù«Ë¾1 ......

ORACLEÐÔÄÜÕï¶ÏʵÀý ÐÐǨÒƺÍÐÐÁ´½Ó

ÃÀ¹úPVH DB´æÔÚÐÐÁ´½Ó.ͨ¹ýÎҵļì²é,·¢ÏÖ,ÎÒÃǵÄDBͬÑù´æÔÚÐÐǨÒƺÍÐÐÁ´½Ó.ORACLEµÄdbms_stats.gather_schema_statsÖ»»áÊÕ¼¯ÓÅ»¯Æ÷ͳ¼ÆÐÅÏ¢,²»»á¼ì²â±íµÄ¼Ç¼ÊÇ·ñ´æÔÚÐÐǨÒƺÍÐÐÁ´½Ó.(ÎÒÔ­Ïȱ»Õâ¸ö°ü¸øÆ­ÁË,ËùÒÔÖ´ÐÐÍêdbms_stats.gather_schema_statsºóÒ»²éÊý¾Ý×Öµä:USER_TABLES,ÆäÖеÄ×Ö¶Îchain_cntֵȫΪ0).Òª¼ì²â±íµÄ¼Ç ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ