× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 16-Dec-2015 21:19 -0600, Justin Dearing wrote:
If I CREATE VARIABLE foo INT DEFAULT 5 it will always be 5 until I do
a SET, but the SET foo = 6; is only scoped to the session.

Yep. But how might one create a variable for which the value is scoped beyond the /session/?


So, its actually not a big deal for my current application because
the variable (a start date for new business rules) should be a
constant, and I'm only going to change it in QA. If the business
rules get delayed, then a CREATE/DROP is fine. However, what if I
had a variable that was a counter of some kind? What if I expected
some job to be constantly changing the value of a global variable
and several other jobs to be periodically SELECT SCHEMA.VARIABLE
FROM SYSIBM.SYSDUMY1? Is DROP/CREATE in a transaction the
appropriate behavior? Is there a risk that the SELECT might occur
when the variable doesn't exist?

Either the term /global/ should be viewed with skepticism, or the perspective of what the term /global/ means relative to /session/ probably needs adjustment; /session/ does not mean inter-process. Global Variable is in some manner, for the ability to share the data, only as similarly /global/ as the Global Temporary Table (GTT). See "Notes" in the CREATE VARIABLE docs:

[https://www.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_72/db2/rbafzcvariable.htm]
_CREATE VARIABLE_
"The CREATE VARIABLE statement defines a global variable at the application server.
...
_Notes_

_Session scope_: Global variables have a session scope. This means that although they are available to all sessions that are active on the database, their value is private for each session.
..."


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.