MySQL Stored Procs -
-
Hi all; I am learning to write stored procs on MySQL and am going crazy.
DELIMITER $$
DROP PROCEDURE IF EXISTS CleanCopyEnvData$$
CREATE PROCEDURE CleanCopyEnvData ()
BEGINinsert into EnvData(UserDate, XAction, Balance, UserID)
select
CAST(udate as Date)
, CAST(amount1 as Decimal(6,3))
, CAST(amount2 as Decimal(6,3))
, CAST(UID as UnSigned)
from
DataLoad;END $$
DELIMITER ;
I get an error:
Error starting at line : 17 in command -
END $$
Error at Command Line : 17 Column : 1
Error report -
SQL Error: 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 'END $$' at line 1I am using Oracle SQL Developer and the INSERT statement works ok when executed on its own. I can do these things blindfolded with my arms tied on MSSQL. Any help appreciated. EG.
-
Hi all; I am learning to write stored procs on MySQL and am going crazy.
DELIMITER $$
DROP PROCEDURE IF EXISTS CleanCopyEnvData$$
CREATE PROCEDURE CleanCopyEnvData ()
BEGINinsert into EnvData(UserDate, XAction, Balance, UserID)
select
CAST(udate as Date)
, CAST(amount1 as Decimal(6,3))
, CAST(amount2 as Decimal(6,3))
, CAST(UID as UnSigned)
from
DataLoad;END $$
DELIMITER ;
I get an error:
Error starting at line : 17 in command -
END $$
Error at Command Line : 17 Column : 1
Error report -
SQL Error: 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 'END $$' at line 1I am using Oracle SQL Developer and the INSERT statement works ok when executed on its own. I can do these things blindfolded with my arms tied on MSSQL. Any help appreciated. EG.
You don't need the delimiter expression $$ after your END statement.
DELIMITER $$
DROP PROCEDURE IF EXISTS CleanCopyEnvData$$
CREATE PROCEDURE CleanCopyEnvData ()
BEGINinsert into EnvData(UserDate, XAction, Balance, UserID)
select
CAST(udate as Date)
, CAST(amount1 as Decimal(6,3))
, CAST(amount2 as Decimal(6,3))
, CAST(UID as UnSigned)
from
DataLoad;END
Everyone dies - but not everyone lives
-
You don't need the delimiter expression $$ after your END statement.
DELIMITER $$
DROP PROCEDURE IF EXISTS CleanCopyEnvData$$
CREATE PROCEDURE CleanCopyEnvData ()
BEGINinsert into EnvData(UserDate, XAction, Balance, UserID)
select
CAST(udate as Date)
, CAST(amount1 as Decimal(6,3))
, CAST(amount2 as Decimal(6,3))
, CAST(UID as UnSigned)
from
DataLoad;END
Everyone dies - but not everyone lives
-
Glad to help.
Everyone dies - but not everyone lives