New versions: Dev (3.15)

CREATE PROCEDURE

Applies to ❌ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The CREATE PROCEDURE statement allows for creating stored procedures in your catalog.

A stored procedure, as opposed to a stored function, is expected to have side effects of some sort, and can thus not be used in SQL statements.

A simple example for creating such a procedure is:

// Create a procedure that inserts a log message in a table
create.createProcedure("log")
      .as(insertInto(LOG).columns(LOG.TEXT).values("Log called"))
      .execute();

Once you've created the above procedure, you can either run code generation to get a type safe stub for calling them, or use CALL in an anonymous block, or directly:

// Call the previously created procedure with generated code:
log(configuration);

// ...or with the CALL statement in an anonymous block
create.begin(call(name("log"))).execute();

// ...or with the CALL statement directly
call(name("log")).execute();

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo