I've recently discovered the feature of defining global variables for DB2. I wanted to utilize it. My use case is to create a variable containing the value for Previous Banking day.
CREATE VARIABLE SCHEMA.GV_PREV_PROC_DATE DATE DEFAULT ((SELECT SCHEMA.DATE_UTIL.PREVIOUS_BANKING_DAY(PROC_DATE) FROM SCHEMA.TBL_PARAMETERS));
This particular date is usually referenced throughout various programs. Instead of querying everytime, I thought of placing it in the variable. Based on the DB2 specification, the value is session scoped. Since we utilize datsource pooling, the value is not updated once the date is incremented by the end of day batch program, unless i reset my connection pool.
Is there a way to propagate the updates to existing sessions, or is my use case totally not appropriate for this global variables? By the way I'm using DB2 10.1 LUW