skip to Main Content

I am trying to create a stored procedure in MariaDB, and I keep getting the error

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘END’ at line 9

DELIMITER $$
Create procedure patientcheck(IN hospitalcode int(11))
BEGIN 

Select Staff1.First_name, Staff1.Surname, Staff1.Dep1
From Patient1, Staff1, Staff_allocator
Where Patient1.PatientID1=Staff_allocator.PatientID1 and Staff1.StaffID1=Staff_allocator.StaffID1
And Patient1.PatientID1=hospitalcode 

END $$
DELIMITER ;

any help will be appreciated thanks

2

Answers


  1. Chosen as BEST ANSWER

    im not sure how or why my issue was solved, but after rewriting my code character by character, even without changing anything ( and re adding the ";"), the code finally ran. (ive been told that phpmyadmin is very buggy and unstable and is prone to silly issues like this)


  2. You are missing a semicolon at the end of your select statement. You changed the delimiter to $$, but you still need to add the semicolon to the end of the query. I ran this exact code on a MariaDB instance with the semicolon added and it ran without error.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search