Here's my problem. I need access to the system hostname from a function call. The only way I know to get the hostname is via this call:

select reg_var_value from table(sysproc.reg_list_variables()) as registryinfo WHERE reg_var_name = 'DB2SYSTEM'

Problem is the performance is not very good and I'm using this call in a lot of places (mostly for key generation).

If anyone can offer me a better way to get the hostname please do.

Otherwise.. I'm thinking I can just cache the fetched hostname in a local table so it only has to be fetched once. Problem there is that there is no guarantee that the hostname won't ever change. And if I just fill it on once I will miss this change. It would suffice if I could set/reset it every time the database was started. Anyone know a good way to do this? Maybe a temp table that lives for the duration of the database execution, or a way to have a script or command run at startup? Any other ideas?
Thanks.
btw, this will be on a 9.7 database..