Here is a simple example with insert. First off I assume you have create the global variable because thats the first step.
Then you set the value of the variable
Set test.my_value = 'This is my text'
Then you use that global variable in your sql insert
insert into test.my_table
(field1, field2, field3)
I didnt test this but I dont see a syntax error, but get the idea.