不需要存储过程
update aa set col=(select tt.id from (select rownum id,t.* from (select * from aa order by col) t) tt where tt.col=aa.col);
update aa set col=(select tt.id from (select rownum id,t.* from (select * from aa order by col) t) tt where tt.col=aa.col);
解决方案 »
- 数据备份遇到的菜鸟问题
- oracle语句问题
- Oracle企业管理器中关闭数据库需要填主机用户和密码,vista homepremium,请问怎么填?我以管理员登陆,并填了信息,结果说主机密码错误,怎么解决
- ORACLE 函数求当前时间为第几周?
- 按月统计人员总数的SQL语句求教
- Instant Client版本选择问题,求教!
- 在哪里可以弄到ORACLE的内部参数?
- 如何通过域名访问远程的Oracle数据库
- 一个比较奇怪的现象
- 大家来看看,我的数据库出现ORA-00600,怎么办啊!
- 这个权限有哪些作用(哪些功能啊)grant resource to test;可以得到哪些权限呢,如insert 之类吗?
- 怎样在外部或sqlplus中调用function?
to bzszp(SongZip) ,
是新增数据,不是修改数据.
select col+1 from aa a where not exists ( select 1 from aa b where b.col=(a.col+1));
select min(new_value) from
( select col+1 new_value from aa a where not exists ( select 1 from aa b where b.col=(a.col+1)) );若是任一个不连续的值,可以
select col+1 new_value from aa a where not exists ( select 1 from aa b where b.col=(a.col+1)) and rownum < 2;后者的效率要高很多。
to daydayupliq(强强),
以前是用序列,用触发器应该怎么做?
before insert or update or delete on a
for each row
declare
v_id varchar2(20);
begin
select min(id) into v_id from a where (lead(id,1,0) over(order by rownum)-id)>1;
if inserting then
select v_id into :new.id from dual;
end if;
end;
/