将 PL/SQL 触发器转换为 T-SQL
我不擅长T-SQL。下面的触发器如何进入T-SQL?因为每个在 T-SQL 中都不起作用。
CREATE OR REPLACE TRIGGER DSS.TRG_DEPO_STOK_IZLEME
BEFORE INSERT OR UPDATE
ON DSS.CR_DEPO_STOK FOR EACH ROW
BEGIN
INSERT INTO CR_DEPO_STOK_IZLEME
(ID_DEPO_STOK_IZLEME
, ID_DEPO_STOK
, MT_MIKTAR_ESKI
, MT_MIKTAR_YENI
, EKLEME_TARIHI
)
VALUES (SEQ_ID_DEPO_STOK_IZLEME.NEXTVAL
, :NEW.ID_DEPO_STOK
, :OLD.MT_MIKTAR
, :NEW.MT_MIKTAR
, SYSDATE
);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
I am not good at T-SQL. How can does following trigger into T-SQL? For each doesn't work in T-SQL.
CREATE OR REPLACE TRIGGER DSS.TRG_DEPO_STOK_IZLEME
BEFORE INSERT OR UPDATE
ON DSS.CR_DEPO_STOK FOR EACH ROW
BEGIN
INSERT INTO CR_DEPO_STOK_IZLEME
(ID_DEPO_STOK_IZLEME
, ID_DEPO_STOK
, MT_MIKTAR_ESKI
, MT_MIKTAR_YENI
, EKLEME_TARIHI
)
VALUES (SEQ_ID_DEPO_STOK_IZLEME.NEXTVAL
, :NEW.ID_DEPO_STOK
, :OLD.MT_MIKTAR
, :NEW.MT_MIKTAR
, SYSDATE
);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能类似于
There are no row triggers in TSQL,序列也不会出现,直到下一个版本,所以我假设
ID_DEPO_STOK_IZLEME
将是一个identity
列。Probably something like
There are no row triggers in TSQL also sequences will not appear until the next version so I have assumed that
ID_DEPO_STOK_IZLEME
will be anidentity
column.