以下是本人在sql server下写的触发器,运行的很好,由于不会oracle的pl/sql,该不成oracle下的,好痛苦啊!!CREATE TRIGGER identical_insert ON ch_mon
instead of INSERT
AS
if @@rowcount=0 return
declare @tbl varchar(64),@recno bigint,@itype varchar(64),@otype varchar(64)
select @tbl=tbl,@recno=recno,@itype=type from inserted
if not exists(select 1 from ch_mon where recno=@recno and tbl=@tbl)
begin
insert into ch_mon select * from inserted
return
end
select @otype=type from ch_mon where recno=@recno and tbl=@tbl
if @otype='insert' and @itype='delete'
begin
delete from ch_mon where recno=@recno and tbl=@tbl
return
end
if @otype='update' and @itype='delete'
update ch_mon set type='delete'where recno=@recno and tbl=@tbl
go我知道instead触发器可以用raise_application_error(-2000,'form instead-of trigger')实现,
但是语句怎么写都得到“警告: 创建的触发器带有编译错误。”!!!