oracle-序列 ora-02287 此处不允许序号
来源:互联网 发布:长江师范学院网络教学 编辑:程序博客网 时间:2024/05/29 04:54
今天在生产数据库执行时报ora-02287 此处不允许序号
类似:
SELECT distinct
SYS_GUID(),
‘Y’ ACTIVE,
‘N’ IsRedBack,
‘N’ IsInit,
1 VersionNo,
‘YS2’ || LPAD(STL.SQ_YS2.NEXTVAL, 9, ‘0’) ReceivableNo
from dual
经查使用序列是有限制的:
Restrictions on Sequence Values You cannot use CURRVAL and NEXTVAL in the
following constructs:
■ A subquery in a DELETE, SELECT, or UPDATE statement
■ A query of a view or of a materialized view
■ A SELECT statement with the DISTINCT operator
■ A SELECT statement with a GROUP BY clause or ORDER BY clause
■ A SELECT statement that is combined with another SELECT statement with the
UNION, INTERSECT, or MINUS set operator
■ The WHERE clause of a SELECT statement
■ The DEFAULT value of a column in a CREATE TABLE or ALTER TABLE statement
■ The condition of a CHECK constrain
所以我这里是犯了A SELECT statement with the DISTINCT operator,
修改为:
select SYS_GUID(),
‘YS2’ || LPAD(STL.SQ_YS2.NEXTVAL, 9, ‘0’) ReceivableNo,
T.*
FROM (
SELECT distinct
‘Y’ ACTIVE,
‘N’ IsRedBack,
‘N’ IsInit,
1 VersionNo
from dual
)T
这样就可以避免 A query of a view or of a materialized view
和
A SELECT statement with the DISTINCT operator
- oracle-序列 ora-02287 此处不允许序号
- Mybatis 批量插入带oracle序列例子+ORA-02287: 此处不允许序号
- Mybatis 批量插入带oracle序列例子+ORA-02287: 此处不允许序号
- Oracle的自动增长序列时提示 : ORA-02287: 此处不允许序号
- ORA-02287: 此处不允许序号
- ORA-02287: 此处不允许序号
- ORA-02287: 此处不允许序号
- ORA-02287: 此处不允许序号
- ORA-02287: 此处不允许序号
- oracle 此处不允许有序号
- ORA-02287:此处不允许序号(sequence number not allowed here) 的避免以及强制实现
- ORA-02287:此处不允许序号(sequence number not allowed here) 的避免以及强制实现
- oracle 执行脚本报错: 此处不允许序号
- ORA-00984列在此处不允许
- ORA-01733: 此处不允许虚拟列
- oracle报PL/SQL:ORA:04044:此处不允许过程、函数、程序包或类型;
- Oracle:ORA-24324: 未初始化服务句柄 ORA-24323: 不允许此值 ORA-01090: 正在关闭 - 不允许连接
- Oracle:ORA-24324: 未初始化服务句柄 ORA-24323: 不允许此值 ORA-01090: 正在关闭 - 不允许连接
- Git速成
- JavaScript学习--Item18 JScript的Bug与内存管理
- iOS证书配置常见错误
- tomcat启动异常:IOException while loading persisted sessions: java.io.EOFException
- if()return;的一点小问题
- oracle-序列 ora-02287 此处不允许序号
- PHP 模糊搜索
- fragement生命周期
- 从Android代码中来记忆23种设计模式
- 文件编码及UTF-8、BOM、0XFEFF相关问题
- "巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场(重现)解题思路
- Android 6.0+ 运行时权限探索
- 使用Myeclipse 10开发基于JAX-WS的Web service实例
- 微机原理中$求内存数据个数