java中怎样使用游标?急!!!

robinwrh 2004-10-25 04:42:24
java中是否能直接定义游标?能定义的话应该怎样定义?怎样使用?应注意些什么?
最好能有实例。小弟不胜感激!
...全文
400 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhifangtu 2004-10-25
  • 打赏
  • 举报
回复

正解:youthy_yy(阿远<广州>)
vongood 2004-10-25
  • 打赏
  • 举报
回复
gz
shangqiao 2004-10-25
  • 打赏
  • 举报
回复
ResultSet不就是是游标吗
youthy_yy 2004-10-25
  • 打赏
  • 举报
回复
java中没有,但可以用Types.OTHER来代替
另外如果用的是Oracle数据库,则很方便的用OracleTypes.CURSOR来获取游标 (需要class12.jar驱动程序)
tsingien 2004-10-25
  • 打赏
  • 举报
回复
ava.sql
Interface ResultSetpublic boolean absolute(int row)
throws SQLException


Moves the cursor to the given row number in this ResultSet object.

If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.

If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on.

An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row.

Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().

Parameters:

row - the number of the row to which the cursor should move. A positive number indicates the row number counting from the beginning of the result set; a negative number indicates the row number counting from the end of the result set

Returns:

true if the cursor is on the result set; false otherwise

Throws:

SQLException - if a database access error occurs, or the result set type is TYPE_FORWARD_ONLY

Since:

1.2

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧