Search code examples
sqlmysqldatabasestored-proceduresout

MySQL "not a variable or NEW pseudo-variable" message


I'm trying to create a procedure that will enter data and then return a message in the OUT parameter, however i'm getting this message "argument 5 for routine hospital.alextest10 is not a variable or NEW pseudo-variable in BEFORE trigger"

I have this as my procedure:

CREATE PROCEDURE alextest10
(IN a_patid CHAR(3), IN a_patnam VARCHAR(12), IN a_consno CHAR(3), IN a_ward CHAR(2),
OUT a_message VARCHAR(50))
BEGIN
SET a_message = 'Database updated';
INSERT INTO patient (patient_id, patient_name, consultant_no, ward_no)
VALUES (a_patid, a_patnam, a_consno, a_ward);
END!

And, this is my call command:

CALL alextest10 ('p99', 'Madeuppy', '999', 'w9', a_message)!

Can you help?

Much appreciated!


Solution

  • CALL alextest10 ('p99', 'Madeuppy', '999', 'w9', @a_message);
    SELECT @a_message;