I have been trying to write a stored procedure in MySQL using the SQL Explorer plugin. Here is the whole procedure:
DELIMITER !!
CREATE PROCEDURE recalcAndUpdateStudentGPA(IN @studentID) MODIFIES SQL DATA
BEGIN
CREATE VIEW StudentGrades AS SELECT
Student.univID,
Enrollment.gradeObtained,
GradeNumericalEquiv.numericalEquiv,
Course.credits,
(GradeNumericalEquiv.numericalEquiv * Course.credits) AS effectiveCredits
FROM Student NATURAL JOIN Enrollment
NATURAL JOIN GradeNumericalEquiv NATURAL JOIN Course
WHERE Student.univID = @studentID;
UPDATE Student SET GPA =
(SELECT (SUM(effectiveCredits)/SUM(numericalEquiv)) AS GPA
FROM StudentGrades)
WHERE Student.univID = @studentID;
DROP VIEW StudentGrades;
END !!
DELIMITER ;
I am having a problem with the DELIMITER command. When I enter it directly into the MySQL command-line interface, it works just fine. However, when I run the above prcedure or even just the DELIMITER command alone from SQL Explorer, I get an error message that directs me to refer to the manual for the correct syntax that is to be used near 'DELIMITER !!.
And also, I have tried different delimiters apart from !!.
Hope someone can give me a work around or a fix.
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have been trying to write a stored procedure in MySQL using the SQL Explorer plugin. Here is the whole procedure:
DELIMITER !!
CREATE PROCEDURE recalcAndUpdateStudentGPA(IN @studentID) MODIFIES SQL DATA
BEGIN
CREATE VIEW StudentGrades AS SELECT
Student.univID,
Enrollment.gradeObtained,
GradeNumericalEquiv.numericalEquiv,
Course.credits,
(GradeNumericalEquiv.numericalEquiv * Course.credits) AS effectiveCredits
FROM Student NATURAL JOIN Enrollment
NATURAL JOIN GradeNumericalEquiv NATURAL JOIN Course
WHERE Student.univID = @studentID;
UPDATE Student SET GPA =
(SELECT (SUM(effectiveCredits)/SUM(numericalEquiv)) AS GPA
FROM StudentGrades)
WHERE Student.univID = @studentID;
DROP VIEW StudentGrades;
END !!
DELIMITER ;
I am having a problem with the DELIMITER command. When I enter it directly into the MySQL command-line interface, it works just fine. However, when I run the above prcedure or even just the DELIMITER command alone from SQL Explorer, I get an error message that directs me to refer to the manual for the correct syntax that is to be used near 'DELIMITER !!.
And also, I have tried different delimiters apart from !!.
Hope someone can give me a work around or a fix.
Thank you.