Java 获取Oracle ROWID

本文介绍了Oracle数据库中ROWID的概念及用途。ROWID作为每行记录的唯一标识符,可以被视为虚拟列,存储着每行的ID。通过使用ROWID,可以实现对数据的快速检索与更新操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A ROWID is an identification tag unique for each row of an Oracle Database table. The ROWID can be thought of as a virtual column, containing the ID for each row.

The oracle.sql.ROWID class is supplied as a container for ROWID SQL data type.

If you include the ROWID pseudo-column in a query, then you can retrieve the ROWIDs with the result set getString method. You can also bind a ROWID to a PreparedStatement parameter with the setString method. This enables in-place updating, as in the example that follows.
Note: Use the oracle.sql.ROWID class, only when you are
using J2SE 1.5. For JSE 6, you should use the standard
java.sql.RowId interface instead.
 
  
ResultSet rst = stmt.executeQuery("select rowid,name from friend");
...
String rowid=rst.getString(1);
...

//or

RowId rowid = rst.getRowId(1); // Get the ROWID as a String
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值