ORACLE ÈçºÎ²úÉúÒ»¸öËæ»úÊý
ORACLE ÈçºÎ²úÉúÒ»¸öËæ»úÊý:DBMS_RANDOM
--1¡¢Ð¡Êý( 0 ~ 1)
select dbms_random.value from dual ;
--2¡¢Ö¸¶¨·¶Î§ÄÚµÄСÊý ( 0 ~ 100 )
select dbms_random.value(0,100) from dual ;
--3¡¢Ö¸¶¨·¶Î§ÄÚµÄÕûÊý ( 0 ~ 100 )
select trunc(dbms_random.value(0,100)) from dual ;
--4¡¢³¤¶ÈΪ20µÄËæ»úÊý×Ö´®
select substr(cast(dbms_random.value as varchar2(38)),0,10) from dual ;
--5¡¢Õý̬·Ö²¼µÄËæ»úÊý
select dbms_random.normal from dual ;
--6¡¢Ëæ»ú×Ö·û´®
select dbms_random.string('x', 3) from dual ;
/* opt¿ÉÈ¡ÖµÈçÏ£º
'u','U' : ´óд×Öĸ
'l','L' : Сд×Öĸ
'a','A' : ´ó¡¢Ð¡Ð´×Öĸ
'x','X' : Êý×Ö¡¢´óд×Öĸ
'p','P' : ¿É´òÓ¡×Ö·û*/
--7¡¢Ëæ»úÈÕÆÚ
select to_date(2454084+TRUNC(DBMS_RANDOM.VALUE(0,365)),'J') from dual ;
/* ͨ¹ýÏÂÃæµÄÓï¾ä»ñµÃÖ¸¶¨ÈÕÆڵĻùÊý*/
select to_char(sysdate,'J') from dual ;
--8¡¢Éú³ÉGUID
select sys_guid() from dual ;
--Éú³É´ø·Ö¸ô·û(-)µÄGUIDµÄ×Ô¶¨Ò庯Êý
--create or replace function my_guid
return varchar2
is
guid varchar(36);
temp varchar(32);
begin
temp:=sys_guid();
guid:= substr(temp,1,8) || '-'
||substr(temp,9,4) || '-'
||substr(temp,13,4)|| '-'
||substr(temp,17,4)|| '-'
||substr(temp,21,12)
Ïà¹ØÎĵµ£º
1¡¢±¸·ÝÖ¸¶¨µÄ±í¿Õ¼ä
Ê×ÏÈ£¬ÄãҪȷÈÏ×Ô¼ºµçÄÔÉÏÓÐexp.exeÕâ¸ö¶«¶«£¬²ÅÄܽøÐб¸·Ý¹¤×÷¡£
ÎÒÏëÒª±¸·ÝµÄÊÇÓû§ÃûΪcyyµÄ±í¿Õ¼ä£¬±¸·ÝÎļþ´òËã·ÅÔÚDÅÌ£¬²¢ÒÔbackup_oracle.dmpÃüÃû£¬Ë³±ã°ÑÈÕÖ¾ÎļþÒ²±¸·ÝһϺÃÁË¡£
ÔÚÃüÁîÐÐÇÃÈ룺
C:\Documents and Settings\Administrator>exp cyy/cyy@bsrs file=D:\backup_oracle.dmp ......
ת×Ô£ºhttp://wallimn.javaeye.com/blog/472182
¶ÔÓÚSPOOL
Êý¾ÝµÄSQL£¬×îºÃÒª×Ô¼º¶¨Òå¸ñʽ£¬ÒÔ·½±ã³ÌÐòÖ±½Óµ¼Èë,SQLÓï¾ä
È磺
select
taskindex||'|'||commonindex||'|'||tasktype||'|'||to_number(to_char(sysdate,'YYYYMMDD'))
from ssrv_sendsms_task;
spool
³£ÓõÄÉèÖÃ
set colsep' ';¡¡¡¡¡¡ //ÓòÊä³ö·Ö¸ô·û ......
BLOBµÄº¬Òå¡¡¡¡
BLOB (binary large object)£¬¶þ½øÖÆ´ó¶ÔÏó£¬ÊÇÒ»¸ö¿ÉÒÔ´æ´¢¶þ½øÖÆÎļþµÄÈÝÆ÷¡£
¡¡¡¡ÔÚ¼ÆËã»úÖУ¬BLOB³£³£ÊÇÊý¾Ý¿âÖÐÓÃÀ´´æ´¢¶þ½øÖÆÎļþµÄ×Ö¶ÎÀàÐÍ¡£
¡¡¡¡BLOBÊÇÒ»¸ö´óÎļþ£¬µäÐ͵ÄBLOBÊÇÒ»ÕÅͼƬ»òÒ»¸öÉùÒôÎļþ£¬ÓÉÓÚËüÃǵijߴ磬±ØÐëʹÓÃÌØÊâµÄ·½Ê½À´´¦Àí£¨ÀýÈ磺ÉÏ´«¡ ......
OracleÊý¾Ý¿âÖ»ÊÇһЩÎļþ×é³É£¬OracleʵÀýÊÇÖ¸ÓÐ×Ô¼ºµÄϵͳȫ¾ÖÇøºÍÏà¹ØÊý¾Ý¿âÎļþµÄOracle·þÎñÆ÷½ø³Ì¼¯¡£ÐÂ×°µÄOracleÊý¾Ý¿â¹ÜÀíϵͳÓÐÒ»¸öԤװµÄÊý¾Ý¿â£¨Í¨³£½ÐORCL£©£¬Í¬Ê±»áÆô¶¯Ò»¸öʵÀý£¬ÒÔºóµÄÊý¾Ý¿âÁ¬½Ó£¬¶¼Ä¬ÈÏÊÇͨ¹ýÕâ¸öʵÀýÁ¬½Óµ½¸ÃÊý¾Ý¿â¡£
¿ÉÒÔн¨Êý¾Ý¿â£¬ ......
Oracle
ÖеÄÈÕÆÚÀàÐͼ°ÆäÏà¹ØµÄº¯Êý
Oracle
ÌṩÁ˺ܶàµÄÄÚÖõÄÈÕÆÚÀàÐÍ£¬°üÀ¨Èçϼ¸ÖÖ£º
Date
Timestamp
Timestamp With Time Zone
Timestamp With Local Time Zone
Interval Year To Month
Interval Day To Second
DateÀàÐÍÓÃÓÚ´æ´¢ÈÕÆÚ£¬¾«È·µ½Ã룬¿ÉÄÜͨ¹ýÉèÖÃNLS_DATE_FORMAT»òÕßTO_CHAR·½·¨À´¸ñʽ»¯ÈÕÆÚµÄÊ ......