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错误. ...
随机推荐
- 使用WMI Filter 实现组策略的筛选!
今天接到一个客户的一个问题,提到需要分系统版本分发相应的MSI程序.比如简体版接受简体版的分发程序,繁体版接受繁体版的分发程序!这个建立组策略的不同版本分发本身不会太难,我们只需要建立两个不同组策略分 ...
- Xmanager用法(export DISPLAY=客户端IP:0.0)
1.在用户的目录下找到文件.bash_profile或profile,用vi对其进行编辑.加入下列命令行: DISPLAY=192.168.88.71:0.0;export DISPLAY 2.如果只 ...
- 使用hibernate建立mysql连接以及生成映射类和配置文件*.cfg.xml
建立数据库连接 找到window—open perspective—myeclipse database explore空白出右键new注意 driver template 和driver class ...
- linux VIM编辑器常用指令
一般模式 查看文本-移动光标 [Ctrl] + [f] 屏幕『向前』移动一页 [Ctrl] + [b] 屏幕『向后』移动一页 n<space> 按下数字后再按空格键,光标会向右移动这一 ...
- bzoj1902【Zju2116】 Christopher
题意:http://www.lydsy.com/JudgeOnline/problem.php?id=1902 sol :一眼可以看出此题应用了lucas定理(逃~ 将n,m都化为p进制,记为a[] ...
- 洛谷P1816 忠诚
P1816 忠诚 569通过 1.5K提交 题目提供者该用户不存在 标签云端 难度普及+/提高 时空限制1s / 128MB 提交 讨论 题解 最新讨论更多讨论 主席树的常数貌似大于线段树… TL ...
- webpack简单使用
1 首先npm init 建立package.json文件 npm init 2 然后全局安装webpack npm install webpack -g ...
- [网络流24题] COGS 搭配飞行员
14. [网络流24题] 搭配飞行员 ★★☆ 输入文件:flyer.in 输出文件:flyer.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 飞行大队 ...
- Array拼接字符串
原文发布时间为:2011-01-12 -- 来源于本人的百度文章 [由搬家工具导入] Array拼接字符串本来就是一种投机取巧的无聊玩意,来源是IE6对字符串的+实现错误一般情况下,如果是语义性的字符 ...
- 用IHTMLDocument2接口获取页面上想要的数据,代替正则表达式
原文发布时间为:2010-07-01 -- 来源于本人的百度文章 [由搬家工具导入] 1. 用 IHTMLDocument2::all 获得所有元素; 2. 用 IHTMLElementCollect ...
