oracle中sequence使用的限制
在使用序列的currval和nextval時的限制
建立一個序列
create sequence test_seq
minvalue 1
maxvalue 10000000
start with 1
increment by 1
cache 20;
在delete,select,update語句的子查詢中不能使用sequence的值
SQL> delete from test_jy where test_id
delete from test_jy where test_id
ORA-02287: 此處不允許序號
SQL> select * from test_jy where test_id
select * from test_jy where test_id
ORA-02287: 此處不允許序號
SQL> update test_jy set test_id=0 where test_id
update test_jy set test_id=0 where test_id
ORA-02287: 此處不允許序號
在查詢檢視或物化檢視時
SQL> select a.* from test_v a where a.userid
select a.* from test_v a where a.userid
ORA-02287: 此處不允許序號
帶有distinct操作符的select語句不能使用
SQL> select distinct a.*,test_seq.currval from test_v a ;
select distinct a.*,test_seq.currval from test_v a
ORA-02287: 此處不允許序號
有group by,order by操作的select語句不能使用
SQL> select test_jy.*,test_seq.currval from test_jy group by test_jy.test_id;
select test_jy.*,test_seq.currval from test_jy group by test_jy.test_id
ORA-02287: 此處不允許序號
SQL> select test_jy.*,test_seq.currval from test_jy order by test_jy.test_id;
select test_jy.*,test_seq.currval from test_jy order by test_jy.test_id
ORA-02287: 此處不允許序號
有UNION, INTERSECT, MINUS操作符的語句不能使用
SQL> select test_jy.*,test_seq.currval from test_jy where test_id=1
2 union
3 select test_jy.*,test_seq.currval from test_jy where test_id=2;
select test_jy.*,test_seq.currval from test_jy where test_id=1
union
select test_jy.*,test_seq.currval from test_jy where test_id=2
ORA-02287: 此處不允許序號
SQL> select test_jy.*,test_seq.currval from test_jy where test_id=1
2 intersect
3 select test_jy.*,test_seq.currval from test_jy where test_id=2;
select test_jy.*,test_seq.currval from test_jy where test_id=1
intersect
select test_jy.*,test_seq.currval from test_jy where test_id=2
ORA-02287: 此處不允許序號
SQL> select test_jy.*,test_seq.currval from test_jy where test_id=1
2 minus
3 select test_jy.*,test_seq.currval from test_jy where test_id=2;
select test_jy.*,test_seq.currval from test_jy where test_id=1
minus
select test_jy.*,test_seq.currval from test_jy where test_id=2
ORA-02287: 此處不允許序號
在select語句中的where子句中
SQL> select test_jy.* from test_jy where test_id
select test_jy.* from test_jy where test_id
ORA-02287: 此處不允許序號
在create table或alter table語句的中default值是不能使用sequence
SQL> alter table test_jy modify test_id number(20) default test_seq.currval;
alter table test_jy modify test_id number(20) default test_seq.currval
ORA-00984: 列在此處不允許
還有就在check約束中不能使用
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-751448/,如需轉載,請註明出處,否則將追究法律責任。
上一篇:
檢視錶空間及檔案大小的語句
下一篇:
ora_rowscn偽列的用途
請登入後發表評論
登入
全部評論
相關文章
- Oracle中Sequence的使用Oracle
- Oracle中sequence的使用方法Oracle
- 在Hibernate中關於Oracle sequence的使用KHOracle
- Oracle中sequence cache的測試Oracle
- ORACLE SEQUENCEOracle
- oracle的scn及sequenceOracle
- ORACLE SEQUENCE用法Oracle
- Oracle - Sequence序列Oracle
- Oracle Sequence NocacheOracle
- Oracle序列sequenceOracle
- Oracle中的使用者資源限制的幾點說明Oracle
- Oracle之Sequence(序列)Oracle
- Oracle Sequence Audses$研究Oracle
- oracle sequence語法Oracle
- oracle sequence 試用Oracle
- Oracle中left join中右表的限制條件Oracle
- mysql中雜湊索引的使用限制MySql索引
- Excel使用中的種種限制教程Excel
- 限制oracle資料庫例項中的使用者(user)總數Oracle資料庫
- Oracle -- 批次更新sequence的儲存Oracle
- Oracle -- 批量更新sequence的儲存Oracle
- ORACLE SEQUENCE的簡單介紹Oracle
- 不同於Oracle:SEQUENCE的區別Oracle
- Oracle中對使用者所能使用的資料庫資源進行限制Oracle資料庫
- 軟體中關於使用IP的限制
- 【PROFILE】使用Oracle的PROFILE對使用者資源限制和密碼限制的研究與探索Oracle密碼
- 【PROFILE】使用Oracle PROFILE限制會話中每一次呼叫所使用的CPU資源Oracle會話
- Oracle中Nextval用法SEQUENCE與SYS_GUID()OracleGUI
- [轉載] 使用Oracle的PROFILE對使用者資源限制和密碼限制的研究與探索Oracle密碼
- 【轉】MySQL中增加sequence管理功能(模擬建立sequence)MySql
- Oracle如何限制非法呼叫包中過程Oracle
- 使用sequence的cache特性時要注意的
- sequence to sequence模型模型
- Oracle ASM 限制OracleASM
- Oracle Sequence Cache 引數說明Oracle
- Oracle 12C使用UNTIL SEQUENCE子句對Non-CDB中的表執行按時間點恢復Oracle
- 在intersect中利用oracle sequence報錯_ora-02287Oracle
- Oracle9i 中如何限制登陸IPOracle