//客户退房后记录存入历史记录表 这是用oracle写出来的我对应写出来的sql有问题吗
create or replace TRIGGER deletecustomer
after delete
on customer
for each row
declare
ldate date;
money number;
begin
account(:OLD.RID,:OLD.rdate,ldate,money);
insert into history values
(id_seq.nextval,:OLD.CID,:OLD.RID,:OLD.cname,:OLD.csex,:OLD.ctel,:OLD.rdate,ldate,money);
end deletecustomer;
SQL//客户退房后记录存入历史记录表
create TRIGGER deletecustomer
on Customer
for delete
as
begin
declare
@ID int,
@CID nchar(18),
@RID nchar(3),
@Cname nvarchar(50),
@Csex nchar(1),
@Ctel nchar(11),
@Rdate date,
@Ldate date,
@payMoney int;
select @RID=RID,@CID=CID,@cname=cname,@csex=csex,
@ctel=Ctel,@rdate=rdate from deleted
SET IDENTITY_INSERT history ON
insert into history values (@ID,@CID,@RID,@Cname,@Csex,@Ctel,@Rdate,@Ldate,@payMoney);
SET IDENTITY_INSERT history OFF
end