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错误. ...
随机推荐
- flask url_for()和redirect的区别
一. 两者用来重定向的时候,被操作的对象不同. redirect直接是url,就是app.route的路径参数. url_for()是对函数进行操作. from flask import Flask, ...
- 看似不是dfs的dfs HDU-1455
Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
- hnust 土豪金的加密解密
问题 G: 土豪金的加密与解密 时间限制: 1 Sec 内存限制: 128 MB提交: 466 解决: 263[提交][状态][讨论版] 题目描述 有一位姓金的同学因为买了一部土豪金,从此 ...
- loadrunner rtsp协议模拟
在核心网做过3年的sip消息模拟,所以rtsp消息模拟只要知道信令消息交互就非常顺利了 RTSP 实时流传输协议, 是TCP/IP协议体系中的一个应用层协议, 该协议定义了一对多应用程序如何有效地通过 ...
- iOS-文本段落样式NSMutableParagraphStyle与NSParagraphStyle的使用和一些富文本处理属性
开发过程中,经常会遇到动态计算行高的问题, - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)op ...
- POJ 2983:Is the Information Reliable?(差分约束)
题目大意:有n个点在一条直线上,有两类关系:P(x,y,v)表示x在y北边v距离处,V(x,y)表示x在y北边至少1距离出,给出一些这样的关系,判断是否有矛盾. 分析: 差分约束模板题,约束条件P:a ...
- mapserver+openlayers实现左键点击查询
效果图 第一步,配置自己的mapfile,在要查询的图层LAYER对象内加上HEADER,TEMPLATE,FOOTER三个参数,同时,TEMPLATE fooOnlyForWMSGetFeature ...
- java运行时间计算
long startTime = System.currentTimeMillis(); //获取开始时间 doSomething(); //测试的代码段 long endTime = System. ...
- Linux服务器重启后nvidia-smi无法使用的解决方法
服务器上的nvidia显卡驱动用的好好的,突然有一天,服务器断电了,然后恢复之后发现常用的nvidia-smi命令无法使用了,具体显示什么无法建立和驱动器的通信之类的,上网查了一堆,发现问题的核心:l ...
- python(7)-- 文件I/O
1 打印到屏幕:print 语句.你可以给它传递零个或多个用逗号隔开的表达式.此函数把你传递的表达式转换成一个字符串表达式,并将结果写到标准输出,eg:print "Python 是一个非常 ...
