On 12 Dec 2012 08:54, CRPence wrote:
<<SNIP>> SQL Global Variables, available with IBM i 7.1 database SQL,
may be able to be used [in place of the disallowed Host Variables] in
the WHERE clause of the CTE of the CREATE TABLE AS.? Perhaps someone
can confirm or disprove.? <<SNIP>>

A doc snippet in the following message suggests *not* and thus already seems to be disproved by that documentation:
http://archive.midrange.com/midrange-l/201212/msg00794.html

For convenience, that snippet is repeated here [although this time with the URL]:
IBM i 7.1 Information Center -> Database -> Reference -> SQL reference -> Statements
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzhctabl.htm
_i CREATE TABLE i_
The CREATE TABLE statement defines a table at the current server. The definition must include its name and the names and attributes of its columns.
"... The select-statement must not refer to [<ed:> host] variables or global variables, or include parameter markers. ..."


And FWiW, other quotes from doc references for another SQL; again, just to show how this apparently is not a restriction unique to the DB2 SQL:
"Host variables are not permitted within a DDL statement"
"Bind and define variables not allowed in CREATE statement
Cause: Host variables cannot appear in a CREATE statement. If the makeup of a CREATE statement cannot be known until run time, a dynamic SQL statement must be used to execute it. That is, the program must accept or build the CREATE statement at run time, store it in a host string, then EXECUTE it."


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.