Available in versions: Dev (3.22)

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

DROP TABLE FUNCTION

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Some dialects need special syntax to drop table valued functions. For example, a BigQuery table function created with CREATE TABLE FUNCTION can't be dropped with DROP FUNCTION. It has to be dropped with DROP TABLE FUNCTION.

jOOQ can't know whether a function returns a table, so a DROP FUNCTION statement always generates DROP FUNCTION. To drop a table valued function, use dropTableFunction() instead:

// Drop a table valued function
create.dropTableFunction("books_by_author").execute();

// Drop a table valued function only if it exists
create.dropTableFunctionIfExists("books_by_author").execute();

jOOQ generates the TABLE keyword only in dialects that require it, and ignores it in all other dialects, where a table valued function is dropped like any other function. In Firebird, table valued functions are emulated with selectable procedures, so jOOQ generates DROP PROCEDURE there. As with dropFunction(), a specific signature can be passed using parameters(), see DROP FUNCTION with signature.

Dialect support

This example using jOOQ:

dropTableFunction("f")

Translates to the following dialect specific expressions:

Aurora Postgres, DB2, Databricks, HSQLDB, Hana, Postgres, SQLDataWarehouse, SQLServer, YugabyteDB

DROP FUNCTION f

BigQuery

DROP TABLE FUNCTION f

Firebird

DROP PROCEDURE f

ASE, Access, Aurora MySQL, ClickHouse, CockroachDB, DuckDB, Exasol, H2, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLite, Snowflake, Spanner, Sybase, Teradata, Trino, Vertica

/* UNSUPPORTED */
Generated with jOOQ 3.22. Support in older jOOQ versions may differ. Translate your own SQL on our website

Feedback

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

The jOOQ Logo