Execute DDL Statements - Mule 4
DDL statements, or Data Definition Language statements, are special types of SQL statements that do not directly access or modify data. Instead, they create, modify, or destroy data structures, stored procedures, and so on. You can also use DDL statements to create or modify data within tables or other data structures.
Suppose you have a database schema named Products. You also have a
dbConfig that is configured to access Products.
The following operation, named
Execute DDL, creates a new table named electronic that has
columns named id, name, description, price, and discount:
<db:execute-ddl config-ref="dbConfig"> <db:sql> CREATE TABLE electronic( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), description VARCHAR(255), price SMALLINT, discount TINYINT ) </db:sql> </db:execute-ddl>
Execute DDL operation creates a table and returns
0 unless there is an error.