DROP TABLE IF EXISTS variables;
CREATE TEMP TABLE variables (
name PRIMARY KEY NOT NULL,
val_real REAL,
val_integer INTEGER,
val_blob BLOB,
val_text TEXT);
-- Declare.
INSERT INTO variables (name) VALUES ('some_name');
-- Set.
UPDATE variables SET val_text = 'some_value' WHERE name = 'some_name' LIMIT 1;
-- Reference.
(SELECT coalesce(v.val_real, v.val_integer, v.val_blob, v.val_text)
FROM variables v WHERE v.name = 'some_name')