oracle 实现插入自增列
来源:互联网 发布:js中单选按钮点击事件 编辑:程序博客网 时间:2024/05/17 23:56
刚使用oracle,它和mysql 好多地方还是有所不同的,简单的问题,都得从头学起。。。。。。
创建一张表,字段如下:
oracle不像sql
server 有关键字auto_increment直接可插入数据时自增 ,
实现oracle 自增列第一步,创建一个sequence。
create sequence Tempinfo_seq increment by 1 start with 1
minvalue 1 maxvalue 9999999999999 nocache
order;
第二步,创建一个触发器。
create or
replace trigger userlogin_trigger
before insert on Tempinfo
for each
row
begin
select Tempinfo_seq.Nextval into:new.ids from sys.dual
;
end;
执行插入查看
insert into
Tempinfo (names,sex) values
('Serein',2188);
查看当插入一行新数据时,首个字段IDS自动增加。
当然也事不用创建触发器,直接在插入数据时使用sequence就可以了
insert into Tempinfo (ids,names,sex) values
(Tempinfo_seq.Nextval,'Serein',2188);
0 0
- oracle 实现插入自增列
- oracle实现插入自增列
- oracle 实现插入自增列
- [转]oracle 实现插入自增列
- oracle 实现插入自增列
- oracle实现自增列
- mysql查询实现插入自增列
- oracle中自增列的实现
- Oracle 实现自增列
- oracle利用触发器实现自增列
- oracle利用触发器实现自增列
- oracle中数据库自增列实现
- oracle列插入字符串+自增(people001、people002格式)
- oracle 自增列
- oracle 自增列
- oracle自增列
- oracle实现自增长列
- oracle实现自增长列
- AndroidStudio的快捷键大全
- Android ---ListView 的初体验
- windows 64 curl 命令的使用
- yum命令基本用法
- c语言练习题(面试题)
- oracle 实现插入自增列
- Spring boot打包时报错(spring boot Unable to find a single main class from the following candidates)
- 应用启动黑屏处理
- 通过键盘输入一串小写字母(a~z)组成的字符串。请编写一个字符串过滤程序,若字符串中出现多个相同的字符,将非首次出现的字符过滤掉。
- MVC,MVVM简单理解
- 关于Toleft的一点思考
- 标识符及命名规范
- 06、C语言-结构体
- ios UIDevice类以及Info.plist文件