Oracle´´½¨ÐòÁÐ sequence
OracleÖеÄÐòÁкŹËÃû˼Òå¾ÍÊÇ´´½¨Ò»¸öÐòÁкţ¬¿ÉÒÔÔÚ²åÈë»òÕ߸üеÄʱºòµ÷Óã¬Ï൱ÓÚÊÇÒ»¸öÉú³ÉÆ÷
´´½¨Óï·¨£º
create sequence myse
increment by 1 --Ôö³¤¶È
start with
1 --´ÓÄÄÀïÔö¼Ó£¬¾ÍÊÇ˵ÏÂÒ»¸ö»ñÈ¡µÄÖµ´ÓÕâ¸öÖµ¿ªÊ¼
nomaxvalue --²»ÉèÖÃ×î´óÖµ
¶ÔÓ¦µÄ£ºmaxvalue 30¡¢
order --Ö¸¶¨Ò»¶¨ÍùÏÂÔö¼Ó
nocycle
--²»Ñ»·£¬CYCLEºÍNOCYCLE ±íʾµ±ÐòÁÐÉú³ÉÆ÷µÄÖµ´ïµ½ÏÞÖÆÖµºóÊÇ·ñÑ»·
cache 10
--CACHE(»º³å)¶¨Òå´æ·ÅÐòÁеÄÄÚ´æ¿éµÄ´óС£¬Ä¬ÈÏΪ20¡£NOCACHE±íʾ²»¶ÔÐòÁнøÐÐÄڴ滺³å¡£¶ÔÐòÁнøÐÐÄڴ滺³å£¬¿ÉÒÔ¸ÄÉÆÐòÁеÄÐÔÄÜ
Ð޸ģº
ÐòÁеÄijЩ²¿·ÖÒ²¿ÉÒÔÔÚʹÓÃÖнøÐÐÐ޸ģ¬µ«²»ÄÜÐÞ¸ÄSATRT
WITHÑ¡Ïî¡£¶ÔÐòÁеÄÐÞ¸ÄÖ»Ó°ÏìËæºó²úÉúµÄÐòºÅ£¬ÒѾ²úÉúµÄÐòºÅ²»±ä¡£ÐÞ¸ÄÐòÁеÄÓï·¨ÈçÏ£º
ALTER SEQUENCE emp_sequence
INCREMENT BY 10
MAXVALUE 10000
CYCLE -- µ½10000ºó´ÓÍ·¿ªÊ¼
NOCACHE ;
Ðè×¢Ò⣺
µÚÒ»´ÎNEXTVAL·µ»ØµÄÊdzõʼֵ£»ËæºóµÄNEXTVAL»á×Ô¶¯Ôö¼ÓÄ㶨ÒåµÄINCREMENT
BYÖµ£¬È»ºó·µ»ØÔö¼ÓºóµÄÖµ¡£CURRVAL
×ÜÊÇ·µ»Øµ±Ç°SEQUENCEµÄÖµ£¬µ«ÊÇÔÚµÚÒ»´ÎNEXTVAL³õʼ»¯Ö®ºó²ÅÄÜʹÓÃCURRVAL£¬·ñÔò»á³ö´í¡£Ò»´ÎNEXTVAL»áÔö¼ÓÒ»´ÎSEQUENCEµÄÖµ£¬ËùÒÔÈç¹ûÄãÔÚͬһ¸öÓï¾äÀïÃæʹÓöà¸öNEXTVAL£¬ÆäÖµ¾ÍÊDz»Ò»ÑùµÄ¡£
ɾ³ý£º
DROP SEQUENCE order_seq;
< type="text/javascript">
< type="text/javascript">
Ïà¹ØÎĵµ£º
Ê×ÏȲéÕÒÄ¿±êÓû§µÄµ±Ç°½ø³Ì£º
select sid,serial# from v$session where username='ERP';
²éѯ½á¹û£º
sid serial#
222 123
122 233
Ç¿ÐжϿªÓû§Á¬½Ó£º
alter system kill session 'sid,serial';
ÀýÈ磺
alter system kill session '222,123';
......
decodeº¯Êý
Óï·¨£º
decode(expr,search,result[,search,result]..[,search,result][,default])
½âÊÍ£º
±È½ÏexprÓëÿ¸ösearchµÄÖµ£¬Èç¹ûexprµÈÓÚij¸ösearch£¬Ôò·µ»ØÏàÓ¦µÄresult£»Èç¹ûûÓÐÆ¥ÅäµÄÖµ£¬Ôò·µ»ØdefaultÖµ£»Èç¹ûûÓÐÖ¸¶¨defaultÖµ£¬Ôò·µ»Ønull
×¢Ò⣺
±È½ÏÇ°£¬Oracle×Ô¶¯½«exprµÄÊý¾ÝÀàÐÍת»»³ÉµÚÒ»¸ösear ......
Ò» Oracle¹«Ë¾¼ò½é
OracleÊÇÒóÐæ³öÍÁµÄ¼×¹ÇÎÄ(oracle bone inscriptions)µÄÓ¢ÎÄ·ÒëµÄµÚÒ»¸öµ¥´Ê
Oracle¹«Ë¾ÊÇÈ«Çò×î´óµÄÐÅÏ¢¹ÜÀíÈí¼þ¼°·þÎñ¹©Ó¦ÉÌ£¬³ÉÁ¢ÓÚ1977Ä꣬×ܲ¿Î»ÓÚÃÀ¹ú¼ÓÖÝ Redwood shore
Oracle¹«Ë¾ÒòÆ临ÔӵĹØϵÊý¾Ý¿â²úÆ·¶øÎÅÃû¡£OracleµÄ¹ØϵÊý¾Ý¿âÊÇÊÀ½çµÚÒ»¸öÖ§³ÖSQLÓïÑÔµÄÊý¾Ý¿â
OracleÔÚ³¬¹ý ......
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È ......
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* ´Ë´¦²åÈëÀàÐÍ˵Ã÷¡£
* ´´½¨ÈÕÆÚ£º(2001/11/30 14:55 ......