1

According to the MySQL documentation, stored procedures are executed with the sql_mode in which they were created.

I need to change the sql_mode parameter for a specific stored procedure

SHOW CREATE PROCEDURE command - shows the current sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

How can it be changed, specifically - remove strict mode

Thanks

3
  • 3
    You'll need to export the procedure's definition, then DROP PROCEDURE and then re-create it with CREATE PROCEDURE under the correct sql_mode.
    – Dai
    Commented Dec 12, 2021 at 12:43
  • Thank you Dai it looks like this is the only way
    – Eugene
    Commented Dec 12, 2021 at 14:01
  • @Dai You should post that as an answer, otherwise this question will stay in the "unanswered" queue forever. Commented Dec 12, 2021 at 15:20

1 Answer 1

1
  1. Export the procedure's definition with SHOW CREATE PROCEDURE.
  2. Then DROP PROCEDURE.
  3. Then create a new MySQL session and ensure sql_mode is set correctly.
  4. Then CREATE PROCEDURE with the .sql file you saved in step 1.

Not the answer you're looking for? Browse other questions tagged or ask your own question.