Getting the DDL of an Object (@ddl)
Only in DbVisualizer Pro
This feature is only available in the DbVisualizer Pro edition.
Using the @ddl client-side command, you get the DDL of a database object in a script, for example the CREATE TABLE statement of a table.
@ddl table="SAKILA.STAFF";
Syntax
@ddl <type>="<name>" [drop="true|false"] [constrCtrl="noconstr|onlyconstr"]
| Parameter | Default | Description |
|---|---|---|
<type> | The type of object, see Object types. | |
<name> | The qualified name of the object, such as SAKILA.STAFF. The name is case-sensitive. | |
drop | true adds a DROP statement before the CREATE statement. | |
constrCtrl | Only for tables. noconstr leaves out the constraints that may make creating the table or inserting data fail: foreign keys and check constraints. onlyconstr gives ALTER statements that add those constraints, instead of the CREATE statement. |
Object types
| Type | Databases |
|---|---|
table, indexesfortable, view, procedure, function, trigger | All |
package, packagebody, objecttype, objecttypebody, sequence, synonym | Oracle |
module | Mimer SQL |
Examples
Creating a table without its constraints first
To copy tables that refer to each other, create all tables without their constraints first, and add the constraints when the data is in place:
@ddl table="SAKILA.STAFF" constrCtrl="noconstr";
@ddl table="SAKILA.STAFF" constrCtrl="onlyconstr";