OracleËæ»úº¯Êý—dbms_random
1.»ù´¡ÈÏʶ
DBMS_RANDOM°üµÄÏêϸÐÅÏ¢£º
select text from all_source
where name = 'DBMS_RANDOM'
and type = 'PACKAGE' order by line;
¡ô TYPE num_array
2.Ó¦ÓþÙÀý
SELECT DBMS_RANDOM.RANDOM from DUAL;
ÔÙ½øÒ»²½µÄÒªÇ󣬱ÈÈ磬²úÉúÒ»¸ö0£100µÄËæ»úÊý£¬ÉÔ΢±äͨһϾͿÉÒÔÁË£º
select abs(mod(dbms_random.random,100)) from dual
3.½ø½×˵Ã÷
dbms_randomÓÖÓÐк¯ÊýÁË¿ÉÒÔʵÏÖÕâЩ¹¦ÄÜ
FUNCTION value RETURN NUMBER;
FUNCTION value (low IN NUMBER, high IN NUMBER) RETURN NUMBER;
FUNCTION normal RETURN NUMBER;
FUNCTION string (opt char, len NUMBER) RETURN VARCHAR2;
²úÉúNµ½MÖ®¼äµÄËæ»úÊý
SELECT DBMS_RANDOM.VALUE(N,M) from DUAL;
ȱʡDBMS_RANDOM.VALUE·µ»Ø0µ½1Ö®¼äµÄËæ»úÊý
SQL> select dbms_random.value, dbms_random.value(55,100) from dual;
VALUE DBMS_RANDOM.VALUE(55,100)
--------------- -----------------------------
0.714469037747011 68.5593418279622
&n
Ïà¹ØÎĵµ£º
oracleÖÐsqlÓï¾äÖÐselect * from t_Test t where t.Id in(1,2,3......)/*ÊýÁ¿²»ÄÜ´óÓÚ1000¸ö*/
½â¾ö·½·¨ ·Ö¸î³É¶à´Îin È»ºóÔÙ»òÉÏ Èç select * from t_Test t where t.Id in(1,2,3......800) or t.Id in(801,802,803......1300)
ÔÚʹÓÃÖÐ×îºÃÄܲ»Ê¹ÓÃÆäËûÌõ¼þÀ´´úÌæin
......
<!--
@Name£º·ÖÀàͳ¼ÆÃ÷ϸ
@Time£º2010.01.05
@author JZP
--->
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page language="java" import="wfc.service.database.DB"%>
<%@ page import="java.sql.Connection"%>
<%@ page import="java.sql.Resul ......
--È¡µÃµ±Ìì0ʱ0·Ö0Ãë
select TRUNC(SYSDATE) from dual;
--È¡µÃµ±Ìì23ʱ59·Ö59Ãë(ÔÚµ±Ìì0ʱ0·Ö0ÃëµÄ»ù´¡ÉϼÓ1ÌìºóÔÙ¼õ1Ãë)
SELECT TRUNC(SYSDATE)+1-1/86400 from dual;
--È¡µÃµ±Ç°ÈÕÆÚÊÇÒ»¸öÐÇÆÚÖеĵڼ¸Ìì,×¢Ò⣺ÐÇÆÚÈÕÊǵÚÒ»Ìì
select to_char(sysdate,'D'),to_char(sysdate,'DAY') from dual;
--ÔÚoracleÖÐÈçºÎµÃ ......
ÀûÓÃosÉóºË
µÇ¼oracleʱÔÚWinÖÐʵÏÖ¶ÔosµÄÉóºËÓÐÈçϼ¸²½£º
1¡¢ create os user id
2¡¢ create os group ora_dba(Õâ¸ö×éÖÐÓû§¾ßÓйÜÀíËùÓÐoracle database µÄȨÏÞ),
ora_sid_dba£¨Ö»ÄܶÔÓ¦µ½ÏàÓ¦sidµ ......
sqlplus sys/password as sysdba;ϵͳ¹ÜÀíÔ±µÇ¼
alter user scott account unlock; ¸ü¸ÄÓû§
desc £¨±íÃû£©
select * from (table name);
select distinct ename from emp;
select ename,sal from emp;
select ename,sal*12 'annual_sal' from emp;
select ename,sal from emp where sal>1000;
select ......