Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10
The SET statement
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Most databases support a variety of SET
statements to set session specific environment variables. jOOQ supports two of these set statements that are particularly useful when running DDL scripts:
SET CATALOG catalogname; SET SCHEMA schemaname;
create.setCatalog("catalogname").execute(); create.setSchema("schemaname").execute();
Depending on whether your database supports catalogs and schemas, the above SET
statements may be supported in your database.
In MariaDB, MySQL, SQL Server, the SET CATALOG statement is emulated using:
USE catalogname;
In Oracle, the SET SCHEMA statement is emulated using:
ALTER SESSION SET CURRENT_SCHEMA = schemaname;
Feedback
Do you have any feedback about this page? We'd love to hear it!