×
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.
Any reason anyone can think of, or documentation explaining why, a
CREATE VARIABLE statement is not a valid procedure-statement?
[
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzsqlprocstmt.htm?lang=en]
A routine [or dynamic] compound-statement can have a
SQL-variable-declaration [DECLARE SQL-variable-name], so a variable can
be had, scoped there. But why can I not effect the creation of a global
variable name? I am unsure, but seems DB2 LUW 11 may allow the CREATE
VARIABLE outside of a SQL-routine-body [thus in none of: procedure,
function, or trigger], so apparently that leaves a dynamic
compound-statement as the only procedure-statement usage.? For me, IBM
i 7.1 DB2 SQL would not allow the CREATE VARIABLE in a dynamic
compound-statement.
Seems a stupid restriction, given I can circumvent easily enough, by
issuing the request dynamically; e.g. in an EXECUTE IMMEDIATE. But why
should I have to?
And that circumvention had me encountering something interesting;
seems in 7.2 [I was looking at newer docs than the release I was on] the
/string-expression/ of 7.1 has become just /expression/ on 7.2, and
apparently "execute immediate expression" will finally accept a
literal\constant string-expression rather than only a variable; a
capability that apparently had always been limited to PL/1. I can not
verify, so if anyone wants to humor the group...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.