24.12.2012 Views

ER/Studio - Embarcadero Technologies Product Documentation

ER/Studio - Embarcadero Technologies Product Documentation

ER/Studio - Embarcadero Technologies Product Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

USING <strong>ER</strong>/STUDIO > DEVELOPING THE PHYSICAL MODEL<br />

Notes<br />

• In order for code to be generated for procedural logic such as triggers and procedures, the results of the logic<br />

must be stored in a variable called resultstring. For example, in the Northwind.dm1 sample model, the Data<br />

Dictionary lists a reusable trigger, SYSUPDATE, for the the Oracle platform. The code for this trigger includes the<br />

following statement, which is required for code to be generated for the trigger:<br />

resultstring = trigBody<br />

• The Templated Procedure Editor includes find and replace functionality for working with SQL text strings.<br />

• Templated procedures are different from scripted procedures in that they are reusable.<br />

• You can only access the Templated Procedure Editor from the Dependencies tab of the Table Editor.<br />

• Procedures are considered to be data model schema, along with packages, functions, materialized views,<br />

auxiliary tables, synonyms, and triggers.<br />

The schema objects tab of the options editor allows you to set default trigger actions for Parent and Child actions. It<br />

also enables you to apply default triggers to tables when relationships are created.<br />

Bind a Reusable Procedure to a Table<br />

Once you have defined the reusable procedure in the Data Dictionary, you can drag the procedure from the Reusable<br />

Procedural Logic node in the Data Dictionary onto a table in the Data Model Window. This binds the procedure to the<br />

table. You can see any bound procedures on the Dependencies tab of the Table Editor.<br />

Create an SQL Procedure<br />

1 In the Data Model Explorer, expand the Physical Main Model, right-click the Procedures node, and then click<br />

New Procedure.<br />

2 Complete the Procedure SQL Editor and then click OK to create the procedure.<br />

TIP: Once you have created the SQL procedure, you can edit it by right-clicking the procedure you<br />

want to change, and then selecting Edit SQL Procedure.<br />

The following describe options that require additional explanation.<br />

Description tab<br />

Enter or edit a definition for the procedure. If the target database supports it, <strong>ER</strong>/<strong>Studio</strong> adds this definition as a<br />

table comment when generating SQL code.<br />

Attachment Bindings tab<br />

Bind an external piece of information, or attachment to the procedure. You can also remove an attachment from<br />

an object, override an attachment binding’s default value, or change the position of a bound attachment. To<br />

override the value of the attachment you have moved to the Selected Attachments grid, double-click the Value<br />

field of the target attachment. <strong>ER</strong>/<strong>Studio</strong> opens the Value Override Editor or a list depending on the attachment<br />

datatype. Attachments are created in the Attachments folder of the Data Dictionary. For more information, see<br />

Attaching External Documents to the Data Model.<br />

Permissions tab<br />

Sets access roles and user permissions for the procedure. Keep in mind that the more specific permissions are,<br />

the more time you may have to spend maintaining and updating them. The roles and users must be previously<br />

assigned to appear in the Procedure SQL Editor. For more information, see Creating and Editing Database<br />

Roles and Creating and Editing Database Users.<br />

EMBARCAD<strong>ER</strong>O TECHNOLOGIES > <strong>ER</strong>/STUDIO® 8.0.3 US<strong>ER</strong> GUIDE 185

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!