Welcome Guest! Log in


This article shows how to execute a Drop table and then a Create table, based on the metadata.

The metadata

 104-01

 

We have a table named "EMPLOYEE" in the "SUPPORT01" schema. This table has three columns and a primary key.

 

The process

We want our process to drop the table, and re-create it, using the metadata information.

104-02

 

The first step is an SqlOperation Action, named "SqlOperation : drop". We drag and drop the EMPLOYEE table on it.

Here is code in the expression editor for this action :

%x{$EMPLOYEE/tech:dropDdl()}x%

This code refers to the $EMPLOYEE metadata link, and calls the technical function "tech:dropDdl()" of this Metadata. This function returns the Sql code for dropping the table.

We checked "Errors Accepted" in the properties, so that the process can continue if the table does not exist yet. Note the yellow triangle at the top left corner of the Action's box.

 

The second step is another SqlOperation Action, named "SqlOperation : create". We also drag and drop the EMPLOYEE table on it.

The code for this action is :

%x{$EMPLOYEE/tech:creationDdl()}x%

It refers to the $EMPLOYEE metadata link, and calls the technical function "tech:creationDdl()" which returns the Sql code for creating the table.

 

Here is the generated code when Preparing the process :

104-03

 

Execution

After execution, if the table would not exist before, here is the session report in analytics :

104-04

 

We can see the warning on the drop action. And the process continued.

 

You have no rights to post comments

Articles

Suggest a new Article!