MySQL Forums
Forum List  »  Newbie

Simple procedure won't compile
Posted by: John Viescas
Date: May 01, 2015 03:17AM

I'm not a "newbie" at SQL, but I'm posting here in hopes that I get a quick answer. I'm trying to define a simple Procedure:

CREATE PROCEDURE CH17_Delete_Styles_No_Entertainer
DELETE FROM Musical_Styles
WHERE (StyleID NOT IN
(SELECT StyleID
FROM Entertainer_Styles))
AND (StyleID NOT IN
(SELECT StyleID
FROM Musical_Preferences));

MySQL Workbench (running 5.6) flags the DELETE keyword with error 1064. I can copy and paste the DELETE statement into a new query window, and it compiles and executes just fine. I have a View defined just before this in the query string that works perfectly:

CREATE VIEW CH17_Delete_Styles_No_Entertainer_Query
AS
SELECT *
FROM Musical_Styles
WHERE (StyleID NOT IN
(SELECT StyleID
FROM Entertainer_Styles))
AND (StyleID NOT IN
(SELECT StyleID
FROM Musical_Preferences));

Same syntax except for the DELETE replacing the SELECT *

This is driving me BONKERS!

Options: ReplyQuote


Subject
Written By
Posted
Simple procedure won't compile
May 01, 2015 03:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.