oracleµÄ·ÖÒ³¼¼Êõ
֮ǰÔÚÏîÄ¿ÖÐÓõ½µÄ·ÖÒ³¶¼ÊǼٷÖÒ³£¬Ò²¾ÍÊÇÏÈ´ÓÊý¾Ý¿âÖаÑËùÓеÄÊý¾Ý¶¼²éѯ³öÀ´È»ºóÔÚ°ó¶¨Ê±½øÐзÖÒ³¡£ÕâÊÇÒ»ÖÖ¼Ù·ÖÒ³£¬Ð§Âʽϵͣ¬Ç°¼¸ÌìÌýÆäËûÏîÄ¿×é˵ËûÃÇҪʹÓÃÊý¾Ý¿âµÄ´æ´¢¹ý³ÌÀ´ÊµÏÖ·ÖÒ³£¬¸Ð¾õºÜÒÉ»ó£¬ÄѵÀʹÓÃÊý¾Ý¿â»¹¿ÉÒÔʵÏÖ·ÖÒ³¹¦ÄÜ£¿ÏÐÀ´ÎÞÊ£¬¾Í´ÓÍøÉÏËÑÁËËÑ×ÊÁÏ£¬¹ûÈ»£¬ÔÚoracleÖÐÊÇÓзÖÒ³¼¼ÊõµÄ£¬Ê¹ÓÃrownum¾Í¿ÉÒÔʵÏÖ¡£°¦£¬¿ÉÕæÊǹª¹ÑÎÅ°¡¡£Á¬Õâ¸ö¶¼²»ÖªµÀ¡£¿´À´×Ô¼ºÒªÑ§Ï°µÄ»¹Óкܶడ¡£
ÔÚÍøÉÏ¿´µ½Ò»Æª²©¿Í£¬½²oracleµÄrownum¡£¾õµÃͦ²»´í£¬ÏÈ°ÑÍøÖ·¼ÇÏÂÀ´ÒÔ±¸²é¡£
http://blog.csdn.net/mitedu/archive/2008/12/23/3584399.aspx
Ïà¹ØÎĵµ£º
oracle Êý¾Ý¿âµÄά»¤
¿ì¹ýÄêÁË£¬¸÷¼Ò¹«Ë¾¶¼Òª×¼±¸·Å¼ÙÁË£¬¸ø×Ô¼ºµÄÊý¾Ý¿â×ö¸öÌå¼ì°É£¬Ð´¸ö±¨¸æÖ®ÀàµÄ£¬ºÇºÇ¡£
¿´Á˸ö±ðÈËдµÄ ÏÈÄÃÀ´´æ×Å ÓпÕ×Ô¼º±à¸ö¡£
ÔØ×ÔoracleÖÐÎļ¼ÊõÂÛ̳¡£´ÓÕûÌåÉϽéÉÜÁËÒ»¸ödbaµÄÖ°ÔðºÍÈÎÎñµÈµÈ¡£¡¡¡¡
ORACLEÊý¾Ý¿â¹ÜÀíÔ±Ó¦°´ÈçÏ·½Ê½¶ÔORACLEÊý¾Ý¿âϵͳ×ö¶¨ÆÚ¼à¿Ø£ ......
MySQL:
SELECT column from table
ORDER BY RAND()
LIMIT 1
PostgreSQL:
SELECT column from table
ORDER BY RANDOM()
LIMIT 1
Microsoft SQL Server:
SELECT TOP 1 column from table
ORDER BY NEWID()
IBM DB2
SELECT column, RAND() as IDX
from table
ORDER BY IDX FETCH FIRST 1 ROWS ONLY
Thanks Ti ......
OracleÊý¾Ý¿â10g schedule jobµÄ³£ÓòÙ×÷:
-- job ȨÏÞ
grant create job to somebody;
-- job ´´½¨
begin
dbms_scheduler.create_job (
job_name => 'AGENT_LIQUIDATION_JOB',
job_type => 'STORED_PROCEDURE',
job_action => 'AGENT_LIQUIDATION.LIQUIDATION', --´æ´¢¹ý³ÌÃû
start_date => ......
½ñÌìͬÊÂÓöµ½ÁËÒ»¸öÎÊÌ⣬ÔÒòÊÇrownumµÄÎÊÌâ¡£
ÏÂÃæתһƪÎÄÕ£º
¶ÔÓÚOracleµÄrownumÎÊÌ⣬ºÜ¶à×ÊÁ϶¼Ëµ²»Ö§³Ö>£¬>=£¬=£¬between……and£¬Ö»ÄÜÓÃÒÔÉÏ·ûºÅ£¨<¡¢& lt;=¡¢£¡=£©£¬²¢·Ç˵ÓÃ>£¬>=£¬=£¬between……and ʱ»áÌáʾSQLÓï·¨´íÎ󣬶øÊǾ³£ÊDz鲻³öÒ»Ìõ¼Ç¼À´£¬»¹»á³öÏÖË ......