0
DELIMITER $$
CREATE PROCEDURE students.getStudents (IN p_id INT, OUT p_full_name VARCHAR(30))
BEGIN 
    SELECT students.full_name INTO p_full_name
    FROM students
    WHERE students.id = p_id
END $$
DELIMITER ;
jarlh
  • 42,561
  • 8
  • 45
  • 63
camerons2001
  • 41
  • 1
  • 9
  • 2
    Which dbms are you using? – jarlh May 22 '20 at 07:00
  • I'm using mysql – camerons2001 May 22 '20 at 07:02
  • Does this answer your question? [Delimiters in MySQL](https://stackoverflow.com/questions/10259504/delimiters-in-mysql) – Roman Leliuk May 22 '20 at 07:15
  • How are you executing this code? "Delimiter" is a keyword for the client (specifically the MySQL client, and some others that mimic this behaviour). – Solarflare May 22 '20 at 07:22
  • https://ibb.co/QXX4jfJ – camerons2001 May 22 '20 at 07:28
  • Not your immediate error but the select needs a terminator. – P.Salmon May 22 '20 at 07:50
  • 1) Semicolon after SELECT statement is lost. 2) Does your client software NEEDS in delimiter re-assign really? – Akina May 22 '20 at 08:17
  • I don't recognize the tool you are using to create the procedure, but it doesn't seem to reuire (or support) a delimiter, but has a special code area for procedures (e.g. it knows it is a procedure). You need to check your manual for what to write there (e.g. you may also not need the `drop` there), and/or tell us which program you are using, so someone can tell you how to use this function. – Solarflare May 22 '20 at 12:39

1 Answers1

0

You do not need in DELIMITER re-assign and BEGIN-END block because your procedure has one statement:

CREATE PROCEDURE students.getStudents (IN p_id INT, OUT p_full_name VARCHAR(30))
    SELECT students.full_name INTO p_full_name
    FROM students
    WHERE students.id = p_id;
Akina
  • 39,301
  • 5
  • 14
  • 25