Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The SQLPLUSJob JITL Job Template provides a standardized interface for executing Oracle® SQL*Plus scripts. The job template offers out-of-the-box capabilities for:

  • to execute executing an SQL*Plus script,
  • to pass passing arguments to an SQL*Plus script,
  • to collect collecting results,
  • to pass passing results as Order Variables to next jobs,
  • to use using JS7 - Credential Store.

Usage

When defining the job considereither:

  • to invoke the Wizard that is available from the job properties tab in the Configuration view and to select the JITL SQLPLUSJob and respective relevant arguments from the Wizard,

or

  • to specify the JITL job class and com.sos.jitl.jobs.db.oracle.SQLPLUSJob Java class name , then and add arguments as explained from in the documentation below documentation.

Example

Download: dbSQLPlusExecution.json

The following example shows the basic use of the SQLPLUSJob. It executes SQL*Plus code from an .sql file and writes output to the stdout channel.

...

  • The command_script_file argument points to a file e.g. with file with, for example, the following SQL code:
    • WHENEVER SQLERROR EXIT SQL.SQLCODE
      WHENEVER OSERROR EXIT FAILURE
      SELECT 'SET business_date IS ' || TO_CHAR(SYSDATE,'dd.mm.yyyy DAY') FROM DUAL;

Documentation

The Job Documentation including the full list of arguments can be found underhttps://www.sos-berlin.com/doc/JS7-JITL/SQLPlusJobSQLPLUSJob.xml

The SQLPLUSJob class accepts the following arguments:

...

SET order_date is 2021-05-04

The This output will be parsed by the regular expression

...

The SQL*Plus script can include references to job arguments with the syntax ${variable} syntax. Occurrences of variables are substituted before execution of the SQL*Plus script.

...

Passing SQL execution results to subsequent Jobs

The job offers allows use of the variable_parser_reg_expr argument. The argument's default value specifies a regular expression:

...

  • The exit_code will be 0 If the SQL*Plus script terminates successfully.
  • If std_err_output is not empty then the exit code will be set to the value 99.
  • If either SP2* or ORA-* errors occur then the exit code will be set to the value 98.

Cancellation

The following operations are available:

  • The cancel operation is applied to the order, not to the SQLPlusJob. In case of cancellation the job will continue until completion and the order will be set to the failed state.
  • The cancel/force operation is applied to the order and to the job. The SQLPlusJob will be forcibly terminated and the shell process executing the sqlplus command line utility will be terminated. The database connection will be closed and the DBMS session will be terminated. The order will be set to the failed state. The DBMS decides about rolling back transactions when closing the client session.

Further Resources

...