Specifying a schema with a placeholder is kind of like specifying a table with a placeholder. It'll throw all the DB's precise access planning out the window if it changes. As long as the prepare is being re-done anyway, it may as well have you do it.
In other words, the schema really is part of the table name. So treat it as such. Just think of it that there is no schema, but every table name must have a dot in it. There is a default prefix available, but it's still there, even if you don't say it.
So, one solution is:
This latter solution is analogous to what I do with DB2::db where I have a base class that returns its schema, and the table classes simply derive off the appropriate base class, making it pretty easy to both change the name of a schema and to change which schema a particular table is in. Not that I need it very often.my $tbl_foo = 'FOO'; # rely on current schema, or my $tbl_foo = 'BAZ.FOO'; # explicit, or my $sch = 'BAZ'; my $tbl_foo = "$sch.FOO"; # make it easier to change +a bunch of schemas at the same time
In reply to Re: DB2 / Multiple schemas in a query or command
by Tanktalus
in thread DB2 / Multiple schemas in a query or command
by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |