1

i'm trying to delete rows from multiple tables but i'm getting a syntax error at medewerkers m,

Can anyone tell me what i'm doing wrong here? :

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;

Seems like the delete statement is wrong?

2
  • 1
    One DELETE per table. Commented Sep 26, 2018 at 20:25
  • 2
    Alternatively, you might be trying to delete data from parent and child tables, in which case you might want to create foreign key constraints with the ON DELETE CASCADE option. Commented Sep 26, 2018 at 20:35

1 Answer 1

6

Can't do it. It has to be three separate deletes.

DELETE 
  FROM medewerkers
 WHERE mnr = p_mnr;

DELETE 
  FROM UITVOERINGEN 
 WHERE cursus = p_mnr;

DELETE 
  FROM UITVOERINGEN 
 WHERE docent = p_mnr;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, thought it was possible to add multiple tables at once

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.