I am trying to create a script release that can be deployed to multiple databases, but where the data can be merged together later. The obvious way to handle this is to set the serial numbers for production data high enough in subsequent deployments to prevent collisions.
The problem is to start issuing a script that takes an environment number and sets the Start from sequences accordingly. Ideally, I would like to use something like this:
ACCEPT EnvironNum PROMPT 'Enter the Environment Number: '
This does not work because you cannot evaluate the numeric expression in DDL.
Another option is to create sequences using dynamic SQL through PL / SQL.
ACCEPT EnvironNum PROMPT 'Enter the Environment Number: ' --[more scripting] EXEC execute immediate 'CREATE SEQUENCE seq1 START WITH ' || &EnvironNum*100000; --[more scripting]
However, I would prefer to avoid this solution, as I usually try to avoid issuing DDL in PL / SQL.
Finally, the third option I came up with is simply to accept the Start With value as a substitution variable instead of the environment number.
Can anyone think of how to do this?
Allan source share