× 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.



I'd open a PMR - seems to be a bug.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"


-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
CRPence
Gesendet: Saturday, 21.5 2016 21:31
An: midrange-l@xxxxxxxxxxxx
Betreff: CREATE VARIABLE used in a compound-statement

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/rbafzsqlprocstm
t.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...

--
Regards, Chuck

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.