Welcome Guest! Log in
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.


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!