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

oracle ͳ¼ÆÿÔÂÀÛ»ý¹ºÂòÈËÊý

oracle ¿ÉÓÐʲô·½·¨ ͳ¼ÆÿÔÂÀÛ»ý¹ºÂòÈËÊý
±ÈÈç˵ÓиöÃŵê 2008Ä깺ÂòÉÌÆ·µÄÈËÊý
±í:t_buy_log  ×ֶΠf_username Óû§Ãû³Æ;¹ºÂòʱ¼äf_buytime

1 Èç¹ûÊÇͳ¼ÆÿÔ¹ºÂòÈËÊý
select to_char(f_buytime,'yyymm'),count(distinct f_username)
from t_buy_log
group by to_char(f_buytime,'yyymm')
order by to_char(f_buytime,'yyymm') asc

½á¹û:
1ÔÂ 100ÈË
2ÔÂ 150ÈË
3ÔÂ 50ÈË

2 Èç¹ûͳ¼ÆÿÔÂÀÛ»ý¹ºÂòÈËÊý ?
1ÔÂ 100ÈË
2Ô ÊÇ1ÔºÍ2ÔµĹºÂòÈËÊý ¿Í»§ÓÐÖظ´ ÖµÔÚ100-250Ö®¼ä
3Ô ÊÇ1-3ÔµĹºÂòÈËÊý

Õâ¸ö¸ÃÔõôдÄØ?
Ó÷ÖÎöº¯ÊýµÄSUM ºÃÏñ²»ÐÐ
1-1
select to_char(f_buytime,'yyymm'),count(distinct f_username)
from t_buy_log
WHERE to_char(f_buytime,'yyymm')='200901'

1-2
select to_char(f_buytime,'yyymm'),count(distinct f_username)
from t_buy_log
WHERE to_char(f_buytime,'yyymm') between '200901'  and '200902'


1-3
select to_char(f_buytime,'yyymm'),count(distinct f_username)
from t_buy_log
WHERE to_char(f_buytime,'yyymm') between '200901'  and '200903'
Create Table t_tmp_test As
select oldtable.tm,
(
 select/*+parallel(t,20)*/ count(distinct f_username)
 from t_Base_Prouser_Suc t where to_char(f_Expectenddate, 'yyyyMM') <= oldtable.tm
 And t.f_Source In ( Select f_buymodeid from T_base_Flat_Type Where f_department = 1)
 ) rs
from
(
select   to_char(add_months(to_date('2007-01-01','YYYY-MM-DD'),(Level-1)),'yyyymm') tm       
from dual
connect by level < months_between(to_date('2009-12-01','YYYY-MM-DD'),to_date('2007-01-01','YYYY-MM-DD'))+1
) oldtable


Ïà¹ØÎĵµ£º

ORACLEÖд¥·¢DBWR½ø³ÌµÄʼþ~

½ñÌìÔÚÒ»±¾ÊéÉÏ¿´µ½µÄ£¬¸Ð¾õͦȫµÄ¡£Ó¡ÏóÖÐ×Ô¼ºÒѾ­²»ÖªµÀ°Ù¶ÈÁ˶àÉÙ´ÎÕâ¸öÎÊÌ⣬½ñÌì¾Í¼ÇÏÂÀ´°É£¬·½±ãÒÔºó²éѯ¡£
Êý¾Ý¿âд½ø³ÌÔÚÒÔÏÂʼþÖ®Ò»·¢Éúʱ°ÑÊý¾Ý¿â¸ßËÙ»º³åÇøµÄÊý¾Ýдµ½Êý¾ÝÎļþÉÏ:
µ±Ô໺³åÇøµÄÊýÁ¿³¬¹ýÁËËùÉ趨µÄÏÞ¶î
µ±ËùÉ趨µÄʱ¼ä¼ä¸ôÒѵ½
µ±Óнø³ÌÐèÒªÊý¾Ý¿â¸ßËÙ»º³åÇøÈ´ÕÒ²»µ½¿ÕÏеĻº³åÇøʱ
µ±¼ì²éµ ......

OracleÒÆÖ²µ½MySQL×¢ÒâÊÂÏî

¡¡¡¡¿Í»§ÓõÄÊý¾Ý¿âÊÇmysql£¬¶øÑз¢ºÃµÄ²úÆ·Ö§³Öoracle£¬ÎªÁËÈÿͻ§ÌÍÑü°ü£¬ÎÒÃDZØÐë°ÑÊý¾Ý¿â»·¾³´ÓoracleתÏòmysql¡£ÎÒÃÇÔÚת»»µÄ¹ý³ÌÖÐÅöµ½ÁËÏÂÃæһЩÎÊÌ⣬ϣÍûÄܸøͬÑùÔâÓöµÄͬÈÊÃÇһЩ½è¼ø¡£Èç¹ûÎÒÃÇÔÚ×î³õµÄÉè¼Æ¡¢±àÂë¹ý³ÌÖÐ×¢ÒâÊý¾Ý¿âµÄÒÆÖ²ÐÔ£¬ÕâÖÖÇé¿öÏ¿ÉÒÔÍêÈ«²»ÐèÒª×÷¶îÍ⹤×÷¡£
¡¡¡¡Ò»¡¢Êý¾Ý¿â»·¾³´Óoracleת ......

oracle¶¨Ê±Ö´Ðд洢¹ý³ÌµÄjob

±¾ÎÄתÔØ:http://blog.csdn.net/flm_0722/archive/2009/10/08/4643566.aspx
Ò»¡¢ÉèÖóõʼ»¯²ÎÊý job_queue_processes
¡¡¡¡sql> alter system set job_queue_processes=n;£¨n>0£©
¡¡¡¡job_queue_processes×î´óֵΪ1000
¡¡¡¡
¡¡¡¡²é¿´job queue ºǫ́½ø³Ì
¡¡¡¡sql>select name,description from v$bgprocess;
......

oracle sequenceÖµÖØÖûØ1

declare 
  n   number(10); 
  tsql   varchar2(100); 
  begin 
  select   test_seq.nextval   into   n   from   dual; 
  n:=-(n-1); 
  tsql:='alter   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ