Module org.jooq
Package org.jooq

Interface Routine<T>

All Superinterfaces:
Attachable, Named, Qualified, QueryPart, Serializable
All Known Implementing Classes:
AbstractRoutine

public interface Routine<T> extends Qualified, Attachable
A routine is a callable object in your RDBMS.

Callable objects are mainly stored procedures and stored functions. The distinction between those two object types is very subtle and not well defined across various RDBMS. In general, this can be said:

Procedures:

  • Are called as callable statements
  • Have no return value
  • Support OUT parameters
Functions

  • Can be used in SQL statements
  • Have a return value
  • Don't support OUT parameters
But there are exceptions to these rules:

  • DB2, H2, and HSQLDB don't allow for JDBC escape syntax when calling functions. Functions must be used in a SELECT statement
  • H2 only knows functions (without OUT parameters)
  • Oracle functions may have OUT parameters
  • Oracle knows functions that mustn't be used in SQL statements
  • Oracle parameters can have default values (to support this, jOOQ renders PL/SQL instead of the JDBC escape syntax)
  • Postgres only knows functions (with all features combined)
  • The Sybase JDBC driver doesn't handle null values correctly when using the JDBC escape syntax on functions
  • etc...

Hence, with #852, jOOQ 1.6.8, the distinction between procedures and functions becomes obsolete. All stored routines are simply referred to as "Routine".

Instances of this type cannot be created directly. They are available from generated code.

Author:
Lukas Eder
  • Method Details

    • getPackage

      @Nullable @Pro @Nullable Package getPackage()
      The container package of this stored procedure or function.

      This is only supported in the SQLDialect.ORACLE dialect.

      Returns:
      The container package of this object, or null if there is no such container.
    • getReturnParameter

      @Nullable @Nullable Parameter<T> getReturnParameter()
      The parameter representing this routine's getReturnValue()
      Returns:
      The return parameter or null if this routine doesn't have a return value.
      See Also:
    • getOutParameters

      @NotNull @NotNull List<Parameter<?>> getOutParameters()
      A list of OUT parameters passed to the stored procedure as argument. This list contains all parameters that are either OUT or INOUT in their respective order of appearance in getParameters().
      Returns:
      The list of out parameters
      See Also:
    • getInParameters

      @NotNull @NotNull List<Parameter<?>> getInParameters()
      A list of IN parameters passed to the stored procedure as argument. This list contains all parameters that are either IN or INOUT in their respective order of appearance in getParameters().
      Returns:
      The list of in parameters
      See Also:
    • getParameters

      @NotNull @NotNull List<Parameter<?>> getParameters()
      Returns:
      A list of parameters passed to the stored object as argument
    • execute

      @Blocking int execute(Configuration configuration) throws DataAccessException
      Execute the stored object using a Configuration object
      Throws:
      DataAccessException - if something went wrong executing the query
    • execute

      @Blocking int execute() throws DataAccessException
      Execute the stored object on an underlying connection
      Throws:
      DataAccessException - if something went wrong executing the query
    • setValue

      <Z> void setValue(Parameter<Z> parameter, Z value)
      Set the routine's IN value for an IN parameter.
    • set

      <Z> void set(Parameter<Z> parameter, Z value)
      Set the routine's IN value for an IN parameter.
    • getValue

      <Z> Z getValue(Parameter<Z> parameter)
      Returns:
      The routine's OUT value for an OUT parameter.
    • getInValue

      <Z> Z getInValue(Parameter<Z> parameter)
      Returns:
      The routine's IN value for an IN parameter.
    • get

      <Z> Z get(Parameter<Z> parameter)
      Returns:
      The routine's OUT value for an OUT parameter.
    • getReturnValue

      @Nullable T getReturnValue()
      Returns:
      The routine's return value (if it is a function)
    • getResults

      @NotNull @NotNull Results getResults()
      Returns:
      The routine's results (if available)