OracleµÄ ¼òµ¥ÐÐתÁÐ
Ó¦¸ö±¨±íÒªÇó×ö¸ö
ʱ¼ä ˫ɫÇò£¬ ʤ¸º²Ê¡£¡£¡£¡£¡£
200905 ÏúÁ¿ ÏúÁ¿
200906 ÏúÁ¿ ÏúÁ¿
200907 ÏúÁ¿ ÏúÁ¿
200908 ÏúÁ¿ ÏúÁ¿
Ò»¸öSQL Óï¾äµÃµ½½á¹ûÊÇ£º
f_yearmonth, lot_name,money
200905 ˫ɫÇò 50
200905 ʤ¸º²Ê 100
200906 ˫ɫÇò 60
200906 ʤ¸º²Ê 70
Select f_yearmonth,
Max(decode(f_lotname,'˫ɫÇò',f_money,0)) As "˫ɫÇò",
Max(decode(f_lotname,'¸£²Ê3D',f_money,0)) as "¸£²Ê3D",
Max(decode(f_lotname,'ʤ¸º²Ê',f_money,0)) as "ʤ¸º²Ê",
Max(decode(f_lotname,'ʱʱ²Ê',f_money,0)) as "ʱʱ²Ê",
Max(decode(f_lotname,'ʱʱÀÖ',f_money,0)) as "ʱʱÀÖ",
from
t_tmp_test_A
Group By f_yearmonth
Order By f_yearmonth
¹Ø¼üÓï¾ä£º
Max(decode(f_lotname,'˫ɫÇò',f_money,0)) As "˫ɫÇò",
Group By f_yearmonth
ӦΪ °´Ê±¼äÖØ×éÖ»ÓÐÒ»Ìõ£¬²¢ÇÒÖ»ÓÐÒ»ÌõÊý¾Ý£º 200905 ˫ɫÇò 50
ÄÇô ÓÃMAXȡһÌõÊý¾Ý ¾ÍÊÇ50
decode Òâ˼˵ Èç¹ûÊǑ˫ɫÇò’ È¡¶ÔÓ¦µÄf_money ²¢ÇÒ·ÅÔÚ ÃüÃûΪ "˫ɫÇò"µÄ ÁÐÉÏ¡£
ºÜÏÔÈ» ÕâÁÐÊǹ̶¨£¡
Ïà¹ØÎĵµ£º
1¡¢´¥·¢Æ÷µÄ¸ÅÄî
´¥·¢Æ÷Ò²ÊÇÒ»ÖÖ´øÃûµÄPL/SQL¿é¡£´¥·¢Æ÷ÀàËÆÓÚ¹ý³ÌºÍº¯Êý£¬ÒòΪËüÃǶ¼ÊÇÓµÓÐÉùÃ÷¡¢Ö´ÐкÍÒì³£´¦Àí¹ý³ÌµÄ´øÃûPL/SQL¿é¡£Óë°üÀàËÆ£¬´¥·¢Æ÷±ØÐë´æ´¢ÔÚÊý¾Ý¿âÖв¢ÇÒ²»Äܱ»¿é½øÐб¾µØ»¯ÉùÃ÷¡£
¶ÔÓÚ´¥·¢Æ÷¶øÑÔ£¬µ±´¥·¢Ê¼þ·¢ÉúµÄʱºò¾Í»áÏÔʽµØÖ´Ðиô¥·¢Æ÷£¬²¢ÇÒ´¥·¢Æ÷²»½ÓÊܲÎÊý¡£
´´½¨´¥·¢Æ÷µÄÓï·¨È ......
OracleµÄ·ÖÒ³²éѯÓï¾ä»ù±¾ÉÏ¿ÉÒÔ°´ÕÕ±¾Îĸø³öµÄ¸ñʽÀ´½øÐÐÌ×Óá£
·ÖÒ³²éѯ¸ñʽ£º
SELECT * from
(
SELECT A.*, ROWNUM RN
from (SELECT * from TABLE_NAME) A
WHERE ROWNUM <= 40
)
WHERE RN >= 21
ÆäÖÐ×îÄÚ²ãµÄ²éѯSELECT * from TABLE_NAME±íʾ²»½øÐзҳµÄÔʼ²éѯÓï¾ä¡£ROWNUM <= 40ºÍRN ......
Oracle¹«Ë¾Ðû³ÆÔÚLinuxϰ²×°Oracle9iÊý¾Ý¿âÖÁÉÙÒªÓÐ512MBµÄÄÚ´æºÍÖÁÉÙ1GB»òÕßÁ½±¶
ÄÚ´æ´óСµÄ½»»»¿Õ¼ä£¬¶ÔÓÚϵͳÄÚ´æ´óÓÚ2GBµÄ·þÎñÆ÷£¬½»»»¿Õ¼ä¿ÉÒÔ½éÓÚ2GB—4GBÖ®¼ä¡£
Èç¹ûÊÇΪÁËÔÚһ̨½öÓÐ256MÄÚ´æµÄÆÕͨPC»úÉÏÊÔÓÃOracle9i£¬ÔÚ·ÖÅäÁË1GB×óÓҵĽ»»» ......
Ò»¸ödbÀà ÀàËÆÓÚjdbcµÄÇý¶¯ºÍÁ´½ÓÅäÖÃ
package com.assi;
import org.apache.log4j.jdbc.JDBCAppender;
public class DB extends JDBCAppender {
public DB(){
this.setDriver("oracle.jdbc.driver.OracleDriver");
& ......
¿ÉÒÔÓÃSpotlightÈí¼þ¶ÔÊý¾Ý¿âµÄÔËÐÐ״̬½øÐÐ¼à¿Ø¡£
µ±³öÏÖsessionËøÊ±£¬ÎÒÃÇÒª¼°Ê±½øÐд¦Àí.
1. ²é¿´ÄÄЩsessionËø:
SQLÓï¾ä£ºselect 'alter system kill session '''||sid||','||serial#||''';' from v$session where sid in (select sid from v$lock where block = 1);
SQL> select 'alter system kill sessio ......