I am currently trying to create a stored procedure on my MySQL stored on Google Cloud Platform.
The SQL is correct seeing that I can create the procedure locally, but I can't figure out why it won't work from the command line:
mysql> CREATE PROCEDURE helpme
-> (
-> @cid varchar(4)
-> )
-> AS
-> DECLARE @res_cnt INT
-> DECLARE @name CHAR(10)
->
-> SELECT @res_cnt = COUNT(*) FROM dbo.TripGuides WHERE GuideNum = @cid
-> SELECT @name = LastName FROM dbo.Guide WHERE GuideNum = @cid
-> PRINT @name + ' has ' + CAST (@res_cnt AS VARCHAR(10))+' guides.';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@cid varchar(4)
)
AS
DECLARE @res_cnt INT
DECLARE @name CHAR(10)
SELECT @res_cn' at line 3
mysql>
I've tried a few different things thank I have bumped into. When declaring @cid
I tried both
@cid CHAR(4)
@cid VARCHAR(4)
resulting in the same error being thrown.