首页 >

Oracle中Sequence使用的限制

数据库|mysql教程Oracle中Sequence使用的限制
Oracle Sequence,Oracle使用,Oracl
数据库-mysql教程
h5画圆小游戏 源码,vscode生成,ubuntu本地ISO源,tomcat高危,osm转sqlite,最好的云服务器,装机插件,前端搭app框架,爬虫 协程,php字符串拆分成数组,seo培训实战,冰箱网站源码,c 网页特效,dreamweaver购物网站模板,js 刷新页面滚动,管理系统框架,ica算法matlab程序lzw
在使用Oracle序列的currval和nextval时的限制,在delete,select,update语句的子查询中不能使用sequence的值
主机 源码 域名 授权,ubuntu 切换网易源,tomcat6w关不了服务,玩手机爬虫视频,java和php培训班哪个好,seo随机汉字lzw
java map源码,vscode 面板,ubuntu 查看chm,tomcat 连接,sqlite偏移指针,windows php服务器,双时间插件,前端前沿的框架,python爬虫数据库,php字符串转化为数组,喜茶seo,个人网站后台密码忘记了怎么办,网页特效下雪,包包模板,thinkphp页面美化,c 库存管理系统源码,winform 开机自动启动其它程序lzw

在使用Oracle序列的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 <(select test_seq.currval from dual);

delete from test_jy where test_id <(select test_seq.currval from dual)

ORA-02287: 此处不允许序号

SQL> select * from test_jy where test_id <(select test_seq.currval from dual);

select * from test_jy where test_id <(select test_seq.currval from dual)

ORA-02287: 此处不允许序号

SQL> update test_jy set test_id=0 where test_id <(select test_seq.currval from dual);

update test_jy set test_id=0 where test_id <(select test_seq.currval from dual)

ORA-02287: 此处不允许序号

在查询视图或物化视图时

SQL> select a.* from test_v a where a.userid<test_seq.currval ;

select a.* from test_v a where a.userid<test_seq.currval

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<test_seq.currval;

select test_jy.* from test_jy where test_id<test_seq.currval

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约束中不能使用


Oracle中Sequence使用的限制
  • Oracle和MySQL分别生成sequence序列
  • Oracle和MySQL分别生成sequence序列 | Oracle和MySQL分别生成sequence序列 ...

    Oracle中Sequence使用的限制
  • 在Linux、Windows上如何按日期逻辑备份数据库
  • 在Linux、Windows上如何按日期逻辑备份数据库 | 在Linux、Windows上如何按日期逻辑备份数据库 ...

    Oracle中Sequence使用的限制
  • Oracle使用游标为所有用户表创建主键语句
  • Oracle使用游标为所有用户表创建主键语句 | Oracle使用游标为所有用户表创建主键语句 ...