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.