一尘不染

Oracle从多个表中删除行

sql

我正在尝试从多个表中删除行,但在medewerkers M处遇到语法错误,

谁能告诉我我在这里做错了吗?:

declare

v_mnr medewerkers.mnr%type;

procedure ontsla_med(p_mnr in medewerkers.mnr%type)

IS

BEGIN

    DELETE FROM medewerkers m, INSCHRIJVINGEN i , UITVOERINGEN u WHERE m.MNR = p_mnr and i.cursus = p_mnr and u.docent = p_mnr;

END ontsla_med;

BEGIN

    ontsla_med(7000);

END;

好像删除语句是错误的?


阅读 151

收藏
2021-03-17

共1个答案

一尘不染

做不到 它必须是三个单独的删除。

DELETE 
  FROM medewerkers
 WHERE mnr = p_mnr;

DELETE 
  FROM UITVOERINGEN 
 WHERE cursus = p_mnr;

DELETE 
  FROM UITVOERINGEN 
 WHERE docent = p_mnr;
2021-03-17