MySQL Forums
Forum List  »  Stored Procedures

Error creating Stored Procedure
Posted by: Jerry Dziuba
Date: October 26, 2020 09:52AM

I have a query that runs fine but when I use it in the create stored procedure wizard it gives me an error of "The object's DDL statement contains syntax errors.
Any help would be greatly appreciated. Procedure follows:

CREATE PROCEDURE test ()
BEGIN
SELECT
tblPrime.UnitName,
STR_TO_DATE(LEFT(tblPrime.DateTimeStamp,
LOCATE('T', tblPrime.DateTimeStamp) - 1),
'%Y-%m-%d') AS DateStamp,
STR_TO_DATE(SUBSTR(tblPrime.DateTimeStamp, 12, 8),
'%H:%i:%s') AS TimeStamp,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC1,
(tblPrime.TC1 - 32) / 1.8) AS TC1,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC2,
(tblPrime.TC2 - 32) / 1.8) AS TC2,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC3,
(tblPrime.TC3 - 32) / 1.8) AS TC3,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC4,
(tblPrime.TC4 - 32) / 1.8) AS TC4,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC5,
(tblPrime.TC5 - 32) / 1.8) AS TC5,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC6,
(tblPrime.TC6 - 32) / 1.8) AS TC6,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC7,
(tblPrime.TC7 - 32) / 1.8) AS TC7,
IF(tblPrimeUnitName.TempCorF = 'F',
tblPrime.TC8,
(tblPrime.TC8 - 32) / 1.8) AS TC8,
ROUND((tblPrimeUnitName.AIN0HR - tblPrimeUnitName.AIN0LR) / (tblPrimeUnitName.AIN0HV - tblPrimeUnitName.AIN0LV) * tblPrime.AIN0 + tblPrimeUnitName.AIN0HR - (tblPrimeUnitName.AIN0HR - tblPrimeUnitName.AIN0LR) / (tblPrimeUnitName.AIN0HV - tblPrimeUnitName.AIN0LV) * tblPrimeUnitName.AIN0HV,
1) AS AIN0,
ROUND((tblPrimeUnitName.AIN1HR - tblPrimeUnitName.AIN1LR) / (tblPrimeUnitName.AIN1HV - tblPrimeUnitName.AIN1LV) * tblPrime.AIN1 + tblPrimeUnitName.AIN1HR - (tblPrimeUnitName.AIN1HR - tblPrimeUnitName.AIN1LR) / (tblPrimeUnitName.AIN1HV - tblPrimeUnitName.AIN1LV) * tblPrimeUnitName.AIN1HV,
1) AS AIN1,
ROUND((tblPrimeUnitName.AIN2HR - tblPrimeUnitName.AIN2LR) / (tblPrimeUnitName.AIN2HV - tblPrimeUnitName.AIN2LV) * tblPrime.AIN2 + tblPrimeUnitName.AIN2HR - (tblPrimeUnitName.AIN2HR - tblPrimeUnitName.AIN2LR) / (tblPrimeUnitName.AIN2HV - tblPrimeUnitName.AIN2LV) * tblPrimeUnitName.AIN2HV,
1) AS AIN2,
ROUND((tblPrimeUnitName.AIN3HR - tblPrimeUnitName.AIN3LR) / (tblPrimeUnitName.AIN3HV - tblPrimeUnitName.AIN3LV) * tblPrime.AIN3 + tblPrimeUnitName.AIN3HR - (tblPrimeUnitName.AIN3HR - tblPrimeUnitName.AIN3LR) / (tblPrimeUnitName.AIN3HV - tblPrimeUnitName.AIN3LV) * tblPrimeUnitName.AIN3HV,
1) AS AIN3,
ROUND((tblPrimeUnitName.AIN4HR - tblPrimeUnitName.AIN4LR) / (tblPrimeUnitName.AIN4HV - tblPrimeUnitName.AIN4LV) * tblPrime.AIN4 + tblPrimeUnitName.AIN4HR - (tblPrimeUnitName.AIN4HR - tblPrimeUnitName.AIN4LR) / (tblPrimeUnitName.AIN4HV - tblPrimeUnitName.AIN4LV) * tblPrimeUnitName.AIN4HV,
1) AS AIN4,
ROUND((tblPrimeUnitName.AIN5HR - tblPrimeUnitName.AIN5LR) / (tblPrimeUnitName.AIN5HV - tblPrimeUnitName.AIN5LV) * tblPrime.AIN5 + tblPrimeUnitName.AIN5HR - (tblPrimeUnitName.AIN5HR - tblPrimeUnitName.AIN5LR) / (tblPrimeUnitName.AIN5HV - tblPrimeUnitName.AIN5LV) * tblPrimeUnitName.AIN5HV,
1) AS AIN5,
ROUND((tblPrimeUnitName.AIN6HR - tblPrimeUnitName.AIN6LR) / (tblPrimeUnitName.AIN6HV - tblPrimeUnitName.AIN6LV) * tblPrime.AIN6 + tblPrimeUnitName.AIN6HR - (tblPrimeUnitName.AIN6HR - tblPrimeUnitName.AIN6LR) / (tblPrimeUnitName.AIN6HV - tblPrimeUnitName.AIN6LV) * tblPrimeUnitName.AIN6HV,
1) AS AIN6,
ROUND((tblPrimeUnitName.AIN7HR - tblPrimeUnitName.AIN7LR) / (tblPrimeUnitName.AIN7HV - tblPrimeUnitName.AIN7LV) * tblPrime.AIN7 + tblPrimeUnitName.AIN7HR - (tblPrimeUnitName.AIN7HR - tblPrimeUnitName.AIN7LR) / (tblPrimeUnitName.AIN7HV - tblPrimeUnitName.AIN7LV) * tblPrimeUnitName.AIN7HV,
1) AS AIN7,
IF(tblPrime.DIN0 = 0,
tblPrimeUnitName.DIN0Closed,
tblPrimeUnitName.DIN0Open) AS DIN0,
IF(tblPrime.DIN1 = 0,
tblPrimeUnitName.DIN1Closed,
tblPrimeUnitName.DIN1Open) AS DIN1,
IF(tblPrime.DIN2 = 0,
tblPrimeUnitName.DIN2Closed,
tblPrimeUnitName.DIN2Open) AS DIN2,
IF(tblPrime.DIN3 = 0,
tblPrimeUnitName.DIN3Closed,
tblPrimeUnitName.DIN3Open) AS DIN3,
IF(tblPrime.DIN4 = 0,
tblPrimeUnitName.DIN4Closed,
tblPrimeUnitName.DIN4Open) AS DIN4,
IF(tblPrime.DIN5 = 0,
tblPrimeUnitName.DIN5Closed,
tblPrimeUnitName.DIN5Open) AS DIN5,
IF(tblPrime.DIN6 = 0,
tblPrimeUnitName.DIN6Closed,
tblPrimeUnitName.DIN6Open) AS DIN6,
IF(tblPrime.DIN6 = 0,
tblPrimeUnitName.DIN6Closed,
tblPrimeUnitName.DIN6Open) AS DIN7,
tblPrimeUnitName.UnitGroup,
tblPrimeUnitName.Description,
tblPrimeUnitName.Alias,
tblPrimeUnitName.Location,
tblPrimeUnitName.Password,
tblPrimeUnitName.TC1Label,
tblPrimeUnitName.TC2Label,
tblPrimeUnitName.TC3Label,
tblPrimeUnitName.TC4Label,
tblPrimeUnitName.TC5Label,
tblPrimeUnitName.TC6Label,
tblPrimeUnitName.TC7Label,
tblPrimeUnitName.TC8Label,
tblPrimeUnitName.AIN0Label,
tblPrimeUnitName.AIN1Label,
tblPrimeUnitName.AIN2Label,
tblPrimeUnitName.AIN3Label,
tblPrimeUnitName.AIN4Label,
tblPrimeUnitName.AIN5Label,
tblPrimeUnitName.AIN6Label,
tblPrimeUnitName.AIN7Label,
tblPrimeUnitName.AIN0Units,
tblPrimeUnitName.AIN1Units,
tblPrimeUnitName.AIN2Units,
tblPrimeUnitName.AIN3Units,
tblPrimeUnitName.AIN4Units,
tblPrimeUnitName.AIN5Units,
tblPrimeUnitName.AIN6Units,
tblPrimeUnitName.AIN7Units,
tblPrimeUnitName.TC1L,
tblPrimeUnitName.TC1H,
tblPrimeUnitName.TC2L,
tblPrimeUnitName.TC2H,
tblPrimeUnitName.TC3L,
tblPrimeUnitName.TC3H,
tblPrimeUnitName.TC4L,
tblPrimeUnitName.TC4H,
tblPrimeUnitName.TC5L,
tblPrimeUnitName.TC5H,
tblPrimeUnitName.TC6L,
tblPrimeUnitName.TC6H,
tblPrimeUnitName.TC7L,
tblPrimeUnitName.TC7H,
tblPrimeUnitName.TC8L,
tblPrimeUnitName.TC8H,
tblPrimeUnitName.AIN0L,
tblPrimeUnitName.AIN0H,
tblPrimeUnitName.AIN1L,
tblPrimeUnitName.AIN1H,
tblPrimeUnitName.AIN2L,
tblPrimeUnitName.AIN2H,
tblPrimeUnitName.AIN3L,
tblPrimeUnitName.AIN3H,
tblPrimeUnitName.AIN4L,
tblPrimeUnitName.AIN4H,
tblPrimeUnitName.AIN5L,
tblPrimeUnitName.AIN5H,
tblPrimeUnitName.AIN6L,
tblPrimeUnitName.AIN6H,
tblPrimeUnitName.AIN7L,
tblPrimeUnitName.AIN7H
FROM
tblPrime
LEFT OUTER JOIN
tblPrimeUnitName ON tblPrime.UnitName = tblPrimeUnitName.UnitName
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Error creating Stored Procedure
160
October 26, 2020 09:52AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.