How To Commit Just One Data Block Changes In Oracle Forms
You have an Oracle Form in which you have multiple data blocks and requirement is to commit just one data block changes and not to effect any other data blocks. But suppose you have a commit_form button also in form which will commit all the data block changes and that functionality is ok and it should be there. But for a specific block there is a requirement to commit only that block changes when edited.
If you got this kind of requirement then you can insert and update records from that data block to database externally, I mean using insert and update statements and not by Oracle form's default commit behavior.
To accomplish this task you need to give a push button to the user to save explicitly that data block changes. I have created a form for this example and below is the screen shot of this form:
You can download this form with the following button: Download
As you can see in above picture, there are two blocks, first one is Department and the second one is Employees and there is a push button labeled Commit Employees. In this form if user will change the data in both data blocks and presses the Commit Employees button then it will save only the Employees data block changes.
Following is the code is written in Commit Employees button to perform this task:
DECLARE
CURSOR c_emp (p_emp emp.empno%TYPE)
IS
SELECT 'Y'
FROM emp
WHERE emp.empno = p_emp;
v_exists VARCHAR2 (1);
BEGIN
GO_BLOCK ('Emp');
FIRST_RECORD;
LOOP
IF :SYSTEM.record_status = 'CHANGED'
OR:SYSTEM.record_status = 'INSERT'
THEN
OPEN c_emp (:emp.empno);
FETCH c_emp INTO v_exists;
CLOSE c_emp;
IF NVL (v_exists, 'N') = 'Y'
THEN
UPDATE emp
SET ename = :emp.ename,
job = :emp.job,
mgr = :emp.mgr,
hiredate = :emp.hiredate,
sal = :emp.sal,
comm = :emp.comm,
deptno = :emp.deptno
WHERE empno = :emp.empno;
ELSE
INSERT INTO emp (empno,
ename,
job,
mgr,
hiredate,
sal,
comm,
deptno)
VALUES (:emp.empno,
:emp.ename,
:emp.job,
:emp.mgr,
:emp.hiredate,
:emp.sal,
:emp.comm,
:emp.deptno);
END IF;
END IF;
IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN
EXIT;
END IF;
NEXT_RECORD;
END LOOP;
FORMS_DDL ('commit');
-- REQUERY TO REFRESH CHANGES
CLEAR_BLOCK (no_validate);
GO_BLOCK ('dept');
CLEAR_BLOCK (no_validate);
EXECUTE_QUERY;
EXCEPTION
WHEN OTHERS
THEN
FORMS_DDL ('rollback');
MESSAGE ('error occurred.');
END;
What this above code will do is, it will check if record status is changed or new and then it will check from database that the record exists or not and if exists then it will update else will insert a new record.
How To Commit Just One Data Block Changes In Oracle Forms的更多相关文章
- Giving Data Backup Option in Oracle Forms 6i
Suppose you want to give the data backup option in Oracle Forms application to some client users, wh ...
- Writing Text File From A Tabular Block In Oracle Forms
The example given below for writing text file or CSV using Text_IO package from a tabular block in O ...
- Populating Tabular Data Block Manually Using Cursor in Oracle Forms
Suppose you want to populate a non-database data block with records manually in Oracle forms. This t ...
- ORA-01578 data block corrupted 数据文件损坏 与 修复 (多为借鉴 linux)
好吧,先说说造成崩溃的原因: 使用redhat 5.9 Linux 作为数据库服务器, 周五数据库正在使用中,硬关机造成数据库文件部分损坏(周一上班时,应用程序启动不起来,查看日志文件时,发现一个数据 ...
- Data Block Compression
The database can use table compression to eliminate duplicate values in a data block. This section d ...
- Data Block -- Uncompressed
Overview of Data Blocks Oracle Database manages the logical storage space in the data files of a dat ...
- Hadoop EC 踩坑 :data block 缺失导致的 HDFS 传输速率下降
环境:hadoop-3.0.2 + 11 机集群 + RS-6-3-1024K 的EC策略 状况:某天,往 HDFS 上日常 put 业务数据时,发现传输速率严重下降 分析: 检查集群发现,在之前的传 ...
- ORA-01578 ORACLE data block corrupted (file # 29, block # 2889087)
BW数据库后台报错如下:F:\oracle\SBP\saptrace\diag\rdbms\sbp\sbp\trace ORA-01578: ORACLE data block corrupted ( ...
- 模拟ORA-26040: Data block was loaded using the NOLOGGING option
我们知道通过设置nologging选项.能够加快oracle的某些操作的运行速度,这在运行某些维护任务时是非常实用的,可是该选项也非常危急,假设使用不当,就可能导致数据库发生ORA-26040错误. ...
随机推荐
- 第1章 HTML基础
1.1 HTML概述 1.1.1 什么是HTML HTML(Hyper Text Markup Language,超 文本 标记 语言)是纯文本类型的语言,它是Internet上用于编写网页的主要语言 ...
- 精通CSS高级Web标准解决方案(6、对表单与表格应用样式)
使用fieldset input[type="text"] { width:200px; } input:focus,textarea:focus{background:#ffc; ...
- 关于eclipse连接mysql jar包
步骤如下: 右键工程--选择build path -- add Libraries. 弹出框选user library,点击next. 弹出框点击add libraries . 继续点击new ,输 ...
- Spring4.0实战 rest相关
package com.paic.pay.merchant.web; import com.paic.pay.merchant.entity.MerchantUser; import com.paic ...
- Vue2.0 - 自定义指令 vue-directive
Vue.directive('指令',function(el,binding,vnode){ el.style='color:'+binding.value;}); el : 指令所绑定的元素,可以用 ...
- Hive 01 概述、安装配置
概述 数据仓库:是一个面向主题的.集成的.不可更新的.随时间不变化的数据集合,它用于支持企业或组织的决策分析处理. 数据仓库的结构和建立过程: 数据源 数据存储及管理 ETL Extract 提取 T ...
- noip2018 pre——Dp
Dp专题 1011: KC的瓷器 (porcelain) 题目描述 KC来到了一个盛产瓷器的国度.他来到了一位商人的店铺.在这个店铺中,KC看到了一个有n(1<=n<=100)排的柜子,每 ...
- 转JSON提示No serializer found for class
在调用Json串生成方法时,提示: No serializer found for class com.jeremxy.domain.EpgDetail and no propertiesdiscov ...
- HDU 4786 最小生成树变形 kruscal(13成都区域赛F)
Fibonacci Tree Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- 【自己D自己】WC2019总结
好吧写着写着写成自黑文了. 这是我时隔一个月写的,寒假非常自闭,肝童年游戏赛尔号来着…… 没玩过的无视 作为一个 $BJ$ 蒟蒻,第一次飞到广州二中这么远的地方(我没出过国,去广州算是很远的一次了). ...
