SQL> create table test(c integer);表已创建。 SQL> set serveroutput on size 100000 SQL> declare 2 c varchar2(200); 3 begin 4 insert into test values(3) return rowid into c; 5 dbms_output.put_line('rowid='||c); 6 end; 7 / rowid=AAAA+eAAPAAAAAKAACPL/SQL 过程已成功完成。rowid是指数据保存在数据文件的具体物理位置,如果没有移动数据,就一直固定,多次查询不会改变rowid的值的。
已经返回新插入行的rowid了嘛,再举个应用的例子 SQL> variable c varchar2(20) SQL> insert into test values(3) return rowid into :c;已创建 1 行。SQL> print :cC -------------------------------- AAAA+eAAPAAAAAKAAD SQL> select * from test where rowid='AAAA+eAAPAAAAAKAAD'; C ---------- 3已选择 1 行。SQL> select * from test where rowid=:c; C ---------- 3已选择 1 行。 ------------------------------------------------------- 楼主把你的应用说的再详细点吧.
用 ado的recordset对象 addnew 一行 update后 如何得到rowsid 例如:vb代码dim trs as new adodb.recorset trs.open "select table1.f1,table1.rowid from table1",连接,游标,锁 trs.addnew trs("f1")="xxxx" trs.updatedebug.print trs("rowid") 此时如何得不到rowid
debug.print trs("table1.rowid")试试...
to njhart2003() debug.print trs("table1.rowid") 该字段不存在
如果对数据重新整理后,可能会改变比如说我几次检索 同样的行 会 对应同样的RowID,这是没问题的SQL> declare
2 v_out varchar2(20);
3 begin
4 insert into t values(1,1) return rowid into v_out;
5 dbms_output.put_line(v_out);
6 end;
7 /
AAAGHLAABAAAIV0AADPL/SQL 过程已成功完成。已用时间: 00: 00: 00.70
SQL> select rowid,t.* from t;ROWID AAA BBB
------------------ ---------- ----------
AAAGHLAABAAAIV0AAA 1 2
AAAGHLAABAAAIV0AAB 3 4
AAAGHLAABAAAIV0AAC 5 6
AAAGHLAABAAAIV0AAD 1 1已用时间: 00: 00: 00.50
SQL>
SQL> set serveroutput on size 100000
SQL> declare
2 c varchar2(200);
3 begin
4 insert into test values(3) return rowid into c;
5 dbms_output.put_line('rowid='||c);
6 end;
7 /
rowid=AAAA+eAAPAAAAAKAACPL/SQL 过程已成功完成。rowid是指数据保存在数据文件的具体物理位置,如果没有移动数据,就一直固定,多次查询不会改变rowid的值的。
可是我没办法得到新增加的行的 RowID环境 ado2.5 oracle9i
SQL> variable c varchar2(20)
SQL> insert into test values(3) return rowid into :c;已创建 1 行。SQL> print :cC
--------------------------------
AAAA+eAAPAAAAAKAAD
SQL> select * from test where rowid='AAAA+eAAPAAAAAKAAD'; C
----------
3已选择 1 行。SQL> select * from test where rowid=:c; C
----------
3已选择 1 行。
-------------------------------------------------------
楼主把你的应用说的再详细点吧.
例如:vb代码dim trs as new adodb.recorset
trs.open "select table1.f1,table1.rowid from table1",连接,游标,锁
trs.addnew
trs("f1")="xxxx"
trs.updatedebug.print trs("rowid")
此时如何得不到rowid
debug.print trs("table1.rowid")
该字段不存在