Oracle:如何获取刚插入的行的序列号? [英] Oracle: How do I get the sequence number of the row just inserted?
本文介绍了Oracle:如何获取刚插入的行的序列号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取刚刚插入的行的序列号?
How do I get the sequence number of the row just inserted?
推荐答案
插入...返回.
declare
s2 number;
begin
insert into seqtest2(x) values ('aaa') returning seq into s2;
dbms_output.put_line(s2);
end;
此处的"seq"是指您要将其值存储到变量s2中的列的名称.
"seq" here refers to the name of the column whose value you want to store into variable s2.
在python中:
myseq=curs.var(cx_Oracle.NUMBER)
curs.prepare("insert into seqtest2(x) values('bbb') returning seq into :x")
curs.execute(None, x=myseq)
print int(myseq.getvalue())
这篇关于Oracle:如何获取刚插入的行的序列号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文