ÈçºÎ×¥µ½jdbcÁ¬½ÓµÄËùÖ´ÐеÄsqlÓï¾ä
ÎÒÃÇͨ³£ÔÚ¶¨Î»Êý¾Ý¿âËøÎÊÌâʱ£¬Í¨³£Ï£ÍûÕÒµ½Äĸö½ø³Ì·¢³öÁËÄĸöÓï¾ä£¬ËøסÁËÄÄÕÅ±í£¬Ò»°ãÎÒÃÇͨ¹ý²év$lock£¬È»ºóÕÒµ½sid,ÔÙµ½v$sesionÀïÕÒµ½Õâ¸ö½ø³ÌµÄhash_value»òpre_hash_value,È»ºó¸ù¾Ýhash_value¶¨Î»µ½¾ßÌåµÄÓï¾ä¡£
¿ÉÊÇ£¬ÎÒÃÇ·¢ÏÖ£¬Í¨¹ýJDBCÁ¬½ÓÉÏÀ´µÄ½ø³Ì£¬ËüµÄhash_valueÊÇ0,ËùÒÔÎÒÃǾÍÎÞ·¨¶¨Î»Õâ¸ö½ø³ÌÖ´ÐеÄÓï¾äÁË£¬²»¹ýÔÚoracle 10gÖ®ºó£¬ÔÚv$sessionÀïÃæ¶àÁ˸ösql_id×ֶΣ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÕâ¸ö×Ö¶ÎÀ´²é¾ßÌåÓï¾ä¡£ÔÚ9i¼°Ö®Ç°µÄ°æ±¾¾Íû°ì·¨ÁË¡£¿ªÁ˸öoracle·þÎñÇëÇó£¬oracle¹¤³ÌʦҲûÓиø³ö´ð°¸¡£ÌṩһÏÂÓï¾ä£º
10gÖ®ºó£¬¿ÉÒÔ£º
col sess format a15;
SELECT DECODE(request,0,'Holder: ','Waiter: ')||sid sess,
id1, id2, lmode, request, type,block,ctime
from V$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type from V$LOCK WHERE request>0)
ORDER BY id1, request;
/
select sql_text from v$sqlarea where sql_id in
(select sql_id from v$session where sid=&1);
Ïà¹ØÎĵµ£º
select * from orders where month(orderdate)= (select month(orderdate) from orders where orderid=10248)
1.Ò»¸öÔµÚÒ»ÌìµÄ
Select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
2.±¾ÖܵÄÐÇÆÚÒ»
Select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
3.Ò»ÄêµÄµÚÒ»Ìì
Select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
......
Update Channel set Unit ='mg' ,
RunUpThreshold='10' ,
RunDownThreshold='10' ,
SafetyUpThreshold='10' ,
SafetyDownThreshold='10'
where Bridge='001' and DeviceCode='AS'
and SensorCode='001' and Supplement='N'
set £º ','
where: and ......
Join²Ù×÷·û
ÊÊÓó¡¾°£ºÔÚÎÒÃDZí¹ØϵÖÐÓÐÒ»¶ÔÒ»¹Øϵ£¬Ò»¶Ô¶à¹Øϵ£¬¶à¶Ô¶à¹ØϵµÈ¡£¶Ô¸÷¸ö±íÖ®¼äµÄ¹Øϵ£¬¾ÍÓÃÕâЩʵÏÖ¶Ô¶à¸ö±íµÄ²Ù×÷¡£
˵Ã÷£ºÔÚJoin²Ù×÷ÖУ¬·Ö±ðΪJoin(Join²éѯ), SelectMany(SelectÒ»¶Ô¶àÑ¡Ôñ)ºÍGroupJoin(·Ö×éJoin²éѯ)¡£
¸ÃÀ©Õ¹·½·¨¶ÔÁ½¸öÐòÁÐÖмüÆ¥ÅäµÄÔªËؽøÐÐinner join²Ù×÷
SelectMany
˵Ã÷£ºÎÒà ......
ͨÅä·û ˵Ã÷
_ ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
% Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
[ ] ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
[^] ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
......