0

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

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
Eugene
  • 151
  • 8
  • 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 Dec 12 '21 at 12:43
  • Thank you Dai it looks like this is the only way – Eugene Dec 12 '21 at 14:01
  • @Dai You should post that as an answer, otherwise this question will stay in the "unanswered" queue forever. – Bill Karwin Dec 12 '21 at 15:20

1 Answers1

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.
Dai
  • 141,631
  • 28
  • 261
  • 374