Skip to main content


How to Raise the Custom Exception in ODI


This post will explain the process to raise the custom exception in ODI.


  • Create a variable to store the custom error message
  • Create a procedure to read the error message from the variable and raise the exception.
  • Create a package to set the value in the custom error variable and execute the raise exception procedure.


Create a new variable to store the custom error message:


We don’t need to select a schema or refreshing query, as this variable value will be set in the Package.

Oracle - Guide to Oracle Cloud: 5 Steps to Ensure a Successful Move to the Cloud
Guide to Oracle Cloud: 5 Steps to Ensure a Successful Move to the Cloud

Explore key considerations, integrating the cloud with legacy applications and challenges of current cloud implementations.

Get the Guide


Create the procedure “Raise Custom Exception” and select the Target technology as “Jython”.


Go to Details, add step and add the code below in the “Command on Target” tab

<% String errMesg=”>>>>>>> ” +odiRef.getOption(“OBI_ERROR_MESSAGE”) + ” <<<<<<<<“; %>
// New Class being defined for raising custom exceptions
//————————————————————–New Class TableException—————————————-
public class CustomException extends Exception
                  String errmesg;
                  public CustomException()
                    super();             // call superclass constructor
                    errmesg = “CustomException:Unknown Error Occured”;
                // Constructor with the error message
                  public CustomException(String err)
                    super(err);     // call super class constructor
                    errmesg = err;  // save message
                // public method, callable by exception catcher. It returns the error message.
                  public String getError()
                    return errmesg;
}//end of class  CustomException
String mesg=”<%=errMesg%>”;
CustomException custErr=new CustomException(mesg);
throw custErr;


Create a new package ‘Raise Previous Incremental Load Failed Exception’, add ERROR_MESSAGE variable to the package and set the variable value to the required custom error message.


Add a raise custom exception package


Execute this package. It will pass the value in variable ERROR_MESSAGE to Raise the custom exception procedure, and it throws the exception as below:


We can use same variable “ERROR_MESSAGE” and Procedure “Raise Custom Exception” to generate different custom exceptions, however, we need to create a separate package for each custom error message.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ashwin Pittampally

10 years of experience doing analysis, design, development and implementation of Oracle Business Intelligence applications and ETL solutions using Informatica, DAC, ODI. Worked extensively on Oracle BIAPPS Implementations, SQL querying and Stored Procedures using PL/SQL. Worked on Functional Areas - HR, Finance, Service and Marketing Analytics, Procurement and Spend Analytics, Supply Chain and Order Management Analytics, Enterprise Healthcare Analytics (EHA) and OHADI (Oracle Healthcare Analytics Data Integration)

More from this Author

Follow Us