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

110¸öOracle ³£Óú¯ÊýµÄ×ܽá3

80¡£LAST
¹¦ÄÜÃèÊö£º´ÓDENSE_RANK·µ»ØµÄ¼¯ºÏÖÐÈ¡³öÅÅÔÚ×îºóÃæµÄÒ»¸öÖµµÄÐУ¨¿ÉÄܶàÐУ¬ÒòΪֵ¿ÉÄÜÏàµÈ£©£¬Òò´ËÍêÕûµÄÓï·¨ÐèÒªÔÚ¿ªÊ¼´¦¼ÓÉÏÒ»¸ö¼¯ºÏº¯ÊýÒÔ´ÓÖÐÈ¡³ö¼Ç¼
SAMPLE£ºÏÂÃæÀý×ÓÖÐDENSE_RANK°´²¿ÃÅ·ÖÇø£¬ÔÙ°´Ó¶½ðcommission_pctÅÅÐò£¬FIRSTÈ¡³öÓ¶½ð×îµÍµÄ¶ÔÓ¦µÄËùÓÐÐУ¬È»ºóÇ°ÃæµÄMAXº¯Êý´ÓÕâ¸ö¼¯ºÏÖÐÈ¡³öнˮ×îµÍµÄÖµ£»LASTÈ¡³öÓ¶½ð×î¸ßµÄ¶ÔÓ¦µÄËùÓÐÐУ¬È»ºóÇ°ÃæµÄMINº¯Êý´ÓÕâ¸ö¼¯ºÏÖÐÈ¡³öнˮ×î¸ßµÄÖµ
SELECT last_name, department_id, salary,
MIN(salary) KEEP (DENSE_RANK FIRST ORDER BY commission_pct)
OVER (PARTITION BY department_id) "Worst",
MAX(salary) KEEP (DENSE_RANK LAST ORDER BY commission_pct)
OVER (PARTITION BY department_id) "Best"
from employees
WHERE department_id in (20,80)
ORDER BY department_id, salary;
LAST_NAME DEPARTMENT_ID SALARY Worst Best
------------------------- ------------- ---------- ---------- ----------
Fay 20 6000 6000 13000
Hartstein 20 13000 6000 13000
Kumar 80 6100 6100 14000
Banda 80 6200 6100 14000
Johnson 80 6200 6100 14000
Ande 80 6400 6100 14000
Lee 80 6800 6100 14000
Tuvault 80 7000 6100 14000
Sewall 80 7000 6100 14000
Marvins 80 7200 6100 14000
Bates 80 7300 6100 14000
.
81¡£LAST_VALUE
¹¦ÄÜÃèÊö£º·µ»Ø×éÖÐÊý¾Ý´°¿ÚµÄ×îºóÒ»¸öÖµ¡£
SAMPLE£ºÏÂÃæÀý×Ó¼ÆËã°´²¿ÃÅ·ÖÇø°´Ð½Ë®ÅÅÐòµÄÊý¾Ý´°¿ÚµÄ×îºóÒ»¸öÖµ¶ÔÓ¦µÄÃû×Ö£¬Èç¹ûнˮµÄ×îºóÒ»¸öÖµÓжà¸ö£¬Ôò´Ó¶à¸ö¶ÔÓ¦µÄÃû×ÖÖÐȡȱʡÅÅÐòµÄ×îºóÒ»¸öÃû×Ö
SELECT department_id, last_name, salary, LAST_VALUE(last_name)
OVER(PARTITION BY department_id ORDER BY salary) AS highest_sal
from employees
WHERE department_id in(20,30);
DEPARTMENT_ID LAST_NAME SALARY HIGHEST_SAL
------------- ------------------------- ---------- ------------
20 Fay 6000 Fay
20 Hartstein 13000 Hartstein
30 Colmenares 2500 Colmenares
30 Himuro 2600 Himuro
30 Tobias 2800 Tobias
30 Baida 2900 Baida
30 Khoo 3100 Khoo
30 Raphaely 11000 Raphaely
82¡£LEAD
¹¦ÄÜÃèÊö£ºLEADÓëLAGÏà·´£¬LEAD¿ÉÒÔ·ÃÎÊ×éÖе±Ç°ÐÐÖ®ºóµÄÐС£OffsetÊÇÒ»¸öÕýÕûÊý£¬ÆäĬÈÏֵΪ1£¬ÈôË÷Òý³¬³ö´°¿ÚµÄ·¶Î§£¬¾Í·µ»ØĬÈÏÖµ£¨Ä¬ÈÏ·µ»ØµÄÊÇ×éÖеÚÒ»ÐУ©
SAMPLE£ºÏÂÃæµÄÀý×ÓÖÐ


Ïà¹ØÎĵµ£º

OracleÊý¾Ý¿â±¸·Ýµ¼Èëµ¼³ö

1. ½«Êý¾Ý¿âÍêÈ«µ¼³ö
    Óû§Ãûsystem ÃÜÂësystem µ¼³öµ½OracleÓû§Ä¿Â¼ÏµÄtestdb20100522.dmpÎļþÖÐ
    #exp system/system@testdb file=testdb20100522.dmp full=y
2. ½«Êý¾Ý¿âÖÐsystemÓû§ÓësysÓû§µÄ±íµ¼³ö
    #exp system/system@testdb file= testdb20100522.d ......

JDBCÁ¬½ÓOracleµÄ¼òµ¥Àý×Ó

 1import java.sql.*;
 2import java.util.logging.Level;
 3import java.util.logging.Logger;
 4
 5/** *//**
 6 * Title: JDBCÁ¬½ÓÊý¾Ý¿â
 7 * Description: ±¾ÊµÀýÑÝʾÈçºÎʹÓÃJDBCÁ¬½ÓOracleÊý¾Ý¿â£¬²¢ÑÝʾÌí¼ÓÊý¾ÝºÍ²éѯÊý¾Ý.
 8 */
 9public class JDBCExampl ......

OC4JµÄ»·¾³±äÁ¿ÓëoracleÊý¾Ý¿â³åÍ»µÄ½â¾ö·½°¸

µ±±¾»ú°²×°ÁËORACLEÊý¾Ý¿âºó£¬ÔÙ°²×°ÔËÐÐOC4JµÄ»°£¬»·¾³±äÁ¿“ORACLE_HOME”ÓëORACLEÊý¾Ý¿âÓгåÍ»£¬¿ÉÒÔ°´ÕÕÈçÏ·½·¨½â¾ö´ËÎÊÌ⣺
·½·¨Ò»
µÚÒ»²½£ºÔÚ»·¾³±äÁ¿ÖÐн¨“OC4J_HOME”£¬Ö¸¶¨µ½ÄãµÄOC4J°²×°¸ùĿ¼£»
µÚ¶þ²½£º´ò¿ªOC4J°²×°µÄĿ¼£¬¼´../OC4J/bin/£¬ÀïÃæÓÐÒ»¸öoc4j.cmd£¬ÓÒ¼üµ¥»÷¸ÃÎļþ£¬Ñ ......

oracle·Ö×é rollup,Cube

CUBE ºÍ ROLLUP Ö®¼äµÄÇø±ðÔÚÓÚ£º
CUBE Éú³ÉµÄ½á¹û¼¯ÏÔʾÁËËùÑ¡ÁÐÖÐÖµµÄËùÓÐ×éºÏµÄ¾ÛºÏ¡£
ROLLUP Éú³ÉµÄ½á¹û¼¯ÏÔʾÁËËùÑ¡ÁÐÖÐÖµµÄijһ²ã´Î½á¹¹µÄ¾ÛºÏ¡£
     OracleµÄGROUP BYÓï¾ä³ýÁË×î»ù±¾µÄÓï·¨Í⣬»¹Ö§³ÖROLLUPºÍCUBEÓï¾ä¡£Èç¹ûÊÇROLLUP(A, B, C)µÄ»°£¬Ê×ÏÈ·Ö³ÉÁ½´ó²½£º£¨1£©¶ÔÓÚ·ûºÏÌõ¼þµÄÿ ......

110¸öOracle ³£Óú¯ÊýµÄ×ܽá

SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2.CHR
¸ø³öÕûÊý,·µ»Ø¶ÔÓ¦µÄ×Ö·û;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ