1# Saving initial value of stored_program_cache in a temporary variable
2SET @start_value = @@global.stored_program_cache;
3SELECT @start_value;
4@start_value
5256
6# Display the DEFAULT value of stored_program_cache
7SET @@global.stored_program_cache  = DEFAULT;
8SELECT @@global.stored_program_cache;
9@@global.stored_program_cache
10256
11# Verify default value of variable
12SELECT @@global.stored_program_cache  = 256;
13@@global.stored_program_cache  = 256
141
15# Change the value of stored_program_cache to a valid value
16SET @@global.stored_program_cache  = 512;
17SELECT @@global.stored_program_cache;
18@@global.stored_program_cache
19512
20# Change the value of stored_program_cache to invalid value
21SET @@global.stored_program_cache  = -1;
22Warnings:
23Warning	1292	Truncated incorrect stored_program_cache value: '-1'
24SELECT @@global.stored_program_cache;
25@@global.stored_program_cache
260
27SET @@global.stored_program_cache =100000000000;
28Warnings:
29Warning	1292	Truncated incorrect stored_program_cache value: '100000000000'
30SELECT @@global.stored_program_cache;
31@@global.stored_program_cache
32524288
33SET @@global.stored_program_cache = 0;
34SELECT @@global.stored_program_cache;
35@@global.stored_program_cache
360
37SET @@global.stored_program_cache = 10000.01;
38ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
39SET @@global.stored_program_cache = ON;
40ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
41SET @@global.stored_program_cache= 'test';
42ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
43SET @@global.stored_program_cache = '';
44ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
45# Test if accessing session stored_program_cache gives error
46SET @@session.stored_program_cache = 0;
47ERROR HY000: Variable 'stored_program_cache' is a GLOBAL variable and should be set with SET GLOBAL
48# Check if accessing variable without SCOPE points to same global variable
49SET @@global.stored_program_cache = 512;
50SELECT @@stored_program_cache = @@global.stored_program_cache;
51@@stored_program_cache = @@global.stored_program_cache
521
53# Restore initial value
54SET @@global.stored_program_cache = @start_value;
55SELECT @@global.stored_program_cache;
56@@global.stored_program_cache
57256
58