Replacement Properties
The SQL files are pre-processed by the plugin to transform any defined replacement properties. An example usage of replacement properties is when the schema name cannot be hard-coded because it varies from environment to environment.SQLPlus package
Alternative to Property Replacement
As an alternative to property replacement for dynamic schema injection, consider the use of an ALTER SESSION
command to modify the schema user which will run the statements. With this approach you need to ensure that the statements are not schema qualified.
For example, you could add one line to the beginning of your sql files
Code Block |
---|
ALTER SESSION SET current_schema=${{MYINST:MYSCHEMA}} |
Where MYSCHEMA
is a Target property for the MYINST
instance. To achieve this you would create a Target-scoped property on the workflow and associate the workflow to the MYINST
instance. You will then be able to provide values for each environment associated to that instance.
Sample SQL script file
Code Block |
---|
CREATE OR REPLACE PACKAGE emp_mgmt AS
FUNCTION hire (last_name VARCHAR2, job_id VARCHAR2,
manager_id NUMBER, salary NUMBER,
commission_pct NUMBER, department_id NUMBER)
RETURN NUMBER;
FUNCTION create_dept(department_id NUMBER, location_id NUMBER)
RETURN NUMBER;
PROCEDURE remove_emp(employee_id NUMBER);
PROCEDURE remove_dept(department_id NUMBER);
PROCEDURE increase_sal(employee_id NUMBER, salary_incr NUMBER);
PROCEDURE increase_comm(employee_id NUMBER, comm_incr NUMBER);
no_comm EXCEPTION;
no_sal EXCEPTION;
END emp_mgmt;
/
grant execute on emp_mgmt to HR;
grant execute on dept_mgmt to HR; |
Include Page |
---|
| SqlPLus Package Object Types |
---|
| SqlPLus Package Object Types |
---|
|