In Oracle, we do this:
def TNAME=&1
create table &TNAME (foo varchar(10));
How to do the equivalent for DB2? The constraints are:
1. The create table statement is generated when TNAME is unknown
2. The create table statement is in a file which cannot be modified
3. Cannot create a temporary file with TNAME substituted by awk
4. Essentially we want to pass in the table name at run time as an argument
Possible?
The EXECUTE IMMEDIATE statement can be used in just about any block of SQL that is surrounded by a BEGIN and END, such as a stored procedure or anonymous compound statement.