一个插入语句,这样写报错:此处不允许序列
insert into t_dict_product_mapping(f_dict_id, f_product_code_jifei, f_product_name_jifei)
select s_dict_product_mapping.nextval dictid,gid,gname from t_dw_fltelecomproduct_all a
group by gid,gname
改写成这样既可继续
insert into t_dict_product_mapping(f_dict_id, f_product_code_jifei, f_product_name_jifei)
select s_dict_product_mapping.nextval dictid,gid,gname from (
select gid,gname from t_dw_fltelecomproduct_all a
group by gid,gname
)
报错原因,group by语句中不能是会用序列,详见帮助文档
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
相关推荐
oracle 中不用新建序列是实现重置序列(从1开始增长)
oracle 创建id主键序列的 脚本 及 使用方式 oracle 创建id主键序列的 脚本 及 使用方式
--创建序列 create sequence seq_user start with 1 increment by 1 nomaxvalue cache 10; --使用序列 insert into user_table(user_id,user_name,user_pwd) vlaues(seq_user.nextval,'tcy','tcy'); --修改...
一片关于Oracle中索引、序列、锁机制的文章,里面出现的每条语句都附有截图。
序列是一数据库对象,利用它可生成唯一的...Oracle序列允许同时生成多个序列号,而每一个序列号是唯一的。当一个序列号生成时,序列是递增,独立于事务的提交或回滚。本文介绍了Oracle中建立、更改、删除序列的命令。
MLDN魔乐科技_Oracle课堂22_序列、同义词
对你绝对有帮助,oracle建表 序列 有例子
oracle索引、序列和权限设置
java通过Mysql实现类似oracle序列功能,
Oracle数据库中序列的使用Oracle数据库中序列的使用
oracle 序列自增oracle
Oracle使用序列创建自增字段,自增长列。
oracle 创建序列 完整步骤
视图、索引、同义词和序列
Oracle实验报告
oracle设置主外键即主键序列自动增长
文档 里面包含了 mysql创建 oracle序列的脚本,数据库表、函数、使用案例 sql和截图 ,自带 根据步长和值长度,到数据最大时返回0;手册说明详细,表名字段都有解释,一看就懂
最近项目中要用oracle中的序列相关的内容,本人对oracle是小白一个,没办法只能在网上找相关的资源,还好,发现了一些,感觉挺实用的,就分享给大家了,该资源是oracle序列的创建、修改、以及删除的相关操作,有用例...
NULL 博文链接:https://zzx0421.iteye.com/blog/335955
介绍了PL/SQL工具,导出oracle序列的方法以及步骤