runPLSQLScript

Executes an Oracle PL/SQL script.

This operation was deprecated in release 4.0.3.10, and will be removed in a future release. All functionality is merged into the runScript operation. Please use that operation instead in your workflows. Run Destructive is new property and it defaults to false, so if you are running delete, truncate, drop statements then make sure to check this input on plugin operation on your workflow.

Executes a SQL script or Sequence file with one or more SQL file. Property replacement is performed on the files before they are executed.

Delimiting SQL files

Please note that the statements in the SQL files must be delimited properly.

  • Use ; to delimit individual statements.
  • Use / on new line to delimit program blocks.
  • Use /* or -- (two dashes) for comments.

The SQL Databases supported  by the parser are:

  • Oracle 10g+
    • Using statement delimiter of ;
    • PL/SQL blocks starting with DECLARE or BEGIN and finishing with END; /
  • MySql 5.1+
  • PostgreSql 9.0+ 
  • Derby 10.8.2.2+
  • SAP HANA
  • SQL Server 2008+
  • MariaDB 10.0+
  • Vertica 6.5+
  • H2 1.2.137+
  • solidDB 6.5+
  • SQL Azure
  • DB2 9.7+
  • AWS Redshift
  • Hsql 1.8+
  • Sybase ASE12.5+
  • SQLite 3.7.2+
  • DB2 z/OS 9.1+
  • EnterpriseDB 9.4+
  • Phoenix 4.2.2+
  • Greenplum 4.3+

No JDBC drivers are included in the plugin.

Environment/Instance Properties

Property Name

Property Code

Required

Description

JDBC URL

FDJDBC_URL

Yes

The JDBC URL of the database.

JDBC User

FDJDBC_USER

No

The username that will be used to connect with.

JDBC Password

FDJDBC_PASSWORD

No

The password of the username.

JDBC Driver Path

FDJDBC_DRIVER_PATH

Yes

Classpath for locating the JDBC Driver. For example, 

/u01/oracle/fmw/oracle_common/modules/oracle.jdbc_11.2.0/ojdbc6.jar

Project Properties

Property Name

Property Code

Required

Description





Inputs

Input Name

Input Code

Required

Description

User

FDJDBC_INP_USER

No

The username that will be used for database connection. Required if Environment/Instance JDBC User property is not specified.

This input takes precedence over the Environment/Instance JDBC User property.

Password

FDJDBC_INP_PASSWORD

No

Password for User specified in plugin input. Required if Environment/Instance JDBC Password property is not specified.

This input takes precedence over the Environment/Instance JDBC Password property.

Script File

FDJDBC_INP_FILE_NAME

Yes

Fully qualified or relative path to script file. If relative path is given, it will be assumed to be in the FD_ARTIFACTS_DIR.

Script file can be SQL file or Sequence file with one or more SQL file.

Property replacement is performed on the files before they are executed.

Sequence file is useful to run more than one SQL file in specific sequence. Sequence file must have !SEQ on first line. Each additional line should indicate SQL files as relative path to Sequence file.

!SEQ
CreateHR.sql
GrantHR.sql
ADFStateMgt.sql

Statements in the SQL files must be delimited properly.

Delimiting SQL files

Please note that the statements in the SQL files must be delimited properly.

  • Use ; to delimit individual statements.
  • Use / on new line to delimit program blocks.
  • Use /* or -- (two dashes) for comments.
Run Destructive

FDJDBC_INP_RUN_DESTRUCTIVE

No

This input allows a mechanism for disallowing certain destructive SQL commands.

If the input is set to true, DROP, DELETE, and TRUNCATE will be allowed within the script.

If the input is set to false, plugin operation will abort with a validation error prior to running any of the commands in the script.

This check cannot stop malicious actors, but instead helps to provide some security against accidental running of destructive commands. It is up to the customer to decide whether they want to allow such commands.

Ignore Compilation WarningsFDJDBC_INP_IGNORE_WARNINGNo

If checked, sql compilation warnings will be ignored. Otherwise, they will cause the execution to be marked as failed.

For Oracle database, plugin will print errors from USER_ERRORS or DBA_ERRORS for the object being deployed. Plugin will read errors from USER_ERRORS first and then read from DBA_ERRORS if nothing found. 

Show DBMS OutputFDJDBC_INP_SHOW_DBMS_OUTNoPrint DBMS Output in the log. Only supported for Oracle Database. 

Outputs

Output Name

Required

Description




Artifacts

This operation consumes one or more SQL files, and an optional sequence file, from the artifacts repository.

Endpoint Selection

This operation delegates the selection to the workflow developer to determine.

Endpoint Execution

This operation will randomly execute on one of the endpoint identified during selection.

Special Considerations

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.

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
ALTER SESSION SET current_schema=${{MYINST:MYSCHEMA}} 

Where MYSCHEMA is an environment instance property for the MYINST instance.  To achieve this you would create an environment instance-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

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;


The following macros are not currently supported in the footer:
  • style