Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

OracleÖÐÐòÁÐsequence Ó÷¨

 1£© ½¨Á¢ÐòÁÐÃüÁî
    CREATE SEQUENCE [user.]sequence_name
    [increment by n]
    [start with n]
    [maxvalue n | nomaxvalue]
    [minvalue n | nominvalue];
    INCREMENT BY£º Ö¸¶¨ÐòÁкÅÖ®¼äµÄ¼ä¸ô£¬¸ÃÖµ¿ÉΪÕýµÄ»ò¸ºµÄÕûÊý£¬µ«²»¿ÉΪ0¡£ÐòÁÐΪÉýÐò¡£ºöÂÔ¸Ã×Ó¾äʱ£¬È±Ê¡ÖµÎª1¡£
    START WITH£ºÖ¸¶¨Éú³ÉµÄµÚÒ»¸öÐòÁкš£ÔÚÉýÐòʱ£¬ÐòÁпɴӱÈ×îСֵ´óµÄÖµ¿ªÊ¼£¬È±Ê¡ÖµÎªÐòÁеÄ×îСֵ¡£¶ÔÓÚ½µÐò£¬ÐòÁпÉÓɱÈ×î´óֵСµÄÖµ¿ªÊ¼£¬È±Ê¡ÖµÎªÐòÁеÄ×î´óÖµ¡£
    MAXVALUE£ºÖ¸¶¨ÐòÁпÉÉú³ÉµÄ×î´óÖµ¡£
    NOMAXVALUE£ºÎªÉýÐòÖ¸¶¨×î´óֵΪ1027£¬Îª½µÐòÖ¸¶¨×î´óֵΪ-1¡£
    MINVALUE£ºÖ¸¶¨ÐòÁеÄ×îСֵ¡£
    NOMINVALUE£ºÎªÉýÐòÖ¸¶¨×îСֵΪ1¡£Îª½µÐòÖ¸¶¨×îСֵΪ-1026¡£
    2£© ¸ü¸ÄÐòÁÐÃüÁî
    ALTERSEQUENCE [user.]sequence_name
    [INCREMENT BY n]
    [MAXVALUE n| NOMAXVALUE ]
    [MINVALUE n | NOMINVALUE]£»
    ÐÞ¸ÄÐòÁпÉÒÔ£º
    ? ÐÞ¸ÄδÀ´ÐòÁÐÖµµÄÔöÁ¿¡£
    ? ÉèÖûò³·Ïû×îСֵ»ò×î´óÖµ¡£
    ? ¸Ä±ä»º³åÐòÁеÄÊýÄ¿¡£
    ? Ö¸¶¨ÐòÁкÅÊÇ·ñÊÇÓÐÐò¡£
    3£© ɾ³ýÐòÁÐÃüÁî
    DROP SEQUENCE [user.]sequence_name£»
    ´ÓÊý¾Ý¿âÖÐɾ³ýÒ»ÐòÁС£ 
   ´´½¨Ò»¸öÐòÁкŵÄÓï¾ä£º
CREATE SEQUENCE EXAM_NO_SEQ
START WITH 1484
MAXVALUE 9999999999
MINVALUE 1
CYCLE
CACHE 20
NOORDER;
    PBÖÐÈ¡ÐòÁкŵÄÓ÷¨£º
string v_exam_no
//»ñÈ¡ÉêÇëÐòºÅ
SELECT exam_no_seq.nextval INTO :v_exam_no from dual
using ghis_database;
if ghis_database.SQLCODE<>0 then
messagebox("","È¡¼ì²éÐòºÅ³ö´í")
return
end if
================================================================================
ÆäËû°æ±¾
oracleÖÐûÓÐ×ÔÔöÀàÐ͵Ä×ֶεģ¬ËùÒÔͨ³£Çé¿öÏÂÐèÒª¶¨ÒåÒ»¸


Ïà¹ØÎĵµ£º

oracle ÈÕ³£Ê¹Óù¦Äܼ¯

1. ²é¿´Êý¾ÝµÄ×Ö·û¼¯
sqlplus> col parameter format a30
sqlplus> col value format a30
sqlplus> select * from nls_database_parameter
PARAMETER                      VALUE
------------------------------ --------------------
...
NLS_CH ......

OracleÖÐstart with¡­connect by prior×Ó¾äÓ÷¨

OracleÖÐstart with…connect by prior×Ó¾äÓ÷¨
connect by Êǽṹ»¯²éѯÖÐÓõ½µÄ£¬Æä»ù±¾Óï·¨ÊÇ£º
select … from tablename
start with Ìõ¼þ1
connect by Ìõ¼þ2
where Ìõ¼þ3;
Àý£º
select * from table
start with org_id = ‘HBHqfWGWPy’
connect by prior org_id = parent_id;
  ......

oracleÁ·Ï°£¨mldnÊÓƵ¿Î³Ì£©ËÄ

ÊÓͼ
´´½¨ÐÂ±í£ºcreate table emp2 as select * from emp;
create view empv20 as select empno,ename,job,hiredate,deptno from emp where deptno=20 with check option;
Óï·¨£ºcreate or replace view ÊÓͼÃû³Æ as ×Ó²éѯ£¨ÐÞ¸ÄÖ®ºóµÄ×Ó²éѯ£©
Ìæ»»ÊÓͼ(ÐÞ¸Ä)
create or replace view empv20 as select empno,ename, ......

Oracle ³£ÓÃÃæÊÔÌâ

1. ½âÊÍÀ䱸·ÝºÍÈȱ¸·ÝµÄ²»Í¬µãÒÔ¼°¸÷×ÔµÄÓŵã
½â´ð£ºÈȱ¸·ÝÕë¶Ô¹éµµÄ£Ê½µÄÊý¾Ý¿â£¬ÔÚÊý¾Ý¿âÈԾɴ¦ÓÚ¹¤×÷״̬ʱ½øÐб¸·Ý¡£¶øÀ䱸·ÝÖ¸ÔÚÊý¾Ý¿â¹Ø±Õºó£¬½øÐб¸·Ý£¬ÊÊÓÃÓÚËùÓÐģʽµÄ
Êý¾Ý¿â¡£Èȱ¸·ÝµÄÓŵãÔÚÓÚµ±±¸·Ýʱ£¬Êý¾Ý¿âÈԾɿÉÒÔ±»Ê¹Óò¢ÇÒ¿ÉÒÔ½«Êý¾Ý¿â»Ö¸´µ½ÈÎÒâÒ»¸öʱ¼äµã¡£À䱸·ÝµÄÓŵãÔÚÓÚËüµÄ±¸·ÝºÍ»Ö¸´
²Ù×÷Ïൠ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ