创建触发器而不是删除

问题描述 投票:0回答:1

我有这个错误,但我不知道这是什么意思。我想将删除查询替换为更新查询,但是会引发此错误。我正在学习使用sql,所以我不知道还能尝试什么

create or replace trigger Miembros_V_IOD instead of delete on Miembros_V for each row Begin update Miembros set (end_date = sysdate) where Miembros.nick = :old.nick and Miembros.club = :old.club; end;

我有这个错误,但我不知道这是什么意思。我想将删除查询替换为更新查询

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9VNmtpVi5wbmcifQ==” alt =“收到错误”>

oracle triggers datatrigger
1个回答
1
投票

错误指向=符号。您会收到一个PL / SQL错误-尽管这是由内部SQL引起的-并且触发PL / SQL错误中的行号从DECLARE(如果有)或BEGIN开始,not 从整个CREATE语句的开头开始。因此,2/34指的是PL / SQL部分第二行的字符34,即:

   update Miembros set (end_date = sysdate)

... =

您不应该在(end_date = sysdate)后面加上括号:

create or replace trigger Miembros_V_IOD
instead of delete on Miembros_V 
for each row
begin
    update Miembros set end_date = sysdate
    where Miembros.nick = :old.nick
    and Miembros.club = :old.club;
end;
/

View MIEMBROS_V created.

db<>fiddle

© www.soinside.com 2019 - 2024. All rights reserved.