Scrollable Cursors

Java ResultSet本质是游标而非结果集 ResultSet是JDBC中对数据库游标(Cursor)的抽象,代表客户端与服务端之间动态数据流的访问句柄,而非内存中的集合容器。其设计源于关系型数据库查询引擎的流式执行模型,通过fetchSize、type、concurrency等维度实现内存可控、时序可管、错误可隔离的数据消费机制。它解决的核心问题是Java应用在高并发、大数据量场景下如何安全高效地搬运数据库结果——既避免java.lang.OutOfMemoryError,又规避Connection关闭导致的‘ResultSet closed’异常 阅读详情

Scrollable Cursors

1.       What is scrollable cursors?

When a cursor is declared as scrollable, you can use FETCH statements to:

l         Jump around and directly retrieve a row which is located at any position within the cursor result table

l         Scroll backwards as well as forwards

2.       What happens when a scrollable cursor is opened?

The qualifying rows are copied to a declared temporary table which is automatically created by DB2. Scrolling is performed on the result table.

DB2 deletes the result table when the cursor is closed.

3.       How to scroll within the result table?

l         FETCH BEFORE or FETCH ABSOLUTE 0

l         FETCH FIRST

l         FETCH LAST or FETCH ABSOLUTE -1

l         FETCH PRIOR

l         FETCH CURRENT

l         FETCH or FETCH NEXT

l         FETCH ABSOLUTE 5 or FETCH ABSOLUTE -5

l         FETCH RELATIVE 3 or FETCH RELATIVE -3

4.       Four types of scrollable cursors

4.1 Insensitive Scrollable Cursor

l         The cursor cannot be used to issue positioned updates and deletes

l         FETCH processing on the result table is insensitive to the changes made to the base table after the result table has been built

l         The number and content of the rows stored in the result table is fixed at OPEN CURSOR time and does not change

4.2 Sensitive Static Scrollable Cursor

l         The cursor can be used to issue positioned updates and deletes

l         FETCH processing on the result table is sensitive to the changes made to the base table after the result table has been built

l         The number of rows in the result table does not change but the row content can change

It can cause an Update Hole or Delete Hole in the result table, when another application updates or deletes the row in the base table which is also in the result table.

4.3 Sensitive Dynamic Scrollable Cursor

l         Specifies that size of result table is not fixed at OPEN cursor time

l         Cursor has complete visibility to changes

l         FETCH executed against base table since no temporary result table created

A dynamic scrollable cursor does not materialize the result table at any time. Instead, it scrolls directly on the base table and is therefore sensitive to all committed inserts, updates, and deletes.

4.4 ASENSITIVE

l         DB2 determines sensitivity of cursor

l         If Read-only, it behaves as an insensitive cursor

l         If not ready-only, SENSITVE DYNAMIC is used for maximum sensitivity

l         Mainly for Client applications that don’t care whether or not server supports the sensitivity or scrollability

5.       Cursor Type Comparison

Cursor Type

Result Table

Visibility of Own Changes

Visibility of Others’ Changes

Updatability

(*)

Non-Scrollalbe

(SQL contains a JOIN or sort, etc)

Fixed,  workfile

No

No

No

Non-Scrollalbe

No workfile, base table access

Yes

Yes

Yes

INSENSITIVE SCROLL

Fixed, declared temp table

No

No

No

SENSITIVE STATIC SCROLL

Fixed, declared temp table

Yes(INSERT not allowed)

Yes(Not INSERT)

Yes

SENSITIVE DYNAMIC SCROLL

No declared temp table, base table access

Yes

Yes

Yes

 

 
【UVM实战】第七章:UVM中的寄存器模型(1)寄存器模型简介 寄存器模型简介~ 阅读详情

相关推荐

避坑指南:PyTorch ConvLSTM参数配置的那些坑(hidden_dim/kernel_size/num_layers详解)

本文深度解析PyTorch ConvLSTM中hidden_dim、kernel_size和num_layers三大核心参数的配置技巧,提供实战指南和性能优化建议。通过实验数据揭示参数组合的内在规律,帮助开发者避免常见配置陷阱,提升时空序列建模效果。特别针对视频预测、气象预报等应用场景,给出黄金参数组合方案和调试技巧。

vv45678的博客 702

数据库常见面试题 —— 8. 游标 (CURSOR) 的定义、分类和使用

Oracle 游标的定义、分类、使用

gly1653810310的博客 1万+

Pintos project 1 实验报告(代码分享)

任务一 Alarm Clock 用到的相干目录有: pintos/src/devices time.h && time.c pintos/src/threads thread.h && thread.c 预期pass希望:暂无,安装pintos之后,第一次对threads进行make check操作,可以发现以alarm--开头的前六个文件,以及mlfqs-fair-2和mlfqs-fair-20文件,一开始就测试成功pass。但是为了避免对后期的修改有影响,这里还是要

m0_53112875的博客 6860

sql语法回顾:“fetch: 提取类型 last 不能与只进游标一起使用。”

declare @qk char(4) declare cqk cursor for select qkb.qkh from qkb,tgb where (qkm = '计算机学报' and qkb.qkh = tgb.qkh and sgjg = '未通过') open cqk fetch last from cqk into @qk update tgb set sgjg = '通过

Little_Limbo的专栏 8567

Abel逆变换及其求解方法

Abel逆变换常应用在轴对称的、光学薄的火焰、羽流或等离子体重建。

weixin_49783507的博客 8369

华为Watch的ECG功能技术分析

华为Watch的ECG(心电图)功能通过硬件传感器、算法优化和医疗认证的结合,实现了对心脏电活动的监测和房颤(AFib)等心律失常的预警。采用医疗级ECG模拟前端芯片(AFE),如TI(德州仪器)的ADS1292R等,支持低噪声、高采样率(通常≥200Hz)。结合PPG(光学心率)数据交叉验证,提高检测可靠性(如ECG和PPG心率不一致时触发警告)。通过RR间期变异性判断心律是否规则,识别房颤(AFib)的典型特征(如不规则不规则心律)。结合加速度计数据,识别手臂运动导致的信号失真,动态调整算法参数。

xu_wenming的博客 6441

来科普下游标(MSSQL)这东西。。。

刚刚接到一个面试电话,对头的先生问我懂不懂触发器和存储过程,当时是觉得有些好笑,毕竟“视图、触发和存储”是咱数据库工程师的吉祥三宝,怎么可能不认识?只是稍后他还问了下游标这东西,仔细想想我是不常使用Cursor,因为大表用上游标来遍历会降低查询效率,一般都是推荐面向集合的方式来解决问题而非遍历。不过既然有游标这东西,必定有它存在的价值,不妨就来扒皮下游标~ 有玩过asp这种过时语言的朋...

dcof99817的博客 193

FlashBootloader01-基于UDS的Flash Bootloader【架构篇】

文章目录1 Flash Bootloader的依赖项2 Flash Bootloader中使用的UDS的主要功能3 Flash Bootloader更新固件3.1 初始化MCU3.2 刷写流程 1 Flash Bootloader的依赖项 通常Flash Bootloader由以下四方面组成: UDS协议 上位机「编写Bootloader Sequence」 通信驱动(如CAN ) Flash Driver 2 Flash Bootloader中使用的UDS的主要功能 1. 10 02服务 客户端

3589

游标sql server_SQL Server游标属性

游标sql server A SQL Server cursor is a database object that is used to process the data in a set row by row. In this article, we will review how to create a cursor and different attributes used whil...

culuo4781的博客 778

ICM20948 DMP代码详解(69)

ICM20948 DMP代码详解(69)

phmatthaus的专栏 615

【Bug已解决】codex: rate limit 429 / Too many requests / RPM exceeded — CodeX CLI 速率限制解决方案

CodeX CLI 触发 429 速率限制(RPM/TPM/并发)的解决方案,含请求间隔、自动重试、便宜模型、Tier 升级与多 Key 轮换。

博客 4891

Oracle pro*c/c++ scrollable cursor

#include <stdio.h> #include <string.h> #include <stdlib.h> #include "sqlca.h" //申明库函数 extern sqlgls(char * , size_t *, size_t * ); extern sqlglmt(void *,char *,size_t *,size_t *); typedef char dnameType[20]; typedef char locType[20]; EX.

u012516419的博客 248

基于YOLO26深度学习框架的智能停车场管理系统的算法研究实现方法

本文研究了基于YOLO26深度学习框架的智能停车场管理系统实现方法。系统采用CSPDarknet53作为主干网络,结合特征金字塔和注意力机制提升检测性能。通过数据预处理、模型训练和停车分析三个主要模块,实现了车位占用检测、车辆类型识别等功能。实验结果表明,该方法在检测精度和速度方面表现优异,为智能停车场管理提供了有效的技术解决方案。

一键难忘的博客 571

jdbc scrollable resultset

jdbc 的resultset有三种cursor类型: ResultSet.TYPE_FORWARD_ONLY:表示cursor只能向前移动,absolute first last等方法无效。 ResultSet.TYPE_SCROLL_INSENSITIVE:表cursor可以自由移动,但对于修改不敏感 ResultSet.TYPE_SCROLL_SENSITIVE:表cursor...

iteye_20980的博客 314

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Scroll Cursor的一个应用!

CurSor游标对于Sql的新手而言一直是个比较难的问题,其困难不在于理解,而在于应用;

清雅小屋 4198

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

深入理解JDBC Scrollable ResultSet

JDBC2.0后提出了三种不同的cursor类型,用户代码可以在创建Statement指定cursor类型,如下: Statement createStatement( int resultSetType, int resultSetConcurrency) cursor类型 ResultSet.TYPE_FORWARD_ONLY    默认的cursor类型,仅仅支持向前forward,不支持...

yt 854

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

JDBC ResultSet分析

cursor类型 ResultSet.TYPE_FORWARD_ONLY 默认的cursor类型,仅仅支持向前forward,不支持backforward,random,last,first操作,类似单向链表。 TYPE_FORWARD_ONLY类型通常是效率最高最快的cu

您好:nevanzax 967

DB2 BIND

                                              BIND1.         Two method of BINDl         Bind all DBRMs directly into one application plan as belowBIND PLAN(PLAN1) MEMBER(Main,Sub1,Sub2)l     

Mainframer的专栏 2421

Indicator Variables

 Indicator Variables1.       Function: Processing NULL Data2.       The value of Indicator Variable (SMALLINT)l         >=0 (usually 0), indicate that the column is not NULLl         l    

Mainframer的专栏 2245

Unique Constraint, Primary Key and Unique Index

Unique Constraint, Primary Key and Unique Index1.       Unique ConstraintEnsure no duplicate value exists in the columns for which unique constraint has been defined.Regardless of when a unique

Mainframer的专栏 1600

Referential Integrity

                                  Referential Integrity1.       A PARENR KEY value must be UNIQUE, and can’t be NULL.2.       A FOREIGN KEY value must match a PARENT KEY or be NULL3.       DB2 e

Mainframer的专栏 1490

LOAD

                    Load 1.       LOAD JCL//LEBRONJ  JOB (12345678),LEBRON,MSGCLASS=H,             //        MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID          //UTIL EXEC DSNUPROC,SYSTEM=DB8G,UID

Mainframer的专栏 1237

UNLOAD

                                  UNLOAD1.       UNLOAD JCL//LEBRONJ  JOB (12345678),LEBRON,MSGCLASS=H,            //        MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID         //UTIL EXEC DSNUPROC,

Mainframer的专栏 1135

Privileges granted to users after database created

      Privileges granted to users after database created1. To Database Owner     DBADM authority, along with CONNECT, CREATETAB, BINDADD, CREATE_NOT_FENCED, IMPLICIT_SCHEMA, and LOAD privileges, a

Mainframer的专栏 944

DB2 Data Type

DB2 Data Type

Mainframer的专栏 920

DB2 隔离级别

                                                                  DB2 Isolation Level1.Repeatable ReadIf a transaction scans 1000 rows but only retrieves 10, locks are acquired and held on all 100

Mainframer的专栏 719
上一篇: Indicator Variables
下一篇: Typical Access Paths
Mainframer
博客等级 码龄19年 7粉丝 45原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值