当然可以,给你看一个Sybase版Trigger,用于记录xtrybm表 (create table dbo.xtrybm ( xtrybm char(10) not null, xtryxm char(16) not null, xtrymm char(28) not null, xtrycd decimal(2, 0) not null );)的删除情况,以Oracle的SQL语法记录下来,存放在日志表中,再导出成文件,拿到Oracle上执行,以删除Oracle上的相同记录: CREATE TRIGGER tr_del_xtrybm ON xtrybm FOR DELETE AS BEGIN declare @tran_serial decimal(18,0) declare @tran_xtrybm char(10) declare @str_xtrybm varchar(254)--define cursor for deleted declare xtrybm_deleted_cursor CURSOR for select xtrybm from deleted--Open the cursor and scroll it. open xtrybm_deleted_cursor fetch xtrybm_deleted_cursor into @tran_xtrybm while (@@sqlstatus<>2) BEGIN select @tran_serial = isnull(max(tran_sn), 0) from tran_log select @tran_serial = @tran_serial + 1 if ltrim(rtrim(@tran_xtrybm)) is null select @str_xtrybm = "" else select @str_xtrybm = " trim(xtrybm) = '" + convert(varchar(254),@tran_xtrybm) + "' and " insert into tran_log (tran_sn,tran_date,sql_0, sql_1 ) values (@tran_serial, getdate(), "delete xtrybm where ", @str_xtrybm ) fetch xtrybm_deleted_cursor into @tran_xtrybm END close xtrybm_deleted_cursor ENDgo
(create table dbo.xtrybm (
xtrybm char(10) not null,
xtryxm char(16) not null,
xtrymm char(28) not null,
xtrycd decimal(2, 0) not null
);)的删除情况,以Oracle的SQL语法记录下来,存放在日志表中,再导出成文件,拿到Oracle上执行,以删除Oracle上的相同记录:
CREATE TRIGGER tr_del_xtrybm ON xtrybm
FOR DELETE AS
BEGIN
declare @tran_serial decimal(18,0)
declare @tran_xtrybm char(10) declare @str_xtrybm varchar(254)--define cursor for deleted
declare xtrybm_deleted_cursor CURSOR for
select xtrybm
from deleted--Open the cursor and scroll it.
open xtrybm_deleted_cursor
fetch xtrybm_deleted_cursor into
@tran_xtrybm
while (@@sqlstatus<>2)
BEGIN
select @tran_serial = isnull(max(tran_sn), 0) from tran_log
select @tran_serial = @tran_serial + 1
if ltrim(rtrim(@tran_xtrybm)) is null select @str_xtrybm = "" else select @str_xtrybm = " trim(xtrybm) = '" + convert(varchar(254),@tran_xtrybm) + "' and "
insert into tran_log (tran_sn,tran_date,sql_0, sql_1 )
values (@tran_serial,
getdate(),
"delete xtrybm where ",
@str_xtrybm )
fetch xtrybm_deleted_cursor into
@tran_xtrybm
END
close xtrybm_deleted_cursor
ENDgo