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
2616
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;
34Warnings:
35Warning	1292	Truncated incorrect stored_program_cache value: '0'
36SELECT @@global.stored_program_cache;
37@@global.stored_program_cache
3816
39SET @@global.stored_program_cache = 10000.01;
40ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
41SET @@global.stored_program_cache = ON;
42ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
43SET @@global.stored_program_cache= 'test';
44ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
45SET @@global.stored_program_cache = '';
46ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
47# Test if accessing session stored_program_cache gives error
48SET @@session.stored_program_cache = 0;
49ERROR HY000: Variable 'stored_program_cache' is a GLOBAL variable and should be set with SET GLOBAL
50# Check if accessing variable without SCOPE points to same global variable
51SET @@global.stored_program_cache = 512;
52SELECT @@stored_program_cache = @@global.stored_program_cache;
53@@stored_program_cache = @@global.stored_program_cache
541
55# Restore initial value
56SET @@global.stored_program_cache = @start_value;
57SELECT @@global.stored_program_cache;
58@@global.stored_program_cache
59256
60