in reply to Re^2: DBI - Table names & placeholders
in thread DBI - Table names & placeholders
I solved this problem when I had to deal a few dozen tables all with the same format and function each named by a client number determined from input data.
The trick is to use a synonym. Write code for one table using a false table name. Then create a synonym named with your false name. Then alter the synonym to point to the table you need to use when you need to and reuse the bulk of your code.
If the term 'synonym' is not familiar, consider it an alias or a symbolyc link with its own name that represents another object (table?) that may have another name.
I don't know the performance impact of this method but I suspect altering a synonym is pretty cheap next to recompiling your insert statements.
Hope this helps.