New versions: Dev (3.15)

CREATE OR REPLACE FUNCTION

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

In most cases, you will want to CREATE OR REPLACE a function, not CREATE [ OR FAIL ] when the function already exists. For this, just use the auxiliary OR REPLACE clause, which can be emulated by jOOQ via an additional DROP FUNCTION statement if this syntax is not available in your dialect.

// Create a function that always return 1
create.createOrReplaceFunction("one")
      .returns(INTEGER)
      .as(return_(1))
      .execute();

Feedback

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

The jOOQ Logo