1SET @start_global_value = @@global.max_error_count;
2SELECT @start_global_value;
3@start_global_value
464
5SET @start_session_value = @@session.max_error_count;
6SELECT @start_session_value;
7@start_session_value
864
9drop database if exists demo;
10create database demo;
11use demo;
12create procedure proc_1()
13begin
14declare exit handler for sqlexception
15resignal sqlstate '45000' set message_text='Oops in proc_1';
16call proc_2();
17end
18$$
19create procedure proc_2()
20begin
21declare exit handler for sqlexception
22resignal sqlstate '45000' set message_text='Oops in proc_2';
23call proc_3();
24end
25$$
26create procedure proc_3()
27begin
28declare exit handler for sqlexception
29resignal sqlstate '45000' set message_text='Oops in proc_3';
30call proc_4();
31end
32$$
33create procedure proc_4()
34begin
35declare exit handler for sqlexception
36resignal sqlstate '45000' set message_text='Oops in proc_4';
37call proc_5();
38end
39$$
40create procedure proc_5()
41begin
42declare exit handler for sqlexception
43resignal sqlstate '45000' set message_text='Oops in proc_5';
44call proc_6();
45end
46$$
47create procedure proc_6()
48begin
49declare exit handler for sqlexception
50resignal sqlstate '45000' set message_text='Oops in proc_6';
51call proc_7();
52end
53$$
54create procedure proc_7()
55begin
56declare exit handler for sqlexception
57resignal sqlstate '45000' set message_text='Oops in proc_7';
58call proc_8();
59end
60$$
61create procedure proc_8()
62begin
63declare exit handler for sqlexception
64resignal sqlstate '45000' set message_text='Oops in proc_8';
65call proc_9();
66end
67$$
68create procedure proc_9()
69begin
70declare exit handler for sqlexception
71resignal sqlstate '45000' set message_text='Oops in proc_9';
72## Do something that fails, to see how errors are reported
73drop table oops_it_is_not_here;
74end
75$$
76call proc_1();
77ERROR 45000: Oops in proc_1
78show warnings;
79Level	Code	Message
80Error	1051	Unknown table 'demo.oops_it_is_not_here'
81Error	1644	Oops in proc_9
82Error	1644	Oops in proc_8
83Error	1644	Oops in proc_7
84Error	1644	Oops in proc_6
85Error	1644	Oops in proc_5
86Error	1644	Oops in proc_4
87Error	1644	Oops in proc_3
88Error	1644	Oops in proc_2
89Error	1644	Oops in proc_1
90SET @@session.max_error_count = 5;
91SELECT @@session.max_error_count;
92@@session.max_error_count
935
94call proc_1();
95ERROR 45000: Oops in proc_1
96show warnings;
97Level	Code	Message
98Error	1644	Oops in proc_5
99Error	1644	Oops in proc_4
100Error	1644	Oops in proc_3
101Error	1644	Oops in proc_2
102Error	1644	Oops in proc_1
103SET @@session.max_error_count = 7;
104SELECT @@session.max_error_count;
105@@session.max_error_count
1067
107call proc_1();
108ERROR 45000: Oops in proc_1
109show warnings;
110Level	Code	Message
111Error	1644	Oops in proc_7
112Error	1644	Oops in proc_6
113Error	1644	Oops in proc_5
114Error	1644	Oops in proc_4
115Error	1644	Oops in proc_3
116Error	1644	Oops in proc_2
117Error	1644	Oops in proc_1
118SET @@session.max_error_count = 9;
119SELECT @@session.max_error_count;
120@@session.max_error_count
1219
122call proc_1();
123ERROR 45000: Oops in proc_1
124show warnings;
125Level	Code	Message
126Error	1644	Oops in proc_9
127Error	1644	Oops in proc_8
128Error	1644	Oops in proc_7
129Error	1644	Oops in proc_6
130Error	1644	Oops in proc_5
131Error	1644	Oops in proc_4
132Error	1644	Oops in proc_3
133Error	1644	Oops in proc_2
134Error	1644	Oops in proc_1
135drop database demo;
136SET @@global.max_error_count = @start_global_value;
137SELECT @@global.max_error_count;
138@@global.max_error_count
13964
140SET @@session.max_error_count = @start_session_value;
141SELECT @@session.max_error_count;
142@@session.max_error_count
14364
144