I'll assume that you're working on DB2 on an AS400. The answer will be similar, but slightly different in other configurations.
If the stored procedure is written in a compiled language, such as C, PL/1, or RPG, assemble the SQL statement to be executed into a variable, then execute the variable. Here's a C example:
char buffer[256];
sprintf(buffer, "CREATE TABLE %s/%s(x INT, y INT)", libName, tableName);
EXEC SQL EXECUTE IMMEDIATE :buffer;
If you're coding your stored procedure in SQL, make a separate stored procedure in a compiled language and call it from your original stored procedure.
---
Sheldon Linker (sol@linker.com)
Linker Systems, Inc. (www.linkersystems.com)
800-315-1174 (+1-949-552-1904)
I’m sorry yes it is the AS/400 and DB2. I appreciate your reply. I have already coded a similar work around. So you answer confirms I am taking the appropriate action and that there is no way to directly enter a variable into the Create Table Command.
Thank you