--创建触发器
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row
when (new.attr_id = '4DC345D9-071F-4534-B1C1-B43A93D1C988')
declare
--定义变量
user_name varchar2(64);
action varchar2(64);
begin
--从另外一张表获取用户姓名
SELECT USER_WID INTO USER_NAME FROM MWT_OM_OBJ WHERE OBJ_ID = :NEW.OBJ_ID;
--记录操作类型
CASE
WHEN inserting THEN
action := 'I';
WHEN updating THEN
action := 'U';
END CASE;
--更新日志记录
insert into bhdzd_log
(obj_id, attr_id, modify_time, modify_type,username)
values
(:new.obj_id, :new.attr_id, sysdate, action,user_name);
end biud_gqzydp_attachment;
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row
when (new.attr_id = '4DC345D9-071F-4534-B1C1-B43A93D1C988')
declare
--定义变量
user_name varchar2(64);
action varchar2(64);
begin
--从另外一张表获取用户姓名
SELECT USER_WID INTO USER_NAME FROM MWT_OM_OBJ WHERE OBJ_ID = :NEW.OBJ_ID;
--记录操作类型
CASE
WHEN inserting THEN
action := 'I';
WHEN updating THEN
action := 'U';
END CASE;
--更新日志记录
insert into bhdzd_log
(obj_id, attr_id, modify_time, modify_type,username)
values
(:new.obj_id, :new.attr_id, sysdate, action,user_name);
end biud_gqzydp_attachment;
解决方案 »
- oracle中如何查看sql的执行计划,一个sql查询结果产生的IO,B树索引查找机制是不是类似于sqlserver的书签查找
- 2次求MAX的SQL写法
- 表空间不够???
- ORALCE触发器问题。
- 请问如何在windows上安装的oracle中修改open_cursors这一参数
- 求sco下安装oracle的文档!!!
- 触发器和事务处理的问题,高手请进!!!!
- 对关键字,用Number型快还是Char型快?
- 请问:“IMP-00020: long column too large for column buffer size (22)”
- 商品图片显示 SQL语句
- oracle 的登录问题 (记所创建的数据库密码)
- 索引的问题
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row /--可改为:
create or replace trigger tri_mwt_om_fsdata_biu
before insert or update on 用户名.mwt_om_fsdata
for each row/--用户名为mwt_om_fsdata表所属的用户
说明没编译通过。
你用什么工具编译的?sqlplus的话会提示你的。 pl/sql developer则可能不会提示(我遇到过)
--创建触发器
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row
when (new.attr_id = '4DC345D9-071F-4534-B1C1-B43A93D1C988')
declare
--定义变量
user_name varchar2(64);
action varchar2(64);
begin
--记录操作类型
if inserting then
action := 'I';
elsif updating then
action := 'U';
end if;
--更新记录
insert into bhdzd_log
(obj_id, attr_id, modify_time, modify_type)
values
(:new.obj_id, :new.attr_id, sysdate, action);
end biud_gqzydp_attachment;
--创建触发器
Create or replace trigger biu_gqzydp_attachment
Before insert or update On mwt_om_fsdata
for each row
when (new.attr_id = '4DC345D9-071F-4534-B1C1-B43A93D1C988')
declare
--定义变量
action varchar2(64);
begin
--记录操作类型
if inserting then
action := 'I';
elsif updating then
action := 'U';
end if;
--更新记录
insert into bhdzd_log
(obj_id, attr_id, modify_time, modify_type)
values
(:new.obj_id, :new.attr_id, sysdate, action);
end biud_gqzydp_attachment;
像这样你仅列出触发器的创建语句,而没有说相关表内容,权限,类型等等。
让我们给你猜个答案吗?