Oracle Sequence Ïà¹Ø֪ʶ
Ò»£¬¼òµ¥½éÉÜ
ÔÚoracleÖÐsequence¾ÍÊÇËùνµÄÐòÁкţ¬Ã¿´ÎÈ¡µÄʱºòËü»á×Ô¶¯Ôö¼Ó£¬Ò»°ãÓÃÔÚÐèÒª°´
ÐòÁкÅÅÅÐòµÄµØ·½¡£
1¡¢ create sequence
ÄãÊ×ÏÈÒªÓÐcreate sequence»òÕßcreate any sequenceȨÏÞ£¬
create sequence emp_sequence
INCREMENT BY 1 -- ÿ´Î¼Ó¼¸¸ö
START WITH 1 -- ´Ó1¿ªÊ¼¼ÆÊý
NOMAXVALUE -- ²»ÉèÖÃ×î´óÖµ
NOCYCLE -- Ò»Ö±ÀÛ¼Ó£¬²»Ñ»·
CACHE 10; --Ô¤·ÖÅ仺´æ´óСΪ10
Ò»µ©¶¨ÒåÁËemp_sequence£¬Äã¾Í¿ÉÒÔÓÃCURRVAL£¬NEXTVAL
CURRVAL=·µ»ØsequenceµÄµ±Ç°Öµ
NEXTVAL=Ôö¼ÓsequenceµÄÖµ£¬È»ºó·µ»ØsequenceÖµ
±ÈÈ磺
emp_sequence.CURRVAL
emp_sequence.NEXTVAL
¿ÉÒÔʹÓÃsequenceµÄµØ·½£º
- ²»°üº¬×Ó²éѯ¡¢snapshot¡¢VIEWµÄ SELECT Óï¾ä
- INSERTÓï¾äµÄ×Ó²éѯÖÐ
- NSERTÓï¾äµÄVALUESÖÐ
- UPDATE µÄ SETÖÐ
¿ÉÒÔ¿´ÈçÏÂÀý×Ó£º
INSERT INTO emp VALUES
(empseq.nextval, 'LEWIS', 'CLERK',7902, SYSDATE, 1200, NULL, 20);
SELECT empseq.currval from DUAL;
µ«ÊÇҪעÒâµÄÊÇ£º
- µÚÒ»´ÎNEXTVAL·µ»ØµÄÊdzõʼֵ£»ËæºóµÄNEXTVAL»á×Ô¶¯Ôö¼ÓÄ㶨ÒåµÄINCREMENT BYÖµ£¬
È»ºó·µ»ØÔö¼ÓºóµÄÖµ¡£CURRVAL ×ÜÊÇ·µ»Øµ±Ç°sequenceµÄÖµ£¬µ«
Ïà¹ØÎĵµ£º
#! /bin/bash
if [ -f ~/.bashrc ];then
. ~/.bash_profile
fi
export script=/home/oracle/script
export bakdata_destination=/u02/rman_backup/data
export baklog_destination=/u02/rman_backup/log
export datadir=`date +'%Y_%m_%d'`
export days=`date +'%w'`
if ! test -d $script
then
&nb ......
´æ´¢¹ý³Ì´´½¨Óï·¨£º
£¨1£©ÎÞ²Î
create or replace procedure ´æ´¢¹ý³ÌÃû
as
±äÁ¿1 ÀàÐÍ£¨Öµ·¶Î§£©;
±äÁ¿2 ÀàÐÍ£¨Öµ·¶Î§£©;
Begin
........................
Exception
........................
End;
£¨2£©´ø ......
MDSYS.CS_SRS ----- ¸Ã±í¶¨ÒåÁË×ø±êϵµÄÃû×Ö¼°ÆäÔÚOracle SpatialÖеÄIDÖµµÈ£¬ÕâЩ×ø±êϵ¶¼ÊÇÓÉOpen-GIS¹«²¼µÄ¡£Ä¿Ç°¶¨ÒåµÄ×ø±êϵÒѾ´ïµ½1018¸ö¡£
MDSYS.SDO_ANGLE_UNITS ----- ¸Ã±í¶¨ÒåÁ˽Ƕȵ¥Î»£¬·Ö±ðÊÇDegree,Gon,Grad,Minute,Radian,Second
MDSYS.SDO_DIST_UNITS ----- ¸Ã±í¶¨ÒåÁ˾àÀëµÄµ¥Î»¡£±ÈÈçkm,m£¬¹²ÓÐ27ÖÖ¾à ......
create or replace procedure aa1 is
v_aa varchar2(20);
v_bb varchar2(20);
va_aa varchar2(20);
va_bb varchar2(20);
va_number_aa number;
message varchar2(60);
CURSOR aas is
SELECT DISTINCT aa.aa, aa.bb from aa;
CURSOR aaas is
SELECT DISTINCT aaa.aa, aaa.bb from aaa where aaa.aa = v_aa ......
1¡¢»ù±¾Óï·¨
SELECT
from
WHERE
GROUP BY
HAVING
ORDER BY
SELECT:²éѯµÄ×Ö¶Î
1¡¢¿ÉÓÃ*±íʾËùÓÐ×ֶΡ£
2¡¢×Ö¶ÎÖ®¼äÓöººÅ·Ö¸î¡£
3¡¢¿ÉΪ×Ö¶ÎÆð±ðÃû Æä±ðÃû¿Éд³ÉSELECT AAAA¡£AA AS SS »ò AAAA¡£AA SS ¿ÉÊ¡ÂÔas
4¡¢¿ÉÖ±½Óд×Ö¶ÎÖµ£ºÈç SELECT AAAA¡£AA SS,'ÕÅÈý' NAME from ¡£¡£¡£
from:²éѯµÄ±íÃû
1¡¢±íà ......