Just spoke with a couple of the database guys at that "fictional"
IBM lab in Rochester - verified that the SELECT statement inside
the CREATE TABLE statement would be cached. I'd asked about
whether they could find a way to allow parameter markers in this
situation - said they could, but it is not in the standards.
Guess the answer to why it is this way is to read the SQL
standards documents - not IBM's - the industry-standard ones.
OK, now literals in the subquery can be parameterized in the plan
cache - so there would not be separate statements for each
separate literal value in a built-up statement string. There
might be different entries if the statistics on the column in
question show a skew for some values, resulting in a different
plan based on frequent values and histogram distribution and all
So it isn't likely to be so bad as you suggest - there might be
hope, after all!!