Oracle中利用Trigger进行工作
Oracle数据库中,有些情况下,对数据记录需要记录日志,或保存操作历史等情况.在此我们可以借助“数据库Trigger”进行。下面以一例进行说明:
CREATE OR REPLACE TRIGGER aits_auth_group_auth_trga_diu
AFTER update OR DELETE OR INSERT on aits_authority_group_auth
for each row
/*****************************************************************************************
*
* Trigger Name : aits_auth_group_auth_trga_diu
* Description : Log insert, Modify ,delete action to History table
* Version : 1.0
*****************************************************************************************/
declare
BEGIN
IF inserting THEN
INSERT INTO aits_auth_group_auth_history
(application_code, auth_id, ranage_code,
group_code, module_code, function_code,
creation_date, created_by, last_update_date,
last_updated_by, action_type)
VALUES
(:new.application_code, :new.auth_id, :new.ranage_code,
:new.group_code, :new.module_code, :new.function_code,
:new.creation_date, :new.created_by, :new.last_update_date,
:new.last_updated_by, aits_pak_common.InsertDesc);
ELSIF DELETING THEN
INSERT INTO aits_auth_group_auth_history
(application_co
相关文档:
Oracle sqlplus远程连接数据库
sqlplus username/password@yunSID_192.168.1.5
公司使用linux开发机进行程序开发时,由于开发用Oracle数据库是由日方提供,所以经常使用sqlplus连接到远程数据库上进行开发,例如:
sqlplus username/password@servicename
于是想,用我的两台电脑双机互联试一试,也玩个&ldq ......
将一个数据库的某用户的所有表导到另外数据库的一个用户下面的例子
exp userid=system/manager owner=username1 file=expfile.dmp
imp userid=system/manager fromuser=username1 touser=username2 ignore=y file=expfile.dmp
ORACLE数据库有两类备份方法。第一类为物理备份,该方法实现数据库的完整恢复,但数据 ......
今天从数据库中导出几张表,但发现需要的序列都没导出来,于是网上找找方法,发现了如下语句
select
'create sequence USERNAME.'|| t.sequence_name || ' minvalue '||MIN_VALUE||' maxvalue '||MAX_VALUE||' start with '||LAST_NUMBER||' increment by '||INCREMENT_BY||' cache '||CACHE_SIZE||' ;'
from dba_sequen ......
ORACLE数据库的基本语法集锦
-- 表
create table test (names varchar2(12),
dates date,
&nb ......
Oracle数据库有两类备份方法。第一类为物理备份,该方法实现数据库的完整恢复,但数据库必须运行在归挡模式下(业务数据库在非归挡模式下运行),且需要极大的外部存储设备,例如磁带库;第二类备份方式为逻辑备份,业务数据库采用此种方式,此方法不需要数据库运行在归挡模式下,不但备份简单,而且可以不需要外部存储设备 ......