ORACLE´Ó±íÖÐËæ»ú·µ»ØnÌõ¼Ç¼
ʹÓÃORDER BY×Ӿ䣬ROWNUMÄÚÖú¯ÊýºÍDBMS_RANDOM°üÖеÄÄÚÖú¯ÊýVALUEÀ´ÊµÏÖ
SQL> select * from
2 (
3 select ename,job
4 from emp
5 order by dbms_random.value()
6 )
7 where rownum<=5;
ENAME JOB
---------- ---------
TURNER SALESMAN
SMITH CLERK
MARTIN SALESMAN
BLAKE MANAGER
SCOTT ANALYST
SQL> /
ENAME JOB
---------- ---------
ALLEN SALESMAN
SMITH CLERK
WARD SALESMAN
MARTIN SALESMAN
SCOTT ANALYST
Ïà¹ØÎĵµ£º
select * from ( select tb1.rollid from (select r.rollid as rollid from zh1_rool r where r.date_p >=to_date('2009-11-26 23:59:59','yyyy-mm-dd hh24:mi:ss') ) tb1
¡¡¡¡where tb1.rowid !=
¡¡¡¡(
select max(tb2.rown) from (select t.rowid as rown,t.lot_number as rollid
from inv.mtl_onh ......
Ç°ÃæдÁ˶à·ÝºìÆìDC 4.1ºÍ5.0ÉÏ°²×°Oracle 9i/10gµÄÎĵµ£¬µ«Ò»Ö±Ã»ÓÐÕûÀíDC 5.0ÉÏ°²×°Oracle 10gµ¥»ú·þÎñÆ÷µÄ×ÊÁÏ£¬ÔÒòÊǸùý³Ì·Ç³£¼òµ¥¡£µ«×î½üÏîÄ¿ÖУ¬»¹ÊÇÓÐÓû§Óöµ½Ð©ÎÊÌ⣬½ñÌì¾Í°ÑһЩÐèҪעÒâµÄµØ·½ÕûÀíһϣ¬ÏêϸµÄ¹ý³Ì¾Í²»ÃèÊöÁË¡£
Ò»¡¢ÏµÍ³»·¾³
²Ù×÷ϵͳ£ººìÆì DC 5.0 for x86 »ò x86_64
Ó²¼þ»·¾ ......
OracleÄÚÖú¯ÊýSQLCODEºÍSQLERRMÊÇÌرðÓÃÔÚOTHERS´¦ÀíÆ÷ÖУ¬·Ö±ðÓÃÀ´·µ»ØOracleµÄ´íÎó´úÂëºÍ´íÎóÏûÏ¢¡£
¡¡¡¡
¡¡¡¡OTHERS´¦ÀíÆ÷Ó¦¸ÃÊÇÒì³£´¦Àí¿éÖеÄ×îºóµÄÒì³£´¦ÀíÆ÷£¬ÒòΪËüÊÇÓÃÀ´²¶»ñ³ýÁ˱ðµÄÒì³£´¦ÀíÆ÷´¦ÀíÒÔÍâµÄËùÓеÄOracleÒì³££¬ËùÒÔÔÚ³ÌÐòµÄ×îÍâ²ãʹÓÃÒ»¸öOTHERS´¦ÀíÆ÷µÄ»°£¬ ......
1¡¢±àдĿµÄ
ʹÓÃͳһµÄÃüÃûºÍ±àÂë¹æ·¶£¬Ê¹Êý¾Ý¿âÃüÃû¼°±àÂë·ç¸ñ±ê×¼»¯£¬ÒÔ±ãÓÚÔĶÁ¡¢Àí½âºÍ¼Ì³Ð¡£
2¡¢ÊÊÓ÷¶Î§
±¾¹æ·¶ÊÊÓÃÓÚ¹«Ë¾·¶Î§ÄÚËùÓÐÒÔORACLE×÷Ϊºǫ́Êý¾Ý¿âµÄÓ¦ÓÃϵͳºÍÏîÄ¿¿ª·¢¹¤×÷¡£
3¡¢¶ÔÏóÃüÃû¹æ·¶
3.1 Êý¾Ý¿âºÍSID
Êý¾Ý¿âÃû¶¨ÒåΪϵͳÃû+Ä£¿éÃû
¡ï È«¾ÖÊý¾Ý¿âÃûºÍÀý³ÌSID ÃûÒªÇóÒ»ÖÂ
¡ï ÒòSID ......
SQL> select sal,comm from emp
2 where sal<2000;
SAL COMM
---------- ----------
800
1600 300
1250 500
1250 1400
1500 0
1100
950
1300
8 rows selected.
SQL> select sal as salary,comm as ......