MySQL Forums
Forum List  »  Stored Procedures

Re: Error creating Stored Procedure
Posted by: Peter Brawley
Date: October 26, 2020 10:36AM

Let's see the MySQL version, the error message, and the result of ...

Show Create Table tblPrime;
Show Create Table tblPrimeUnitName;

Expressions like ...

LOCATE('T', tblPrime.DateTimeStamp) - 1),
'%Y-%m-%d') AS DateStamp,
STR_TO_DATE(SUBSTR(tblPrime.DateTimeStamp, 12, 8),
'%H:%i:%s') AS TimeStamp,

... assume table data will conform to specific expectations; it's usually better practice to encapsulate such computations in functions with graceful error handling.

Likewise for expressions like ...

ROUND((tblPrimeUnitName.AIN6HR - tblPrimeUnitName.AIN6LR) / (tblPrimeUnitName.AIN6HV - tblPrimeUnitName.AIN6LV) * tblPrime.AIN6 + tblPrimeUnitName.AIN6HR - (tblPrimeUnitName.AIN6HR - tblPrimeUnitName.AIN6LR) / (tblPrimeUnitName.AIN6HV - tblPrimeUnitName.AIN6LV) * tblPrimeUnitName.AIN6HV,

... that are prone to division-by-zero errors.

Options: ReplyQuote

Written By
October 26, 2020 09:52AM
Re: Error creating Stored Procedure
October 26, 2020 10:36AM

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.