Manual Power Designer PDF
Manual Power Designer PDF
Manual Power Designer PDF
Sybase PowerDesigner
15.0
Windows
Part number: DC38058-01-1500-01
Last modified: September 2008
Copyright 2008 Sybase, Inc. and its subsidiaries. All rights reserved.
Information in this manual may change without notice and does not represent a commitment on the part of Sybase, Inc. and its subsidiaries.
Sybase, Inc. provides the software described in this manual under a Sybase License Agreement. The software may be used only in accordance with
the terms of the agreement.
No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or
otherwise, without the prior written permission of Sybase, Inc. and its subsidiaries.
Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the
DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.
Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive Server, Adaptive
Server Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server Enterprise Replication, Adaptive Server
Everywhere, Advantage Database Server, Afaria, Answers 365, Answers Anywhere, AppModeler, APT Workbench, APT-Build, APT-Edit,
APT-Execute, APT-Translator, APT-Library, ASEP, Avaki, Avaki (Arrow Design), Avaki Data Grid, AvantGo, Bit-Wise, BizTracker, Certified
PowerBuilder Developer, Certified SYBASE Professional, Certified SYBASE Professional Logo, CodeBank, Column Design, ComponentPack,
Convoy/DM, Copernicus, CSP, Data Pipeline, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DataWindow .NET,
DB-Library, dbQueue, Dejima, Dejima Direct, Developers Workbench, DirectConnect Anywhere, DirectConnect, Distribution Director, Dynamic
Mobility Model, e-ADK, e-Biz Integrator, EC Gateway, ECMAP, ECRTP, eFulfillment Accelerator, EII Plus, Embedded SQL, EMS, Enterprise
Client/Server, Enterprise Connect, Enterprise Data Studio, Enterprise Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise
Work Modeler, eProcurement Accelerator, eremote, Everything Works Better When Everything Works Together, EWA, Extended Systems,
ExtendedView, Financial Fusion, Financial Fusion (and design), Financial Fusion Server, Formula One, Fusion Powered e-Finance, Fusion Powered
Financial Destinations, Fusion Powered STP, GeoPoint, GlobalFIX, iAnywhere, iAnywhere Solutions, ImpactNow, Industry Warehouse Studio,
InfoMaker, Information Anywhere, InformationConnect, InphoMatch, InstaHelp, Intelligent Self-Care, InternetBuilder, iremote, iScript, Jaguar
CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager, M2M Anywhere, Mach Desktop, Mail Anywhere Studio, Mainframe
Connect, Maintenance Express, Manage Anywhere Studio, MAP, M-Business Anywhere, MDI Access Server, MDI Database Gateway,
media.splash, Message Anywhere Server, MetaWorks, MethodSet, mFolio, Mirror Activator, ML Query, MMS 365, Mobile 365 (and design),
MobiLink, MySupport, New Era of Networks, Next Generation Learning, Next Generation Learning Studio, O DEVICE, OASiS, OASiS logo,
ObjectConnect, ObjectCycle, OmniConnect, OmniQ, OmniSQL Access Module, OmniSQL Toolkit, OneBridge, Open Biz, Open Business
Interchange, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, Open
ServerConnect, Open Solutions, OpenSwitch, Partnerships that Work, PB-Gen, PC APT Execute, PC DB-Net, PC Net Library, Pharma Anywhere,
PhysicalArchitect, PocketBuilder, Power Through Knowledge, power.stop, PowerAMC, PowerBuilder, PowerBuilder Foundation Class Library,
PowerDesigner, PowerDimensions, Powering the New Economy, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerTips,
Powersoft Portfolio, Powersoft Professional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, Pylon, Pylon Anywhere, Pylon
Application Server, Pylon Conduit, Pylon Pro, QAnywhere, RAP - The Trading Edition, Rapport, Relational Beans, RepConnector, Report
Workbench, Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit, Resource
Manager, RFID Anywhere, RW-DisplayLib, RW-Library, SAFE, SAFE/PRO, Sales Anywhere, Search Anywhere, SDF, Search Anywhere, Secure
SQL Toolset, Security Guardian, ShareSpool, Sharelink SKILS, smart.partners, smart.parts, smart.script, SOA Anywhere Trademark,SQL
Advantage, SQL Anywhere, SQL Anywhere Studio, SQL Code Checker, SQL Edit, SQL Edit/TPU, SQL Modeler, SQL Remote, SQL SMART,
SQL Toolset, SQL Station, SQLJ, Stage III Engineering, STEP, SupportNow, S.W.I.F.T. Message Format Libraries, Sybase 365, Sybase Central,
Sybase IQ, Sybase Learning Connection, Sybase MPP, SyberLearning LIVE, SyberLearning OnDemand, Sybase SQL Desktop, Sybase SQL
Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual Server Architecture, Sybase User Workbench, SybaseWare, Syber
Financial, SyberAssist, SybFlex, SybMD, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular Data Stream, The Enterprise
Client/Server Company, The Extensible Software Platform, The Future Is Wide Open, The Learning Connection, The Model For Client/Server
Solutions, The Online Information Center, The Power of One, TotalFix, TradeForce, Transact-SQL, Translation Toolkit, Turning Imagination Into
Reality, UltraLite, UltraLiteJ, UltraLite.NET, UNIBOM, Unilib, Uninull, Unisep, Unistring, Unwired Accelerator, Unwired Orchestrator, URK
Runtime Kit for UniCode, Unwired Accelerator, Unwired Orchestrator, Viafone, Virtualized Resource Management, VisualWriter,
WarehouseArchitect, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Web Deployment Kit, Web.PB, Web.SQL, WebSights,
WebViewer, XA-Library, XA-Server, XcelleNet, XP Server, XTNDAccess, and XTNDConnect are trademarks of Sybase, Inc. or its subsidiaries.
ii
Contents
iii
4 Building Multidimensional Diagrams 193
Multidimensional Diagram Basics . . . . . . . . . . . . . . . . 194
Cubes (PDM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Dimensions (PDM) . . . . . . . . . . . . . . . . . . . . . . . . 209
Attributes (PDM) . . . . . . . . . . . . . . . . . . . . . . . . . 211
Facts (PDM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Measures (PDM) . . . . . . . . . . . . . . . . . . . . . . . . . 216
Hierarchies (PDM) . . . . . . . . . . . . . . . . . . . . . . . . 218
Associations (PDM) . . . . . . . . . . . . . . . . . . . . . . . 220
iv
II Working with Databases 433
9 Generating a Database from a PDM 435
Connecting to a Database . . . . . . . . . . . . . . . . . . . . 436
Generating a Database . . . . . . . . . . . . . . . . . . . . . 438
Using Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Estimating Database Size . . . . . . . . . . . . . . . . . . . . 500
Modifying a Database . . . . . . . . . . . . . . . . . . . . . . 506
Accessing a Database . . . . . . . . . . . . . . . . . . . . . . 513
v
13 Migrating from ERwin to PowerDesigner 717
Introducing the ERwin Import Process . . . . . . . . . . . . . 718
Preparing to Import your ERwin models . . . . . . . . . . . . 720
The Import Process . . . . . . . . . . . . . . . . . . . . . . . 721
After Importing . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Getting Started Using PowerDesigner . . . . . . . . . . . . . 728
Index 731
vi
PART I
Subject
This book describes the PowerDesigner Conceptual, Logical, and Physical
Data Models, including how to create a CDM, LDM, and PDM, build each
of the available diagrams, and generate and reverse engineer databases.
Audience
This book assumes that you are an experienced Windows user with some
experience with relational databases and SQL.
Documentation primer
For information about the complete documentation set provided with
PowerDesigner, see the Getting Started with PowerDesigner chapter of the
Core Features Guide .
Typographic conventions
PowerDesigner documentation uses special typefaces to help you readily
identify specific items:
monospace text (normal and bold)
Used for: Code samples, commands, compiled functions and files,
references to variables.
Example: declare user_defined..., the BeforeInsertTrigger
template.
bold text
Used for: New terms.
Example: A shortcut has a target object.
SMALL CAPS
ix
Information engineering
James Martin, Prentice Hall, 1990, three volumes of 178, 497, and 625
pages respectively; clothbound, ISBN 0-13-464462-X (vol. 1),
0-13-464885-4 (vol. 2), and 0-13-465501-X (vol. 3).
Celko95
Joe Celko, Joe Celkos SQL for Smarties (Morgan Kaufmann Publishers,
Inc., 1995), 467 pages; paperbound; ISBN 1-55860-323-9.
x
CHAPTER 1
About this chapter This chapter presents the Conceptual, Logical, and Physical Data Models
and provides guidance for data modeling with PowerDesigner.
Contents Topic: page
1
Data Modeling with PowerDesigner
2
Chapter 1. Getting Started with Data Modeling
Depending on the type of database you want to design, you will use different
types of diagrams in the PDM:
Operational PDM - You use PDM to design the structure of an
operational database. Usually, in data modeling, the physical analysis
follows the conceptual and/or logical analysis, and addresses the details
of the actual physical implementation of data in a database, to suit your
performance and physical constraints.
Business intelligence PDM - You can use a PDM to design the structure
of a data environment, which consists of:
Data warehouse or data mart database are populated with data
transferred from operational databases, and gather together all the
information that may be needed in an OLAP database, where queries
for business analysis and decision making are performed. The data
warehouse database gathers all the data manipulated in a company for
3
Data Modeling with PowerDesigner
4
Chapter 1. Getting Started with Data Modeling
5
Creating a Data Model
7. [optional] Click the Extended Model Definitions tab, and select one or
more extended model definitions to attach to your model.
+ For more information on using extended model definitions, see
Extended Model Definitions in the Resource Files and the Public
Metamodel chapter of the Customizing and Extending PowerDesigner
manual.
Demo example
Sample data models are available in the Examples directory.
Model properties
To open a model property sheet, double-click its Browser entry.
The General tab contains the following properties:
Property Description
Name Specifies the name of the model, which should be clear and
meaningful, and should convey its purpose to non-technical
users.
Code Specifies the technical name of the item used for generating
code or scripts, which may be abbreviated, and should not
include spaces.
6
Chapter 1. Getting Started with Data Modeling
Property Description
Filename Specifies the location of the model file. This field is empty if the
model has never been saved.
Author Specifies the author of the model. If you enter nothing, the
Author field in diagram title boxes displays the user name from
the model property sheet Version Info tab. If you enter a space,
the Author field displays nothing.
Version Specifies the version of the model. You can use this box to
display the repository version or a user defined version of the
model. This parameter is defined in the Title page of the model
display preferences
DBMS [PDM only] Specifies the DBMS attached to the model. Click-
ing the Properties tool to the right of this field to open the DBMS
file in the Resource Editor.
Database [PDM only] Specifies the database that is the target for the
model. You can create a database in the model by clicking the
Create tool to the right of this field.
If your DBMS supports multiple databases in a single model
(enabled by the EnableManyDatabases entry in the Database
category of the DBMS), this field is not present, and is replaced
by a list of databases in the Model menu. A Database category is
also displayed in the physical options of your database objects.
Default Specifies the diagram displayed by default when you open the
diagram model.
You can create a database from the General tab of the model property sheet
or, if your DBMS supports multiple databases in a single model, from the
list of databases in the Model menu.
A database has the following properties:
Property Description
7
Creating a Data Model
Property Description
Script Begin and end scripts that are inserted at the start and end of
a database creation script
8
Chapter 1. Getting Started with Data Modeling
You should not define a database together with a tablespace physical option
on the same object, this will raise an error during check model.
The database Dependencies tab displays the list of objects that use the
current database in their physical options.
Archiving a PDM
Archived models store all constraint names without making a difference
between user defined and calculated constraints. These models are used with
the modify database feature.
You can archive a PDM with the .apm file extension, using the following
methods:
Save a PDM as an archived model
Automatically archive PDM after database creation
v To archive a PDM
1. Select File Save As, select Archived PDM (bin) or Archived PDM
(xml) in the Save As Type list, and click Save.
or
9
Creating a Data Model
Select Database Generate Database, click the Options tab, select the
Automatic Archive check box in the After Generation groupbox, and
click OK.
10
CHAPTER 2
About this chapter This chapter describes how to build conceptual and logical diagrams, and
how to create and modify the associated objects.
Contents Topic: page
Entities (CDM/LDM) 24
Attributes (CDM/LDM) 27
Identifiers (CDM/LDM) 30
Relationships (CDM/LDM) 32
Inheritances (CDM/LDM) 51
11
Introducing Conceptual and Logical Diagrams
12
Chapter 2. Building Conceptual and Logical Diagrams
In addition:
a teacher can teach several subjects and a subject can be taught by several
teachers (many-to-many).
a teacher can teach several lessons and a lesson is taught by only one
teacher (one-to-many).
a student attends multiple lessons and a lesson is followed by multiple
students (many-to-many).
a student studies multiple subjects and a subject can be studied by
multiple students (many-to-many).
13
Conceptual Diagram Basics
14
Chapter 2. Building Conceptual and Logical Diagrams
15
Conceptual Diagram Basics
16
Chapter 2. Building Conceptual and Logical Diagrams
17
Logical Diagram Basics
18
Chapter 2. Building Conceptual and Logical Diagrams
Right-click the model in the Browser and select New Logical Diagram
from the contextual menu.
19
Logical Diagram Basics
2. Click Open, browse to the legacy PDMs you want to import, select them,
and then click OK to add them to the list. You can, if necessary, add
multiple PDMs from multiple directories by repeating this step.
3. When you have added all the necessary PDMs to the list, click OK to
import them into interconnected LDMs.
20
Chapter 2. Building Conceptual and Logical Diagrams
Right-click the model or package in the Browser, and select New Data
Item.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
21
Data Items (CDM)
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
Data type Specifies the code indicating the data format, such as N for
numeric or A for alphanumeric, followed by the number of
characters.
Precision Specifies the number of places after the decimal point, for data
values that can take a decimal point.
22
Chapter 2. Building Conceptual and Logical Diagrams
Unique Each data item must have a Multiple data items can have the
code unique code. same code.
Allow One data item can be an entity Each data item can be an entity
reuse attribute for multiple entities. attribute for only one entity
If you do not select Unique Code, two data items can have the same code,
and you differentiate them by the entities that use them. The entities are
listed in the Used By column of the list of data items.
2. Select or clear the Unique Code and Allow Reuse check boxes in the
Data Item groupbox, and then click OK to return to the model.
Error message The following error message is displayed if you select the Unique Code
option, when data items are already sharing a name in the CDM:
Unique Code option could not be Assign unique codes to all data
selected because two data items have items
the same code: data_item_code.
23
Entities (CDM/LDM)
Entities (CDM/LDM)
An entity represents an object about which you want to store information.
For example, in a model of a major corporation, the entities created may
include Employee and Division.
When you generate a PDM from a CDM or LDM, entities are generated as
tables.
Creating an entity
You can create an entity in any of the following ways:
Use the Entity tool in the diagram Palette.
Select Model Entities to access the List of Entities, and click the Add a
Row tool.
Entity properties
You can modify an objects properties from its property sheet. To open an
entity property sheet, double-click its diagram symbol or its Browser entry
in the Entities folder.
The General tab contains the following properties:
24
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
Parent En- [read-only] Specifies the parent entity. Click the Properties tool
tity at the right of the field to open the parent property sheet.
The following tabs are also available:
Attributes - lists the attributes associated with the entity (see Attributes
(CDM/LDM) on page 27).
Identifiers - lists the attributes associated with the entity (see Identifiers
(CDM/LDM) on page 30).
Rules - lists the business rules associated with the entity (see Business
Rules (CDM/LDM/PDM) in the Building Physical Diagrams chapter).
Subtypes [Barker only] lists the subtypes that inherit from the entity.
Copying an entity
You can make a copy of an entity within the same model or between models.
The following rules apply to copied entities. The indicated selections for
Unique code and Allow reuse apply to the model that receives the copied
entity:
25
Entities (CDM/LDM)
Unique Code only New entity with new name and code
New identifier with new name and code
New attributes with new names and codes
Allow Reuse only New entity with new name and code
New identifier with same name and code
Reuses other entity attributes
2. [alternatively] Press CTRL and drag the entity to a new position in the
diagram.
The entity is copied and the new entity is displayed in the Browser and
diagram.
26
Chapter 2. Building Conceptual and Logical Diagrams
Attributes (CDM/LDM)
In a CDM, attributes are data items attached to an entity, association, or
inheritance. In an LDM, there are no data items, and so attributes exist in
entities without a conceptual origin.
When you generate a PDM from a CDM or LDM, entity attributes are
generated as table columns.
Creating an attribute
You can create an entity attribute using the following tools, available on the
Attributes tab in the property sheet of an entity, association, or inheritance:
Tool Description
Add a Row Creates a new attribute and associated data item (with
the same name and code).
If you have enabled the Allow Reuse model option, the new data
item can be used as an attribute for other objects.
If you have enabled the Allow Reuse and Unique Code model
options and you type the name of an existing data item, it will be
automatically reused.
Attribute properties
You can modify an objects properties from its property sheet. To open an
attribute property sheet, double-click its Browser entry in the Attributes
folder within an entity, association, or inheritance.
The General tab contains the following properties:
27
Attributes (CDM/LDM)
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
Entity/ As- [read-only] Specifies the parent object. Click the tool to the
sociation/ right of the field to open its property sheet.
Inheritance
Data Item [CDM only, read-only] Specifies the related data item. Click
the tool to the right of the field to open its property sheet.
Inherited [LDM only, read-only] Specifies the parent entity from which
from the attribute is migrated through an inheritance.
Data type Specifies the data type of the attribute, such as numeric,
alphanumeric, boolean, or others. Click the question
mark button to open the list of data types (see Domains
(CDM/LDM/PDM) in the Building Physical Diagrams chap-
ter).
28
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
Rules - lists the business rules associated with the attribute (see Business
Rules (CDM/LDM/PDM) in the Building Physical Diagrams chapter).
Unique Code and Allow Does not delete corresponding data item
Reuse
29
Identifiers (CDM/LDM)
Identifiers (CDM/LDM)
An identifier is one or many entity attributes, whose values uniquely
identify each occurrence of the entity.
Each entity must have at least one identifier. If an entity has only one
identifier, it is designated by default as the primary identifier.
When you generate a PDM from a CDM or LDM, identifiers are generated
as primary or alternate keys.
Creating an identifier
You can create an entity in any of the following ways:
Open the Attributes tab in the property sheet of an entity, select one or
more attributes, and click the Create Identifier tool. The selected
attributes are associated with the identifier and are listed on the attributes
tab of its property sheet.
Open the Identifiers tab in the property sheet of an entity, and click the
Add a Row tool.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Identifier properties
You can modify an objects properties from its property sheet. To open an
identifier property sheet, double-click its Browser entry in the Identifiers
folder beneath an entity.
The General tab contains the following properties:
30
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
Name The name of the identifier which should be clear and meaning-
ful, and should convey its purpose to non-technical users.
Code The technical name of the identifier used for generating code
or scripts, which may be abbreviated, and should not generally
include spaces.
Comment Specifies a descriptive label for the identifier.
31
Relationships (CDM/LDM)
Relationships (CDM/LDM)
A relationship is a link between entities. For example, in a model that
manages human resources, the Member relationship links the entities
Employee and Team and expresses that each employee works in a team, and
each team has employees.
An occurrence of a relationship corresponds to one instance of each of the
two entities involved in the relationship. For example, the employee Martin
working in the Marketing team is one occurrence of the relationship
Member.
When you generate a PDM from a CDM or LDM, relationships are
generated as references.
Relationships and Relationships are used in the Entity Relationship (ER), Barker, and IDEF1X
associations modeling methodologies. In the Merise methodology associations (see
Associations and Association Links (CDM) on page 44) are used to link
entities. PowerDesigner lets you use either relationships or associations
exclusively, or combine the two methodologies in the same model.
This section analyzes relationships in the Entity Relationship methodology,
for more information on IDEF1X, see Setting CDM/LDM Model Options
in the Working with Data Models chapter.
Creating a relationship
You can create a relationship in any of the following ways:
Use the Relationship tool in the diagram Palette. Click inside the first
entity to be linked and, while continuing to hold down the mouse button,
drag the cursor to the second entity. Release the mouse button inside the
second entity.
Select Model Relationships to access the List of Relationships, and
click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Relationship.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Relationship properties
You can modify an objects properties from its property sheet. To open a
relationship property sheet, double-click its diagram symbol or its Browser
entry in the Relationships folder.
32
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
Comment Specifies a descriptive label for the relationship.
33
Relationships (CDM/LDM)
Property Description
34
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
relationship.
key.
35
Relationships (CDM/LDM)
Property Description
dependency.
36
Chapter 2. Building Conceptual and Logical Diagrams
37
Relationships (CDM/LDM)
38
Chapter 2. Building Conceptual and Logical Diagrams
Entity dependencies
In the Dependencies page of the entity, you can see two identical occur-
rences of the relationship, this is to indicate that the relationship is reflexive
and serves as origin and destination for the link
39
Relationships (CDM/LDM)
Unique Code option could not be Change the code of one relationship
selected because at least two re-
lationships have the same code:
relationship_code.
40
Chapter 2. Building Conceptual and Logical Diagrams
3. On the first Customizing Relationship page, complete the details for the
relationship that will be created between the first entity and the new
entity, and then click Next.
Relationship examples
This section shows the graphic representation of various relationship
properties.
41
Relationships (CDM/LDM)
42
Chapter 2. Building Conceptual and Logical Diagrams
43
Associations and Association Links (CDM)
44
Chapter 2. Building Conceptual and Logical Diagrams
You can use associations exclusively in your CDM, or use both associations
and relationships.
Association links An association is connected to an entity by an association link, which
symbolizes the role and the cardinality between an association and an entity.
45
Associations and Association Links (CDM)
Once you have created the association, you can link it to the relevant entities
by using the Association Link tool.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Association properties
You can modify an objects properties from its property sheet. To open an
association property sheet, double-click its diagram symbol or its Browser
entry in the Associations folder.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
46
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
Entity Specifies the entity connected by the association link. You can
use the tools to the right of the list to create an object, browse
the complete tree of available objects or view the properties of
the currently selected object.
Associa- Specifies the association connected by the association link.
tion
Role Specifies the label indicating the role of the association link.
47
Associations and Association Links (CDM)
When you generate a PDM, the TASK table contains the PROJECT
NUMBER column as a foreign key, which is also a primary key column.
The primary key therefore consists of both PROJECT NUMBER and TASK
NAME columns.
48
Chapter 2. Building Conceptual and Logical Diagrams
2. Select the Identifier check box and then click OK to return to the model..
The cardinality of the association link is enclosed in parenthesis to
indicate that the association link is an identifier.
49
Associations and Association Links (CDM)
50
Chapter 2. Building Conceptual and Logical Diagrams
Inheritances (CDM/LDM)
An inheritance allows you to define an entity as a special case of a more
general entity. The general, or supertype (or parent) entity contains all of the
common characteristics, and the subtype (or child) entity contains only the
particular characteristics.
In the example below, the Account entity represents all the bank accounts in
the information system. There are two subtypes: checking accounts and
savings accounts.
Standard
Complete inheritance
Creating an inheritance
You can create an inheritance in any of the following ways:
51
Inheritances (CDM/LDM)
You can use the inheritance tool to create inheritances between entities and
to join additional children to an inheritance.
3. [optional] To create additional child entities for the same link, drag and
drop an inheritance link from the half-circle to the additional child entity.
The symbol links all the child entities to the parent.
52
Chapter 2. Building Conceptual and Logical Diagrams
Inheritance properties
You can modify an objects properties from its property sheet. To open an
inheritance property sheet, double-click its diagram symbol or its Browser
entry in the Inheritances folder.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces.
Parent Specifies the name of the parent entity. You can use the tools
to the right of the list to create an object, browse the complete
tree of available objects or view the properties of the currently
selected object.
Mutually Specifies that only one child can exist for one occurrence of the
exclusive parent entity.
children
Complete Specifies that all instances of the parent entity (surtype) must
belong to one of the children (subtypes). For example, entity
Person has 2 sub-types Male and Female; each instance of
entity Person is either a male or a female.
53
Inheritances (CDM/LDM)
Property Description
54
Chapter 2. Building Conceptual and Logical Diagrams
Property Description
not.
The Children tab list the child entities attached to the inheritance.
55
Inheritances (CDM/LDM)
56
CHAPTER 3
About this chapter This chapter describes how to build physical diagrams, and how to create
and modify the associated objects.
Contents Topic: page
Tables (PDM) 62
Columns (PDM) 86
Keys (PDM) 95
57
Physical Diagram Basics
58
Chapter 3. Building Physical Diagrams
59
Physical Diagram Basics
60
Chapter 3. Building Physical Diagrams
61
Tables (PDM)
Tables (PDM)
A table represents a collection of data arranged in columns and rows. Tables
may contain any of the following objects:
Columns are named properties of a table that describe its characteristics
(see Columns (PDM) on page 86).
Indexes are data structures associated with a table that are logically
ordered by key values (see Indexes (PDM) on page 103).
Creating a table
You can create a table in any of the following ways:
Use the Table tool in the diagram Palette
Select Model Tables to access the List of Tables, and click the Add a
Row tool
Right-click the model or package in the Browser, and select New Table
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Table properties
You can modify an objects properties from its property sheet. To open a
table property sheet, double-click its diagram symbol or its Browser entry in
the Tables folder. The following sections detail the property sheet tabs that
contain the properties most commonly entered for tables.
The General tab contains the following properties:
62
Chapter 3. Building Physical Diagrams
Property Description
Name Specifies the name of the item which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the item used for generating
code or scripts, which may be abbreviated, and should not
generally include spaces
Owner Specifies the name of the table owner. You choose an owner
from a list of users. A table can only have one owner at a
time. This is normally the table creator
63
Tables (PDM)
Property Description
Type Specifies the type of the table. You can choose between:
Relational
Object - for abstract data types
XML - for storing and retrieving data using an XML for-
mat. For more information, see Creating an XML table
or view on page 65
Keys - lists the keys associated with the table (see Keys (PDM) on
page 95).
Triggers - lists the triggers associated with the table (see The Building
Triggers and Procedures chapter).
Procedures - lists the procedures associated with the table (see the
Building Triggers and Procedures chapter).
Physical Options - list the physical options associated with the table (see
Physical Options on page 188).
Preview - displays the SQL code associated with the table (see
Previewing SQL statements in the Working with Data Models chapter).
64
Chapter 3. Building Physical Diagrams
+ For more information on abstract data types, see Abstract Data Types
(PDM) on page 129.
65
Tables (PDM)
Property Description
Element Allows you to select a root element in the XML document. You
can:
type a user-defined element name
click the Select an element button to select an element from
the XML models open in the workspace or from the schema
registered in the database
5. In the Element box, type the name of the root element of the selected
schema.
66
Chapter 3. Building Physical Diagrams
6. Click OK.
67
Tables (PDM)
68
Chapter 3. Building Physical Diagrams
This table may contain a very large amount of data. You could optimize data
retrieval by creating horizontal partitions by year. The result is as follows:
69
Tables (PDM)
Pros Cons
Improve the query response time Requires additional joins and unions to
retrieve data from multiple tables
2. Select the table to partition and select the check box if you want to keep
the original table after partitioning. Then click Next to go to the Partition
Definition page.
3. The Partition Definition page allows you to create as many partitions as
you need with the Insert and Add a row tools. The name of each partition
must be unique in the model. A table will be created for each partition
70
Chapter 3. Building Physical Diagrams
you specify, and will take the name of the relevant partition. Then click
Next to go to the Discriminant Column Selection page.
71
Tables (PDM)
Pros Cons
Improve the query response time Requires additional joins and unions to
retrieve data from multiple tables
2. Select the table to partition and select the check box if you want to keep
the original table after partitioning. Then click Next to go to the Partition
Definition page.
3. The Partition Definition page allows you to create as many partitions as
72
Chapter 3. Building Physical Diagrams
you need with the Insert and Add a row tools. The name of each partition
must be unique in the model. A table will be created for each partition
you specify, and will take the name of the relevant partition. Then click
Next to go to the Discriminant Column Selection page.
4. The Discriminant Column Selection page allows you to specify which
columns will be included in each partition table. Drag columns from the
Available columns pane, and drop them onto the appropriate partition
table in the Columns distribution pane, or use the Add and Remove
buttons at the bottom of each pane. When all your columns are allocated,
click Next to go to the Partitioning Information page.
5. The Partitioning Information page allows you to specify a name and code
for the transformation object that will be created together with the
partitions. Then click Finish.
The table is partitioned, a vertical partitioning object is created, and all
references to the original table are created on each partition table.
73
Tables (PDM)
To optimize data retrieval in the database, you collapse both tables into a
single table to eliminate the join. The result is a single table (with 2
synonym symbols) with the primary key of the child table:
Table Collapsing Wizard The Table Collapsing Wizard lets you merge multiple tables into a single
table. You can collapse tables related to each other with a reference or tables
with identical primary keys.
74
Chapter 3. Building Physical Diagrams
2. Specify a name and code for the target table to be created, and then click
Next to go to the Input Table Selection page.
3. The Input Table Selection page allows you to select the tables to collapse
with the Add Tables tool. Select the check box if you want to keep the
original tables after collapsing, and then click Next to go to the Table
Collapsing Information page.
4. The Table Collapsing Information page allows you to specify a name and
code for the transformation object that will be created together with the
table collapsing. Then click Finish.
The selected tables are collapsed, and a table collapsing object is created.
Denormalizing columns
Example
In this example, you want to have the division name printed on the pay slip
of each employee, however, you do not want to create a join between those
tables. You can denormalize columns in order to have column Div_Name in
table PaySlip:
75
Tables (PDM)
+ For more information about object replicas, see the Shortcuts and Object
Replications chapter in the Core Features Guide .
3. The Column Selection page allows you to select the columns to replicate.
Select one or more columns to replicate, and then click Finish.
A replication is created for each selected column. You can display the list
of replicas from the menu command Model Replications. Each replica
has its own property sheet. For more information about object replicas,
see the Shortcuts and Object Replications chapter in the Core Features
Guide .
Removing a You can move and paste a denormalized column into another model or
denormalized column package in the standard way.
Reverting a You can revert a column denormalization by deleting the duplicated column
denormalized column from the target table property sheet. This automatically removes the column
replica. Note that you cannot revert a column denormalization by deleting a
column replica from the list of replications.
76
Chapter 3. Building Physical Diagrams
Property Description
Partitioned table [partitionings only] Specifies the name of the table used
to create the table partitions.
Target table [table collapsings only] Specifies the name of the table
resulting from the collapsing of selected tables
Partitions tab The Partitions tab is only available for partitionings, and lists the tables
associated with the partitioning. The following actions can be performed on
this tab:
Open the property sheets of the partition tables.
Add more partitions and edit the properties of the corresponding tables.
Add comments to identify the different partitions
Delete partitions and their corresponding tables. When you delete a
partition, you are prompted to specify whether you want to delete the
corresponding table. You can delete a partition and keep its table, but you
cannot delete a table and keep an empty partition
Partition Columns tab The Partition Columns tab is only available for vertical partitionings, and
displays the distribution of columns between the partition tables. You can
drag and drop columns to reallocate them between tables.
77
Tables (PDM)
Source Tables tab The Source Tables tab is only available for table collapsings, and displays
the tables that were collapsed. These tables will no longer exist unless you
selected to keep the original tables in the Table Collapsing Wizard.
When you update a PDM generated from another model, any horizontal
partitioning is preserved.
For example, the Sales CDM contains the entity Customer:
You generate the Sales PDM from the CDM, and the Customer entity is
generated to the Customer table:
You partition this table using City as the criterion. The City column is
excluded from the partition tables:
You modify the CDM by adding an Activity attribute to the Customer entity,
and regenerate the PDM in update mode. The partitions are taken into
account in the merge dialog box: The new Activity attributes are selected by
default, while the City criteria columns are not selected.
78
Chapter 3. Building Physical Diagrams
79
Tables (PDM)
You decide to split the table in two table partitions: one table contains the
details about the task, the other table contains the task schedule:
You modify the CDM and regenerate the PDM in update mode. The
partitions are taken into account in the merge dialog box as you can see in
the following dialog box: CDM changes (creation of the Task_Manager
attribute) are selected by default, and column modifications related to
partition creation are not selected.
80
Chapter 3. Building Physical Diagrams
You can remove partitionings or table collapsings and either keep or remove
the associated tables.
81
Tables (PDM)
2. Select the denormalization object, and then click the Cancel tool.
Moving denormalizations
You cannot move or paste a denormalization object to another model or
package.
82
Chapter 3. Building Physical Diagrams
Attaching the In order to use the PowerBuilder extended attributes, you must first attach
PowerBuilder XEM the PowerBuilder extended model definition to your PDM:
3. Select PowerBuilder and specify whether you want to share the XEM or
copy it to your model.
4. Click OK to attach the XEM and click OK to close the List of Extended
Model Definitions and return to your model.
The attributes are now available for editing on the PowerBuilder tab of
tables and columns.
83
Tables (PDM)
Object Property
Table Comment
Column Comment
Label
Header
Initial value
This automated process uses the PowerDesigner generation template
language (see the Customizing Generation with GTL chapter in Customizing
and Extending PowerDesigner ).
2. Click the Connect to a Data Source tool to open the Connect to a Data
Source window.
84
Chapter 3. Building Physical Diagrams
85
Columns (PDM)
Columns (PDM)
A column contains an individual data item within a row. It is the model
equivalent of a database column. A column is always defined for a table.
When you create a column, it must be assigned a name and code. You can
also select a data type for the column. This can be done directly from a list
of available data types, or by attaching the column to a domain.
Creating a column
You can create a column in any of the following ways:
Open the Columns tab in the property sheet of a table, and click the Add
a Row tool
Right-click a table in the Browser, and select New Column
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Column properties
You can modify an objects properties from its property sheet. To open a
column property sheet, double-click its row in the Columns tab of a table or
its Browser entry. The following sections detail the property sheet tabs that
contain the properties most commonly entered for columns.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Data type Specifies the form of the data corresponding to the column,
such as numeric, alphanumeric, boolean, or others
86
Chapter 3. Building Physical Diagrams
Property Description
Domain Specifies the name of the associated domain. You can use the
tools to the right of the list to create an object, browse the
complete tree of available objects or view the properties of
the currently selected object
Computed When selected, designates that the column is computed from
an expression using values from other columns in the table
(not available for all DBMS)
Property Description
Null Values Specifies the number (or percentage) of column entries which
contain null values. You can enter a number or percentage
in this field or derive its value from database statistics (see
Updating Column Statistics on page 88).
87
Columns (PDM)
Property Description
Distinct Val- Specifies the number (or percentage) of column entries which
ues contain distinct values. You can enter a number or percentage
in this field or derive its value from database statistics (see
Updating Column Statistics on page 88).
For example, you generate a table with 2 columns and 10
rows. You set the percentage of distinct values to 100 % for
Column 1 and to 80% for Column 2. This implies that 10
rows will have distinct values in Column 1, and 8 rows in
Column 2.
When you apply a test data profile with a list generation
source to a column with a given percentage of distinct values,
PowerDesigner uses the values from the test data profile list.
If there are not enough values declared in the list, a warning
message is displayed in the Output window to inform you that
the distinct value parameter cannot be enforced due to lack of
distinct values in the list of values.
Profile Test data profile selected from the list. Profiles can use
characters, numbers or date/time data types.
+ For more information, see Using test data section in
the Generating a Database from a PDM chapter.
Computed Computed expression typed directly in the Computed Expres-
Expression sion pane or defined with the SQL Editor (accessed with the
Edit tool) which helps you define more complex expressions.
+ For more information, see Creating a computed column
on page 89.
88
Chapter 3. Building Physical Diagrams
can also update the statistics for all tables by selecting Tools Update
Statistics (see Reverse Engineering Database Statistics in the Reverse
Engineering a Database into a PDM chapter).
3. On the General tab, select the Computed checkbox, and then click the
Detail tab.
4. Enter an expression in the Computed Expression box to define the
computed column. Alternatively,you can click the Edit with SQL Editor
tool to use the SQL Editor.
89
Columns (PDM)
90
Chapter 3. Building Physical Diagrams
3. Select a data type from the Data Type list or click the Question mark
button to open and choose a data type from the Standard Data Types
dialog box.
2. Click the required column entry and then click the Properties tool to open
its property sheet.
91
Columns (PDM)
3. Select a domain from the Domain list and then click OK.
92
Chapter 3. Building Physical Diagrams
3. Select one or more columns in the list and then click OK.
The copied columns appear in the list of columns for the current table.
4. Click OK.
93
Columns (PDM)
94
Chapter 3. Building Physical Diagrams
Keys (PDM)
A key is a column, or a combination of columns, that uniquely identifies a
row in a table. Each key can generate a unique index or a unique constraint
in a target database.
The physical diagram supports the following types of keys:
Primary - Column or combination of columns whose values uniquely
identify every row in a table. A table can have only one primary key
TITLE_ID is the primary key and consists of the column TITLE ISBN
which identifies each book title in the table
TITLE_NAME is an alternate key containing the columns TITLE NAME
and TITLE TYPE. It allows each title to be identified by its name and
type, The fact that it is an alternate key indicates that there is a constraint
that no two titles of the same type can have the same name
The TITLE table also contains the foreign key column PUBLISHER ID.
This column references the primary key column in the Publisher table.
Creating a Key
The method for creating a key depends on the type of key. See the
appropriate section:
Primary keys on page 96
Alternate keys on page 98
Foreign keys on page 99
95
Keys (PDM)
Key properties
You can modify an objects properties from its property sheet. To open a key
property sheet, go to the Keys tab of its parent table, or double-click its
Browser entry.
The General tab contains the following properties:
Property Description
Table Specifies the name of the table where the key is defined
Primary keys
A primary key is the primary identifier for a table, and is attached to one or
more columns whose values uniquely identify every row in the table.
Every table must have a primary key, composed of one or more of its
columns.
96
Chapter 3. Building Physical Diagrams
Example Employee number is the primary key for the table Employee. This means
that each employee must have one unique employee number.
You can define one or more columns as the primary key of a table from the
list of columns.
2. Click the Columns tab, and select the check box in the P column for one
or more columns in the list.
3. [optional] Click the Keys tab and rename the key or select it and click the
Properties tool to access its property sheet.
4. Click OK.
97
Keys (PDM)
2. Select the tables containing the primary keys that you want to rebuild.
3. Click OK.
Alternate keys
An alternate key is a key attached to one or more columns whose values
uniquely identify every row in the table, but which is not a primary key. An
alternate key can also be a foreign key. Each alternate key can generate a
unique index or a unique constraint in a target database.
98
Chapter 3. Building Physical Diagrams
Create key tool You can also select one or several columns and use the Create Key tool in
the Columns tab of the table property sheet.
5. Click the property tool and confirm the object creation in order to open
the property sheet for the new key.
6. Click the columns tab, which lists all the columns to which the key is
attached. At key creation, the list is empty.
7. Click the Add Columns tool to open a selection box listing all the
columns in the table (except those attached to the primary key).
8. Select one or more columns and click OK in each of the dialog boxes.
Foreign keys
A foreign key is a primary key, or an alternate key, that migrates from
another table. Depending on selected model options, a primary key can be
automatically migrated to a child table as a foreign key at reference creation.
The columns that are defined in a foreign key can also be user-specified at
creation and changed at any time from the Joins tab of the reference property
sheet.
+ For information about the auto-migration of a foreign key, see
Automatic reuse and migration of columns on page 139.
99
Keys (PDM)
A primary key constraint is a named check that enforces the uniqueness and
the presence of values in a primary key column.
You can use the following variable in the name of a primary key constraint:
Variable Description
100
Chapter 3. Building Physical Diagrams
You can use the following variable in the name of a alternate key constraint:
Variable Description
You can use the following variable in the name of a foreign key constraint:
101
Keys (PDM)
Variable Description
102
Chapter 3. Building Physical Diagrams
Indexes (PDM)
An index is a data structure associated with a table that is logically ordered
by the values of a key. It improves database performance and access speed.
You normally create indexes for columns that you access regularly, and
where response time is important. Indexes are most effective when they are
used on columns that contain mostly unique values.
Example In a table called Author, you create indexes for the primary key Author ID
and the column Author name, but not for the column City. The values for
city, are not likely to be unique, nor searched regularly, and do not help
reduce query time.
Creating an index
You can create the following types of index:
A user-defined index - Associated with one or more columns
An index linked to a key - Automatically updated when the key column
or columns are modified. An index linked to a key is unique because it
uses the same unique set of columns as the key.
Primary key Table code followed by PK; for example EMPLOYEE _PK
103
Indexes (PDM)
v To create an index
1. Double-click a table symbol to display its property sheet and click the
Indexes tab.
2. Click the Add a Row tool and enter an index name and an index code.
3. Click the Properties tool to open the property sheet of the new index.
4. Type or select any appropriate index properties, and then click the
Columns tab.
5. To create a user defined index: click the Add Columns tool, select
one or more columns from the list, and then click OK
To create an index linked to a key: select the primary key, an
alternate key, or foreign key from the Columns definition list
To create a function-based index [if supported by the DBMS]: click
the Add a Row tool, then click in the Expression column and select the
ellipsis button to open the SQL Editor. Enter an expression in the editor
and then click OK
104
Chapter 3. Building Physical Diagrams
Reverse engineering An index column with an expression has a LONG data type that cannot be
function-based index concatenated in a string statement during reverse engineering. The only way
to bypass this limitation and concatenate this value is to use variables in the
query executed to retrieve the adequate information.
In the Oracle 8i and Oracle 8i2 DBMS, the query SqlListQuery defined in
the Index category contains the following variable used to recover the index
expression in a column with the LONG data type.
%SqlExpression.Xpr||i.table_name||i.index_name||c.column_
position||%
105
Indexes (PDM)
Then the DBMS can use it when processing queries such as:
SELECT * FROM EMPLOYEE WHERE LOWER(EMPLNAM)="brown"
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Index properties
You can modify an objects properties from its property sheet. To open an
index property sheet, double-click its diagram symbol or its Browser entry.
The following sections detail the property sheet tabs that contain the
properties most commonly entered for indexes.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
106
Chapter 3. Building Physical Diagrams
Property Description
Type [Sybase IQ, and Oracle only] Specifies the type of index.
You can choose between:
Bitmap [Oracle] In a bitmap index, a bitmap for each
key value is used instead of a list of row Ids
HG [Sybase IQ] HighGroup indexes are used for
GROUP BY, COUNT(DISTINCT) and SELECT DIS-
TINCT statements when data has more than 1000 unique
values
HNG [Sybase IQ] HighNonGroup indexes make equal-
ity comparisons, SUM and AVG calculations very fast
when data has more than 1000 unique values. Nonequal-
ity comparisons can also be done
LF [Sybase IQ] LowFast indexes are used for columns
that have a very low number of unique values. This index
also facilitates join index processing. It is one of the two
indexes allowed for columns used in join relationships
CMP [Sybase IQ] Compare indexes are used for
columns that store the binary comparison (<, >, or =) of
any two distinct columns with identical data types, preci-
sion, and scale
WD [Sybase IQ] Is used to index keywords by treat-
ing the contents of a CHAR or VARCHAR column as a
delimited list
Rebuilding indexes
Rebuilding indexes in a physical diagram automatically updates any changes
that you have made to primary keys, foreign keys, or alternate keys in your
107
Indexes (PDM)
model.
v To rebuild indexes
1. Select Tools Rebuild Objects Rebuild Indexes to open the Rebuild
Indexes dialog box.
Rebuilding index options The following options are available when rebuilding indexes:
Option Description
Primary key Rebuilds primary key indexes. The text box shows the
naming convention for primary keys. By default this is
%TABLE%_PK
Other keys Rebuilds alternate key indexes. The text box shows the
naming convention for alternate keys. By default this is
%AKEY%_AK
Foreign key Rebuilds foreign key indexes. The text box shows the naming
indexes convention for foreign keys. By default this is %REFR%_FK
108
Chapter 3. Building Physical Diagrams
Option Description
PK index name variables You can use the following variables in the PK index names fields:
Variable Value
Variable Value
109
Indexes (PDM)
Variable Value
110
Chapter 3. Building Physical Diagrams
Defaults (PDM)
A default is a value that can be assigned to a column or a domain in the
DBMS of the Sybase Adaptive Server Enterprise and Microsoft SQL Server
families.
You select a default from the Default list in the Check Parameters tab of a
column or domain property sheet.
Example The default object citydflt is used to assign the same default value to all
columns of type city.
Creating a default
You can create a default in any of the following ways:
Select Model Defaults to access the List of Defaults, and click the Add
a Row tool.
Right-click the model or package in the Browser, and select New
Default.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Default properties
You can modify an objects properties from its property sheet. To open a
default property sheet, double-click its diagram symbol or its Browser entry
in the Defaults folder. The following sections detail the property sheet tabs
that contain the properties most commonly entered for defaults.
The General tab contains the following properties:
111
Defaults (PDM)
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Owner Specifies the name of default owner. You choose an owner from
a list of users
You can view the default creation order in the Preview tab of the default
property sheet.
create default CITYDFLT
as Dublin
112
Chapter 3. Building Physical Diagrams
Rebuilding defaults
You can generate defaults from domains and columns having default values.
The Default Rebuild feature uses the default values to create default objects
and attaches them to the appropriate domains and/or columns.
Upgrading models
When you open a model containing domains with default values and saved
in a previous version of PowerDesigner, default objects corresponding to
the default values are created in the model.
Default objects are also created when you change the DBMS of a model
containing domains with default values, to a DBMS that supports default
objects. The opposite process occurs when you switch to a DBMS that does
not support default objects: default objects are converted into default values.
Default name template You can define a template for the generated default names. This template has
the D_%.U:VALUE% value and supports the following variables:
DOMAIN for the code of the domain using the default
COLUMN for the code of the column using the default
TABLE for the code of the table that contains the column with a default
You can define one template for domain defaults and one for column
defaults.
v To rebuild defaults
1. Select Tools Rebuild Objects Rebuild Defaults to open the Default
Rebuild dialog box.
2. Specify a default name template in the Domain and Column boxes.
3. [optional] Select the Reuse default with identical value check box this
option will reuse default objects with identical value among columns and
domains. If you do not select this option, rebuild creates one default per
object.
113
Defaults (PDM)
4. [optional] Select the Delete and rebuild check box this option detaches
the default objects attached to selected objects and deletes them if they
are not used. If you select all objects, this option allows you to clean up
the model from all existing defaults and recreate new default objects.
5. [optional] Click the Selection tab to specify domains and tables for
default generation.
6. Click OK.
The defaults are automatically created and attached to the domains and/or
columns.
114
Chapter 3. Building Physical Diagrams
Domains (CDM/LDM/PDM)
Domains help you identify the types of information in your model. They
define the set of values for which a column/entity attribute is valid. Applying
domains to columns/entity attributes makes it easier to standardize data
characteristics for columns/entity attributes in different tables/entities.
In a diagram, you can associate the following information with a domain:
Data type, length, and precision
Check parameters
Business rules
Mandatory property
Creating a domain
You can create a domain as follows:
Select Model Domains to access the List of Domains, and click the
Add a Row tool
Right-click the model or package in the Browser, and select New
Domain
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Domain properties
You can modify an objects properties from its property sheet. To open a
domain property sheet, double-click its Browser entry in the Domains folder.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
115
Domains (CDM/LDM/PDM)
Property Description
Data type Specifies the form of the data corresponding to the domain,
such as numeric, alphanumeric, Boolean, or others. The
<undefined> data type indicates a domain without a data
type. If an <undefined> data type is present when you
generate your database, it is replaced by the default data type
for your database
With default [PDM only] (For those DBMS that support it). When
selected, indicates if a default value is assigned to a column
using the domain, when a Null value is inserted
Profile [PDM only] Specifies the test Data profile assigned to the
domain
116
Chapter 3. Building Physical Diagrams
Numeric data types The following numeric data types are available:
117
Domains (CDM/LDM/PDM)
Character data types The following character data types are available:
118
Chapter 3. Building Physical Diagrams
119
Domains (CDM/LDM/PDM)
2. Click OK.
If the domain is used by one or more columns/entity attributes, an update
confirmation box is displayed asking if you want to modify domain
properties for the columns/entity attributes using the domain.
120
Chapter 3. Building Physical Diagrams
The Data Type check box is selected or not according to the options set to
enforce non-divergence from a domain (see Enforcing non-divergence
from a domain in a data model on page 121).
3. Select any other properties that you want to update (Check, Rules,
Mandatory, Profile) for all columns/entity attributes using the domain.
121
Domains (CDM/LDM/PDM)
2. Select the check boxes of the column/entity attribute properties that are
not permitted to diverge from the domain definition. You can specify any
or all of:
Data type - data type, length, and precision
Check - check parameters such as minimum and maximum values
Rules business rules
Mandatory mandatory property of the column
[PDM only] Profile - test data profile
If you subsequently modify in your domain any of the properties
specified as non-divergent here, then the corresponding properties of the
columns/entity attributes attached to that domain are automatically
updated.
Column/entity attribute properties specified as non-divergent appear
dimmed and are non-editable in the List of Columns/Entity attributes and
Column/Entity attribute property sheets. If you want to modify a
non-divergent column/entity attribute property, you must detach the
column/entity attribute from its domain.
3. Click OK to close the Model Options dialog box.
122
Chapter 3. Building Physical Diagrams
4. When you set the Enforce non-divergence options, you are asked if you
want to apply domain properties to columns/entity attributes currently
attached to the domain. If you click OK, the column/entity attribute
properties are modified in order to be consistent with the properties of the
domain to which they belong.
123
Sequences (PDM)
Sequences (PDM)
If your DBMS supports sequences, then you can create a sequence for a
column.
A sequence is like an advanced form of an auto-incremented column. Where
the latter is a column whose values automatically increment by 1, sequences
allow you to define a more complex list of numbers. For example, you could
define a list of numbers ranging between two values with an increment by
any number (integer) you want.
Once you define a sequence, you can apply and enable it to a column. The
data type for the column receiving the sequence must be a numeric data
type. Such auto-incremented columns can be used in a key for a PDM table.
+ For more information on data types, see Selecting a data type for a
column on page 90.
Example Assume that you want to create a column listing the months of the year
when quarterly reports are published: March, June, September, and
December. The first report is published on the third month, the second on the
sixth, the third on the ninth and the last on the twelfth.
You can define the proper sequence by typing the following values for
sequence option parameters:
Creating a Sequence
There are two steps to using sequences:
Create a sequence (including defining sequence options)
124
Chapter 3. Building Physical Diagrams
v To create a sequence
1. Select Model Sequences to open the List of Sequences.
2. Click the Add a Row tool and type a name for the new sequence.
3. Double-click the arrow to the left of the new sequence to display its
property sheet.
4. Click the Physical Options tab and enter any appropriate parameters.
These options are DBMS-specific. For more information on using this
tab, see Physical Options on page 188.
The above example shows the options and values to create a sequence of
months in a year when quarterly reports are published.
5. [optional] Click the Apply To button to open a selection list and specify
other sequences to which these same options will apply.
125
Sequences (PDM)
Sequence properties
You can modify an objects properties from its property sheet. To open a
sequence property sheet, double-click its Browser entry in the Sequences
folder or its line in the List of Sequences. The following sections detail the
property sheet tabs that contain the properties most commonly entered for
sequences.
126
Chapter 3. Building Physical Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Comment Specifies a descriptive label for the sequence
127
Sequences (PDM)
CDM A serial data type for an entity property. The data type
has the format NO%n where %n is a number indicating the
length of the data type
OOM A serial data type for a class attribute. The data type has the
format NO%n, where %n is a number indicating the length
of the data type
128
Chapter 3. Building Physical Diagrams
Abstract Description
data type
is
Created You can create an abstract data type of any kind supported
by your DBMS.
If you create an abstract data type of type JAVA, you can
link it to a Java class in an OOM to access the Java class
properties (see Linking an abstract data type to a Java class
on page 133).
Reverse engi- An abstract data type in a database can be reverse engineered
neered into a PDM.
If you also reverse engineer the JAVA classes into an OOM,
then the abstract data types of the type JAVA in the PDM
are automatically linked to the Java classes in the OOM
(see Reverse-engineering a PDM linked to an OOM on
page 137)
+ For more information on reverse engineering a database into a PDM, see
chapter Reverse Engineering.
+ For more information on creating and reverse engineering Java classes
into a PowerDesigner Object-Oriented Model, see the Object-Oriented
Modeling guide.
Depending on the current DBMS, the following kinds of abstract data types
can be created in PowerDesigner:
129
Abstract Data Types (PDM)
130
Chapter 3. Building Physical Diagrams
abstract data type property sheet, double-click its Browser entry in the
Abstract Data Types folder.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Comment Specifies the descriptive label
Owner Specifies the name of abstract data type owner. You choose an
owner from a list of users
Type Specifies the defining group that includes the abstract data type
Depending on its type, an abstract data type definition can also include the
following properties:
Data type, Length, and Precision
Size (for arrays)
Linked class name (for Java types)
File name and path, which contains the declaration of the class
Authorization (for objects): Invoker Right attribute used for DDL
generation
Supertype (for objects): Parent abstract data type from which the current
abstract data type can inherit the procedures
Final and Abstract (for objects): When Final is checked, the current
abstract data type cannot be used as supertype by another abstract data
type. When Abstract is checked, the current abstract data type cannot be
instantiated. Final and Abstract are mutually exclusive
Java class (for SQLJ objects): Name of an external Java class to which
the SQLJ object points. Beside the Java class box, there is a list to select
a mapping interface (CustomDatum, OraData or SQLData)
131
Abstract Data Types (PDM)
132
Chapter 3. Building Physical Diagrams
133
Abstract Data Types (PDM)
2. Click the Ellipsis button to the right of the Class box to open a Java class
selection box, which lists all the Java classes that are available in the
OOMs currently open in the Workspace.
134
Chapter 3. Building Physical Diagrams
4. Click the Properties button at the end of the Class box to open the
property sheet of the Java class.
If the related OOM is closed, then a shortcut property sheet for the Java
class is displayed, and you must click the Properties button to the right of
the Name box to display its actual property sheet..
135
Abstract Data Types (PDM)
If the related OOM is open, then the class property sheet is opened
directly:
136
Chapter 3. Building Physical Diagrams
You can reverse engineer a PDM from a database that contains Java classes
and also reverse the Java classes into an OOM. The Java abstract data types
in the PDM are automatically linked to the Java classes in the OOM as
follows:
You should reverse engineer the Java classes in the database that are used
as data types for the columns and domains in an OOM
Then reverse engineer the database into a PDM
PowerDesigner automatically searches the open OOM for the Java
classes that correspond to the JAVA abstract data types in the PDM and
makes the corresponding links
The Java classes that are reverse engineered into the PDM are created
automatically as abstract data types of type JAVA.
You can access the properties of these Java classes from the property sheets
of the corresponding abstract data types in the PDM. For more information,
see Linking an abstract data type to a Java class on page 133.
137
References (PDM)
References (PDM)
A reference is a link between a parent table and a child table. It defines a
referential integrity constraint between column pairs for a primary key, or
alternate key, and a foreign key, or between user specified columns in both
tables.
When column pairs are linked by a reference, each value in the child table
column refers to an equivalent value in the parent table column.
Within a reference, each column pair is linked by a join. Depending on the
number of columns in the primary key, or alternate key, or the number of
specified columns, a reference can contain one or more joins.
A reference normally links primary key, or alternate key, columns to foreign
key columns.
Example The two tables SALE and STORE are linked by a reference. STORE is the
parent table and SALE is the child table. The reference contains a join which
links the primary key column STORE ID (the referenced column) to the
foreign key column STORE ID (the referencing column).
Creating a reference
You can create a reference that links a primary key, or alternate key, to a
foreign key, or user-specified columns in both parent and child tables.
Depending on its properties, a reference can link a parent table and a child
table in one of two ways:
Primary key, alternate Primary or alternate key in the parent table is linked
key and foreign keys to a foreign key in the child table
User specified One or more columns in the parent table are linked to
columns corresponding columns in the child table. The linked
columns in both tables are specified by the user, and
are linked independently of primary key, alternate
key, and foreign key columns
138
Chapter 3. Building Physical Diagrams
139
References (PDM)
4. Ensure that the Default link on creation option is set to Primary key.
Examples
The following examples illustrate how using the auto-reuse columns and
auto-migrate columns options affects the creation of references.
Matching child table The following table shows the results of migrating primary key columns to a
column exists child table that contains a matching column for one of the primary key
columns. The original two tables are also shown below:
140
Chapter 3. Building Physical Diagrams
Notes:
141
References (PDM)
By default, only the properties of the primary key column are migrated to
the foreign key. If the primary key column is attached to a domain, the
domain will not be migrated to the new foreign key column unless the
Enforce non-divergence option model option is selected (see Enforcing
non-divergence from a domain in a data model on page 121).
The following table shows the results of changing references when you
have selected the auto-migrate columns option:
Action Result
Action Result
Delete primary key Delete corresponding foreign key and reference join
+ For more information on other model options for references, see
Setting PDM Model Options section in the Customizing the PDM
Environment chapter.
Reference properties
You can modify an objects properties from its property sheet. To open a
reference property sheet, double-click its diagram symbol or its Browser
entry in the References folder. The following sections detail the property
sheet tabs that contain the properties most commonly entered for references.
The General tab contains the following properties:
142
Chapter 3. Building Physical Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Parent table Specifies the parent table of the reference. This table contains
the primary key, or alternate key, linked by the reference.
You can use the tools to the right of the list to create an
object, browse the complete tree of available objects or view
the properties of the currently selected object
Parent role Specifies the role of the parent table in the reference. The
text is displayed in the diagram, near the parent table
Child table Specifies the child table of the reference. This table contains
the foreign key linked by the reference
Child role Specifies the role of the child table in the reference. The text
is displayed in the diagram, near the child table
2. Select a key in the Parent Key list to create joins on its columns. If you
143
References (PDM)
select <NONE>, the column lists are empty and you must specify your
own columns to join.
The columns linked by the joins are listed in the Parent Table and Child
Table columns.
144
Chapter 3. Building Physical Diagrams
145
References (PDM)
Tool Description
Property Description
146
Chapter 3. Building Physical Diagrams
Property Description
147
References (PDM)
Property Description
Update con- How updating a key value, in the parent table affects the
straint foreign key value in the child table. Depending on the
implementation and DBMS, you can choose between:
None - Update or deletion of a value in the parent table
has no effect on the child table.
Restrict - A value in the parent table cannot be updated
or deleted if one or more matching child values exists
Cascade - Update or deletion of a value in the parent
table causes an update or delete of matching values in
the child table
Set null - Update or deletion of a value in the parent
table sets matching values in the child table to NULL
Set default - Update or deletion of a value in the par-
ent table sets matching values in the child table to the
default value
Delete con- How deleting a row in the parent table affects the child
straint table
Mandatory par- Each foreign key value in the child table must have a
ent corresponding key value, in the parent table
Change parent A foreign key value can change to select another value in
allowed the referenced key in the parent table
Check on com- [Sybase SQL Anywhere 5.0 and 5.5 only] Verifies refer-
mit ential integrity only on the commit, instead of verifying
it after row insertion. You can use this feature to control
circular dependencies
Rebuilding references
You can rebuild references to create default references between PK columns
in one table and columns with identical code and data type in another table.
Note that rebuilding is not possible between two tables with PK columns.
Rebuilding references is useful following the reverse engineering of a
database in which all of the references could not be reverse engineered.
148
Chapter 3. Building Physical Diagrams
v To rebuild references
1. Select Tools Rebuild Objects Rebuild References to open the
Rebuild References dialog box.
2. Select a mode:
Delete and Rebuild - All existing references are deleted, and new
references built based on matching key columns
Preserve - All existing references are kept, and new references are built
based on new matching key columns
3. [optional] Click the Selection tab and specify the tables for which you
want to rebuild references. By default, all tables are selected.
4. Click OK. If you selected the Delete and Rebuild mode, a confirmation
box asks you to confirm your choice. Click Yes to confirm the deletion
and rebuild of the selected references.
149
References (PDM)
2. Click the Line Style tab and select the jagged line symbol from the
Corners list.
3. Click OK to return to the diagram.
4. Press and hold CTRL while clicking the point on the reference where you
want to insert an angle.
A handle is added to the reference at the point clicked.
5. Release CTRL. You can now drag the handle to create the desired angle.
150
Chapter 3. Building Physical Diagrams
2. Press and hold CTRL while dragging one of the symbol ends to a new
table.
You can set the global display mode for references by clicking Tools
Model Options and selecting a notation from the list. PowerDesigner
supports Relational, CODASYL, Conceptual and IDEF1X notations.
151
Views (PDM)
Views (PDM)
A view is an alternative way of looking at the data in one or more tables. It is
made up of a subset of columns from one or more tables.
You define a SQL query for each view.
Creating a view
You can create a view in any of the following ways:
Use the View tool in the diagram Palette.
Select Model Views to access the List of Views, and click the Add a
Row tool.
Right-click the model or package in the Browser, and select New View.
Select Tools Create View. For more details, see Creating a view from
the Tools menu on page 156. You can, optionally, pre-select one or more
tables and views in the diagram to create a view automatically populated
with their columns.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
View properties
You can modify an objects properties from its property sheet. To open a
view property sheet, double-click its diagram symbol or its Browser entry in
the Views folder. The following sections detail the property sheet tabs that
contain the properties most commonly entered for views.
The General tab contains the following properties:
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Comment Specifies a descriptive label for the view
152
Chapter 3. Building Physical Diagrams
Property Description
Usage Specifies the use of the view: Query only defines a view
for consultation only, view cannot update tables; Updatable
defines a view for consultation and update, view can update
tables; and With Check options implements controls on view
insertions
Type For those DBMS that support it, allows you to define the
type of a view. You can select materialized query table,
materialized view, summary table, or XML
User-defined When selected, makes sure the view query is not parsed by
PowerDesigner internal parser. This protects the view query
from any update using model objects and keeps its syntax
as defined by user. Otherwise, the view query is parsed and
modified according to model values
The Columns tab in a view property sheet displays the list of columns in the
view. This list of columns reflects the SELECT orders from the queries of
the current view. The only way to add or remove columns from this list is to
modify the query of the view.
+ For more information on how to define the query of a view, see
Creating, editing, and deleting queries associated with views on page 157.
153
Views (PDM)
If the view was created from one or several tables or views The name,
code, description and data type of the view column are those of the
corresponding column in the linked table or view.
If the view is user-defined It implies the view is not linked to another
object. The name and code of the view column comes from the column
name in the first query in the view definition. For example, MyView is
defined by the following queries:
select Name, Comment
from Property
union
select Signature, Body
from Method
Only the two columns of the first query are used to create the corresponding
view columns:
In this case, if you modify the view column code, the view creation script
will reflect the change. In our example, if you rename Name in ClientName,
the view creation script is the following:
create view MYVIEW (ClientName, "Comment") as
select Name, Comment
from Property
View column properties When you select a column in the list of view columns and click the
Properties tool in the toolbar, the view column property sheet is displayed.
You can define the following properties from the view column property
sheet:
154
Chapter 3. Building Physical Diagrams
Property Description
Name Specifies the name of the view column. This name is automat-
ically calculated. If you choose to modify the default name,
the User-defined button is selected and the Custom Name
column displays the user-defined name. You can recover the
default name by clicking again the User-defined button
Code Specifies the code of the view column. The code is automati-
cally calculated. If you choose to modify the default code, the
User-defined button is selected and the Custom Code column
displays the user-defined code. You can recover the default
code by clicking again the User-defined button
Comment Specifies the comment of the view column. This comment
is automatically calculated from the column comment in
the original table or view. If you choose to modify the
default comment, the User-defined button is selected. You
can recover the default comment by clicking again the User-
defined button
Data Type View column data type. This data type is automatically
calculated from the column data type in the original table
or view. If you choose to modify the default data type, the
User-defined button is selected. You can recover the default
data type by clicking again the User-defined button
Length Maximum length of the data type
The SQL Query tab displays the SQL code for all the queries associated
with the view. You can edit this code directly in this tab or access the
property sheets of individual queries. For more information, see Creating,
editing, and deleting queries associated with views on page 157.
155
Views (PDM)
The Triggers tab is only displayed if your DBMS supports triggers on views.
View triggers can make the view behave like a table. You can define a trigger
to fire when one or more attributes of a table view column are modified.
4. Write a trigger from scratch or select a trigger template. For more details
about writing triggers, see the chapter Building Triggers and
Procedures
The Preview tab displays the SQL code associated with the view. For more
information, see Previewing SQL statements in the Working with Data
Models chapter.
156
Chapter 3. Building Physical Diagrams
157
Views (PDM)
Any number of queries may be associated with a view, and the totality of
their SQL statements is shown in this tab, linked by any of the standard SQL
constructs, such as Union, etc.
You can edit the code shown in the SQL Query tab in any of the following
ways:
Edit the code directly in the tab
Click the Edit with SQL Editor tool to open the code in PowerDesigners
built-in SQL Editor. The SQL Editor provides a more complete query
definition environment than the SQL query tab, including access to
standard SQL constructs and syntax tools for functions and operators (see
Defining queries with the SQL Editor in the Working with Data Models
chapter).
Click the Edit with tool (CTRL+E) to open the code in your favorite
editor
Any edits you make in the SQL Query tab will propagate to the property
sheets of the associated individual queries (see Opening the property sheet
of a query on page 159).
Query list The individual queries associated with the view are available from the Query
158
Chapter 3. Building Physical Diagrams
list at the bottom of the SQL Query tab. You can create and delete queries
using the tools at the bottom of the tab.
Union [de- Displays all the data retrieved by both the SELECT 1: ABC
fault] queries, except where results are repeated. SELECT 2: BCD
Result: ABCD
Union All Displays all the data retrieved by both the SELECT 1: ABC
queries, including repeated results. SELECT 2: BCD
Result: ABCBCD
Each query associated with a view has its own property sheet, which
contains the following tabs:
159
Views (PDM)
Click the Edit with SQL Editor tool to open the code in PowerDesigners
built-in SQL Editor (see Defining queries with the SQL Editor in the
Working with Data Models chapter).
Click the Edit with tool (CTRL+E) to open the code in your favorite
editor
Any edits you make in the SQL tab will propagate to the querys clause
tabs and the SQL Query tab of the parent view (see Editing query code in
the SQL Query tab on page 158).
This tab lists the tables in the FROM clause, which specify where the query
data will be drawn from.
160
Chapter 3. Building Physical Diagrams
You can add or delete tables as appropriate, and reorder the tables in the list
using the arrows at the bottom of the tab.Any changes you make will
propagate to the querys SQL tab and to the SQL Query tab of the parent
view.
v To add a table
1. Click in the first empty row in the list.
2. Select a table from the list. To enter a more complex expression via the
SQL Editor, click the ellipsis button to the right of the list.
This tab lists the columns in the SELECT clause, which specify what data
will be displayed in the query.
You can add or delete columns as appropriate, and reorder the columns in
the list using the arrows at the bottom of the tab. Any changes you make will
propagate to the querys SQL tab and to the SQL Query tab of the parent
view.
v To add a column
1. Click in the first empty row in the list.
2. Select a column from the list. You can add all the columns in a table by
selecting a list entry with the table name followed by an asterisk. To enter
a more complex expression via the SQL Editor, click the ellipsis button to
the right of the list.
3. [optional] Enter an alias for the column in the Alias column.
This tab lists the expressions in the WHERE clause, which restrict the data
retrieved by the query.
You can add or delete expressions as appropriate, and reorder the
expressions in the list using the arrows at the bottom of the tab. Any changes
you make will propagate to the querys SQL tab and to the SQL Query tab of
the parent view.
161
Views (PDM)
v To add an expression
1. Click in the first empty row in the list.
2. [optional] Enter a prefix in the Prefix column.
3. In the first Expression column, select a column from the list. To enter a
more complex expression via the SQL Editor, click the ellipsis button to
the right of the list.
4. In the Operator column, select an operator from the list.
5. In the second Expression column, select a column from the list. To enter
a more complex expression via the SQL Editor, click the ellipsis button to
the right of the list.
This tab lists the columns in the GROUP BY clause, which control how the
data retrieved by the query will be grouped.
You can add or delete columns as appropriate, and reorder the columns in
the list using the arrows at the bottom of the tab. Any changes you make will
propagate to the querys SQL tab and to the SQL Query tab of the parent
view.
v To add a column
1. Click in the first empty row in the list.
2. Select a column from the list. To enter a more complex expression via the
SQL Editor, click the ellipsis button to the right of the list.
This tab lists the expressions in the HAVING clause, which restrict the data
returned by a query with a GROUP BY clause.
You can add or delete expressions as appropriate, and reorder the
expressions in the list using the arrows at the bottom of the tab. Any changes
you make will propagate to the querys SQL tab and to the SQL Query tab of
the parent view.
162
Chapter 3. Building Physical Diagrams
v To add an expression
1. Click in the first empty row in the list.
2. [optional] Enter a prefix in the Prefix column.
3. In the first Expression column, select a column from the list. To enter a
more complex expression via the SQL Editor, click the ellipsis button to
the right of the list.
4. In the Operator column, select an operator from the list.
5. In the second Expression column, select a column from the list. To enter
a more complex expression via the SQL Editor, click the ellipsis button to
the right of the list.
This tab lists the columns in the ORDER BY clause, which control the way
in which the data retrieved by the query will be sorted.
You can add or delete columns as appropriate, and reorder the columns in
the list using the arrows at the bottom of the tab. Any changes you make will
propagate to the querys SQL tab and to the SQL Query tab of the parent
view.
v To add a column
1. Click in the first empty row in the list.
2. In the Column column, select a column from the list. To enter a more
complex expression via the SQL Editor, click the ellipsis button to the
right of the list.
163
Views (PDM)
164
Chapter 3. Building Physical Diagrams
If you change the DBMS of a model containing query tables, these are
converted into regular views.
Physical options Query tables support physical options. When you select a query table type in
the view property sheet, the Options tab automatically is displayed to let you
define physical options for view generation.
165
Views (PDM)
166
Chapter 3. Building Physical Diagrams
during the check model. If you choose to ignore this error, the views will be
generated in alphabetical order, without taking into account the generation
order, which could cause errors in the creation of views in the database.
Example You create the view DEPARTMENT STORE from the table STORE. The
view retrieves information from the table as you can check in the SQL Query
tab of the view property sheet:
167
Views (PDM)
You can create an extended dependency between views from the list of
views or from the diagram.
+ For more information on how to create views from a list, see Defining a
generation order for stored procedures section in the Building Triggers and
Procedures chapter.
5. Click OK.
+ For more information on extended dependencies, see Using extended
dependencies, in the Objects chapter of the Core Features Guide .
168
Chapter 3. Building Physical Diagrams
Right-click the model or package in the Browser, and select New View
Reference.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
+ For more information about manipulating view references, see
Changing a table at either end of a reference on page 150 and Modifying
a reference graphically on page 150.
169
View References (PDM)
170
Chapter 3. Building Physical Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Parent Specifies the parent table or view of the view reference. You
can use the tools to the right of the list to create an object,
browse the complete tree of available objects or view the
properties of the currently selected object
Parent role Specifies the role of the parent table or view in the view
reference. The text is displayed in the diagram, near the
parent table or view
Child Specifies the child table or view of the view reference. You
can use the tools to the right of the list to create an object,
browse the complete tree of available objects or view the
properties of the currently selected object
Child role Specifies the role of the child table or view in the view
reference. The text is displayed in the diagram, near the
child table or view
A view reference also includes joins, that are links between parent columns
and child columns.
171
View References (PDM)
Example
In the Joins tab of a view reference property sheet, you can use the Reuse
Columns tool to reuse existing child columns with same code as parent
columns.
172
Chapter 3. Building Physical Diagrams
3. Click the Reuse Columns tool to reuse existing child columns with same
code as parent columns.
or
Click the Add a Row tool.
A join is created but you have to define the parent and child columns.
4. Click in the Parent Column column and select a column in the list.
5. Click in the Child Column column and select a column in the list.
6. Click OK.
173
Check Parameters (CDM/LDM/PDM)
Parameter Description
174
Chapter 3. Building Physical Diagrams
Parameter Description
175
Check Parameters (CDM/LDM/PDM)
Example A table/entity in a data model for a clothing shop may contain check
parameters defined for a column/entity attribute SIZE, which depend on the
check parameters defined on another column/entity attribute CLOTHING
TYPE, as clothing size for a skirt in one country may be different from the
same size in another country.
In this case an expression is required to create a constraint which uses check
parameters defined for both columns/entity attributes.
176
Chapter 3. Building Physical Diagrams
Variable Value
177
Check Parameters (CDM/LDM/PDM)
Active Active
Active Active
Active Active
~Active~ Active
NULL NULL
178
Chapter 3. Building Physical Diagrams
179
Business Rules (CDM/LDM/PDM)
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces
180
Chapter 3. Building Physical Diagrams
Property Description
Type Specifies the nature of the business rule. You can choose
between:
Constraint a check constraint on a value. In a PDM,
constraint business rules can be generated in the database.
For example, The start date should be inferior to the end
date of a project.
Definition a property of the element in the system. For
example; A customer is a person identified by a name and
an address.
Fact a certainty in the system. For example, A client
may place one or more orders.
Formula a calculation. For example, The total order is
the sum of all the order line costs.
Requirement a functional specification. For example,
The model is designed so that total losses do not exceed
10% of total sales.
Validation a constraint on a value. For example, The
sum of all orders for a client must not be greater than that
clients allowance.
181
Business Rules (CDM/LDM/PDM)
182
Chapter 3. Building Physical Diagrams
and columns in a database for the DBMS that support this feature.
During generation, the variable %RULES% is evaluated in order to generate
a single constraint in the SQL script. This constraint is a concatenation of all
check parameters defined in the Check tab of a table property sheet, and all
validation business rules applied to the current table. You can preview the
result of the concatenation of checks and validation business rules in the
Preview page of a table property sheet.
+ For more information on the check parameters of a table, see Naming a
table constraint on page 67.
If you want to define distinct check constraints on tables and columns, you
have to define constraint business rules and attach them to objects. This type
of business rule allows to generate multiple check constraints on an object in
the database.
This feature is only available for DBMS supporting multiple check
constraints, and provided the EnableMultiCheck entry in the General
category of the DBMS is set to Yes.
+ For more information on DBMS entries, see the DBMS Resource File
Reference chapter in the Customizing and Extending PowerDesigner
manual.
Example Lets consider the table Project:
Check parameter (in This check verifies that the customer number is
the Check page of the different from the employee number
table)
Constraint business rule DATE_CONSTY to check that the start date of the
project is inferior to the end date of the project
183
Business Rules (CDM/LDM/PDM)
+ When you display the table code preview, you can verify that the check
parameters and validation business rules are concatenated into a single
constraint, whereas the constraint business rule is displayed as a different
constraint in the script.
2. Enter a name and a code for the new rule, and click the Properties tool to
open its property sheet:
3. Select Constraint in the Type list, and then click the Expression tab.
4. Enter an expression in the Server page.
184
Chapter 3. Building Physical Diagrams
You can attach a constraint business rule to a table or a column. You cannot
reuse a constraint business rule between different objects, so you must create
as many as needed for your model objects.
When you attach a constraint business rule to an object, the code of the
business rule will be used as the constraint name. If you wish to enforce
code uniqueness for constraints in your model, you have to set the
UniqueConstName entry in the General category of the DBMS to Yes. In
such case, the code of the constraint generated from validation business rules
and the code of the constraint business rules must be unique in the model.
+ For more information on DBMS entries, see the DBMS Resource File
Reference chapter in the Customizing and Extending PowerDesigner
manual.
185
Business Rules (CDM/LDM/PDM)
3. Select a constraint business rule from the selection list and click OK to
attach it to the object.
4. [optional] Click Apply to confirm the attachment of the rule and then
click the Preview tab to verify that the constraint has been created in the
script:
5. Click OK to return to the diagram.
186
Chapter 3. Building Physical Diagrams
Database supports multi- First, the check parameters and validation busi-
ple check constraints ness rules are generated into a single constraint,
then the constraint business rules are generated
into different constraints. Constraints are thus
ordered
187
Physical Options
Physical Options
A physical option is a parameter (included at the end of a Create statement)
that defines how an object is optimized or stored in a database. Physical
options are not supported by all databases, and vary by DBMS. In ASA 6,
for example, you can define physical options for tables, columns, indexes,
tablespaces, and databases. Other DBMSs provide options for keys,
storages, and sequences.
The syntax for a physical option depends on the DBMS. For example:
188
Chapter 3. Building Physical Diagrams
2. The Syntax tab in the left pane lists the physical options available in the
DBMS, and the right pane contains the physical options that have been
selected for the object.
3. To add an option for the object, select it in the list in the Syntax pane and
click the Add tool between the panes to copy it to the Items pane. To add
only a sub-parameter for the option, expand the option in the Syntax
pane, select the required parameter and then click the Add tool.
4. To set a value for a physical option parameter, select the parameter in the
list in Items pane and enter or select the appropriate value in the field that
is displayed below the pane. The entered value will then be displayed
against the parameter in the Items list.
189
Physical Options
5. Repeat the above steps as many times as necessary to specified all your
required physical options. By default, these options will be applied to all
tables in the model. To specify that the options should apply to only
certain of the existing tables, click the Apply to button to display a
selection dialog. Select the tables that you want to apply the options to
from the list and then click OK.
6. Select the other tabs to specify physical options for other option types.
(Note that the Apply to button is not available on the Database tab).
7. Click OK to close the Default Physical Options dialog box.
The following tools are available for adding and removing physical options
to an object:
Adds physical option selected in Syntax tab (left pane) to Items tab
(right pane)
Aligns a selected physical option in the Items tab with the corre-
sponding physical option in the Syntax tab
190
Chapter 3. Building Physical Diagrams
Physical Options (All) this tab is hidden by default, and lists all the
available physical options for the object in a tree format. To display this
tab, click the Property Sheet Menu button and select Customize Favorite
Tabs Physical Options (All). You should follow the procedure in
Defining default physical options on page 188, to modify the
appropriate options.
+ Changes made on either of these tabs will be reflected on the other.
DBMS-specific information
The following table lists the objects for which physical options are available
when working with a particular DBMS:
191
Physical Options
IBM DB2 for Common Table, Column, Index, View, Storage, Tablespace
Server
IBM DB2 for OS/390 Table, Column, Index, Database, Storage, Ta-
blespace
192
CHAPTER 4
About this chapter This chapter describes how to build multidimensional diagrams, and how to
create and modify the associated objects.
.
Contents Topic: page
193
Multidimensional Diagram Basics
194
Chapter 4. Building Multidimensional Diagrams
195
Multidimensional Diagram Basics
196
Chapter 4. Building Multidimensional Diagrams
197
Cubes (PDM)
Cubes (PDM)
A cube is a collection of measures (see Measures (PDM) on page 216)
corresponding to values stored into each of its data cells. The measures are
organized into dimensions (see Dimensions (PDM) on page 209) to
provide for faster retrieval and drill-down.
Usually a cube is associated with a fact that allows to define and share
measures among cubes.
In a multidimensional diagram, the cube represents an OLAP cube. Cubes
need to be created and populated via a text file in the OLAP engine. This
text file contains a query used to extract data from a data warehouse or
operational database to fill the cubes in the OLAP engine, and is defined in
the Query tab of the cubes property sheet.
Creating a cube
You can create a cube in any of the following ways:
Use the Cube tool in the diagram Palette.
Select Model Cubes to access the List of Cubes, and click the Add a
Row tool.
Right-click the model or package in the Browser, and select New Cube.
Rebuild a cube from a fact table or view defined in a physical diagram
(see Retrieving Multidimensional Objects on page 199).
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Cube properties
You can modify an objects properties from its property sheet. To open a
cube property sheet, double-click its diagram symbol or its Browser entry in
the Cubes folder. The following sections detail the property sheet tabs that
contain the properties most commonly entered for cubes.
The General tab contains the following properties:
198
Chapter 4. Building Multidimensional Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
Fact Specifies the fact used by the cube. You can use the tools to
the right of the list to create an object, browse the complete
tree of available objects or view the properties of the currently
selected object
The following tabs are also available:
Fact Measures - lists the Measures linked to the fact used by the cube (see
Measures (PDM) on page 216).
Queries - displays the SQL statement required to generate the cube data
text file that is used to populate the OLAP cube.
199
Cubes (PDM)
Rebuilding Cubes
Once the fact and dimension tables of the data warehouse schema are
designed, you can use this information to build the multidimensional cubes.
The Rebuild Cubes Wizard transforms fact tables or views into cubes, and
dimension tables or views into dimensions. You can then design the cubes
taking into account the different analysis axes of the dimensions. These
cubes will serve to generate the text files used to create and populate the
OLAP engine.
The Rebuild Cubes feature works only if there are tables in the physical
diagram with a multidimensional type (Fact or Dimension). You can assign
types either manually (see Table property sheet General tab in the
Building Physical Diagrams chapter) or via the Multidimensional Objects
Retrieval Wizard (see Retrieving Multidimensional Objects on page 199).
200
Chapter 4. Building Multidimensional Diagrams
201
Cubes (PDM)
v To rebuild cubes
1. Select Tools Multidimension Rebuild Cubes to open the Cube
Rebuild Wizard:
2. Specify a rebuild mode. You can choose between the following options:
Delete and Rebuild all cubes are deleted and rebuilt, including those
to which you have made modifications.
Preserve only those cubes that have not been modified are deleted
and rebuilt. Any cubes that you have modified are preserved.
3. [optional] Click the Selection tab to specify which tables or views will be
used to rebuild cubes. Only those tables and views that have a
multidimensional type are available for rebuilding.
4. Click OK to rebuild cubes.
A message in the Output window informs you that the rebuild is
successful. The cube and dimension are created and displayed in a
multidimensional diagram.
202
Chapter 4. Building Multidimensional Diagrams
The link between the operational database and the data warehouse or data
mart database is a relational to relational mapping.
+ For more information about relational to relational mapping, see
Relational to relational mapping in the Creating Mappings chapter of
the Core Features Guide .
You can generate a script file for each data source, you can also select the
tables in the data source which select orders will be generated in the script
file. The extraction scripts list all the select orders defined in the table
mappings.
203
Cubes (PDM)
2. Specify a destination directory for the generated file, and select the Check
Model check box if you want to verify the PDM syntax before generation.
The name of the script is identical to the name of the data source.
3. [optional] Click the Options tab and specify any appropriate options. For
more information, see Extraction Script Generation Options tab on
page 204.
4. [optional] Click the Selection tab, and select the tables that you want to
use in the script generation.
5. Click OK to generate the script files in the specified directory.
The Options tab allows you to specify the format for the script.
204
Chapter 4. Building Multidimensional Diagrams
Option Description
Title Inserts the database header and the name of the tables
before each select query.
Character Case Defines the character case in the generated text file.
No Accent When selected, disallows the use of accents.
205
Cubes (PDM)
Field Details
206
Chapter 4. Building Multidimensional Diagrams
2. Define a destination directory for the generated file in the Directory box.
3. Select the generation options in the Options tab.
4. Select the cubes and data sources for which you want to generate a file
from the sub- tabs in the Selection tab.
5. Click OK.
The generated files are stored in the destination directory you have
defined.
Cube data generation You can customize the format of the generated text files from the Generate
options Cube Data dialog box.
207
Cubes (PDM)
Option Description
Character Case Defines the character case in the generated text file
208
Chapter 4. Building Multidimensional Diagrams
Dimensions (PDM)
A dimension is an axis of analysis in a multidimensional structure.
The dimension is made of an ordered list of attributes that share a common
semantic meaning in the domain being modeled. Each attribute designates a
unique position along the axis.
Creating a dimension
You can create a dimension in any of the following ways:
Use the Dimension tool in the diagram Palette.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Dimension properties
You can modify an objects properties from its property sheet. To open a
dimension property sheet, double-click its diagram symbol or its Browser
entry in the Dimensions folder. The following sections detail the property
sheet tabs that contain the properties most commonly entered for
dimensions.
The General tab contains the following properties:
209
Dimensions (PDM)
Property Description
210
Chapter 4. Building Multidimensional Diagrams
Attributes (PDM)
An attribute is used to qualify dimensions (see Dimensions (PDM) on
page 209) used in queries. For example, the Time dimension can contain
attributes Year, Quarter, Month, and Week.
Creating an attribute
You can create an attribute in any of the following ways:
Open the Attributes tab in the property sheet of a dimension, and click the
Add a Row tool.
Attribute properties
You can modify an objects properties from its property sheet. To open an
attribute property sheet, double-click its Browser entry. The following
sections detail the property sheet tabs that contain the properties most
commonly entered for attributes.
The General tab contains the following properties:
211
Attributes (PDM)
Property Description
212
Chapter 4. Building Multidimensional Diagrams
4. Click Apply.
213
Facts (PDM)
Facts (PDM)
A fact corresponds to the focus of a decision support investigation. It is a set
of measures (see Measures (PDM) on page 216) manipulated by a cube
(see Cubes (PDM) on page 198). For example, Sale, Revenue, Budget
could be facts.
Creating a fact
You can create a fact in any of the following ways:
Select Model Facts to access the List of Facts, and click the Add a Row
tool.
Right-click the model or package in the Browser, and select New Fact.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Fact properties
You can modify an objects properties from its property sheet. To open a fact
property sheet, double-click its Browser entry in the Facts folder. The
following sections detail the property sheet tabs that contain the properties
most commonly entered for facts.
The General tab contains the following properties:
214
Chapter 4. Building Multidimensional Diagrams
Property Description
215
Measures (PDM)
Measures (PDM)
A measure is a variable that corresponds to the focus of an investigation.
Measures describe the meaning of the analytical values stored in each data
cell of a cube (see Cubes (PDM) on page 198).
Measures are most of the time numeric values like for example Price or
Total.
Measures can also be the result of an operation or calculation as indicated in
the formula box of the measure property sheet.
Creating a measure
You can create a measure in any of the following ways:
Open the Measures tab in the property sheet of a fact, and click the Add a
Row tool.
Right-click a fact in the Browser, and select New Measure.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Measure properties
You can modify an objects properties from its property sheet. To open a
measure property sheet, double-click its diagram symbol or its Browser
entry. The following sections detail the property sheet tabs that contain the
properties most commonly entered for measures.
The General tab contains the following properties:
216
Chapter 4. Building Multidimensional Diagrams
Property Description
Name Specifies the name of the item, which should be clear and
meaningful, and should convey the items purpose to non-
technical users
Code Specifies the technical name of the object, which is used for
generating code or scripts, which may be abbreviated, and
should not generally include spaces
217
Hierarchies (PDM)
Hierarchies (PDM)
A hierarchy defines one of two paths through a dimension (see
Dimensions (PDM) on page 209):
an organizational path - describes a traversal pattern through a
dimension, from the most general to the most specific attribute of the
dimension. It is an ordered subset of the attributes.
a consolidation path - represents a consolidation of attributes. For
example, a Time dimension with a base periodicity of days might have a
hierarchy specifying the consolidation of days into weeks, weeks into
months, months into quarters, and quarters into years.
Creating a hierarchy
You can create a hierarchy in any of the following ways:
Open the Hierarchies tab in the property sheet of a dimension, and click
the Add a Row tool.
Open the Attributes tab in the property sheet of a dimension, and click the
Create Hierarchy tool.
Right-click a dimension in the Browser, and select New Hierarchy.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Hierarchy properties
You can modify an objects properties from its property sheet. To open a
hierarchy property sheet, double-click its Browser entry. The following
sections detail the property sheet tabs that contain the properties most
commonly entered for hierarchies.
The General tab contains the following properties:
218
Chapter 4. Building Multidimensional Diagrams
Property Description
219
Associations (PDM)
Associations (PDM)
An association relates a cube (see Cubes (PDM) on page 198) to the
dimension (see Dimensions (PDM) on page 209) that defines it. It shows
the axis of investigation of the dimension in the cube.
For example, the Sale cube is linked to the Time dimension by the Sale -
Time association to analyze sales through the time dimension.
Creating an association
You can create an association in any of the following ways:
Use the Association tool in the diagram Palette.
+ For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Association properties
You can modify an objects properties from its property sheet. To open an
association property sheet, double-click its diagram symbol or its Browser
entry in the Associations folder.
The General tab contains the following properties:
220
Chapter 4. Building Multidimensional Diagrams
Property Description
Cube Specifies the cube origin of the association. You can click the
Properties tool to view the properties of the currently selected
object
Dimension Specifies the destination dimension of the association. You
can use the tools to the right of the list to create an object,
browse the complete tree of available objects or view the
properties of the currently selected object
Hierarchy Specifies the hierarchy used by the cube for the consolidation
calculation. You can click the Properties tool to view the
properties of the currently selected object
221
CHAPTER 5
About this chapter This chapter presents triggers and procedures used to generate database
constraints.
Contents Topic: page
223
Triggers (PDM)
Triggers (PDM)
A trigger is a segment of SQL code associated with a table or a view, and
stored in a database. It is invoked automatically whenever there is an attempt
to modify data in the associated table with an insert, delete, or update
command.
Triggers enhance the security, efficiency, and standardization of databases.
You can use triggers to enforce referential integrity, where declarative
constraints are not sufficient. You can also use triggers to implement
sequences for columns.
Trigger templates and A trigger template is a pre-defined form for creating triggers.
template items PowerDesigner ships templates for each supported DBMS. Depending on
the current DBMS, there are pre-defined templates for insert, update, and
delete trigger types.
A template item is a reusable block of SQL script that can implement
referential integrity, or do any other work on database tables. PowerDesigner
ships template items for each supported DBMS. A template item is inserted
into a trigger template script, or a trigger script. The template item calls a
corresponding SQL macro which can implement an insert, update, delete, or
error message constraint on one or more tables in the database.
You can use the PowerDesigner templates and template items, copy and edit
them, or create your own from scratch. For more information, see Trigger
Templates (PDM) on page 240.
224
Chapter 5. Building Triggers and Procedures
tables. To verify this, double-click the table symbol to open its property
sheet, and then click the Triggers tab. If the triggers are not present you
will need to rebuild your triggers manually.
+ For more information about the Automatically rebuild triggers model
option and rebuilding triggers manually, see Rebuilding Triggers on
page 229.
+ For more information about selecting referential integrity options
from the Reference property sheet, see section Defining referential
integrity in chapter Building Physical Diagrams.
You can instruct PowerDesigner to implement referential integrity between
tables using triggers by default.
225
Triggers (PDM)
2. Click the Add a Row tool to create a new trigger, and type a name and
code.
3. Click Apply to commit the creation of the new trigger, and then click the
Properties tool to open its property sheet.
4. Click the Definition tab, and select a trigger template from the Template
list.
The time and event fields will be set and the template code copied into
the definition box.
5. [optional] Modify the trigger definition code. You can add trigger
template items, use PDM variables and macros and various other tools
available from the toolbar (see SQL Code Definition Toolbars on
page 270).
If you edit the code, then the trigger will be marked as user-defined and
will be excluded from most forms of rebuilding (see Rebuilding
Triggers on page 229).
6. You can also modify the triggers other properties. For a full list of the
properties available, see Trigger properties on page 228.
226
Chapter 5. Building Triggers and Procedures
5. Enter the trigger definition code. You can add trigger template items, use
PDM variables and macros and various other tools available from the
toolbar (see SQL Code Definition Toolbars on page 270).
The trigger will be marked as user-defined and will be excluded from
most forms of rebuilding (see Rebuilding Triggers on page 229).
6. You can also modify the triggers other properties. For a full list of the
properties available, see Trigger properties on page 228.
227
Triggers (PDM)
Trigger properties
You can modify an objects properties from its property sheet. To open a
trigger property sheet, double-click its Browser entry in the Triggers folder.
The following sections detail the property sheet tabs that contain the
properties most commonly entered for triggers.
The General tab contains the following properties:
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces
The Definition tab allows you to enter code for the trigger. It contains the
following properties:
228
Chapter 5. Building Triggers and Procedures
Property Description
The Preview tab displays the SQL code associated with the trigger. For more
information, see Previewing SQL statements in the Working with Data
Models chapter.
The Template Items tab lists the trigger template items available for use in
the trigger definition. For more information, see Trigger Template Items
(PDM) on page 248.
Rebuilding Triggers
You rebuild triggers in order to ensure that:
They are attached to all tables joined by a reference where referential
integrity is implemented by a trigger
229
Triggers (PDM)
230
Chapter 5. Building Triggers and Procedures
Delete and Rebuild all triggers attached to templates are deleted and
rebuilt, including those to which you have made modifications
Preserve only those triggers attached to templates that have not been
modified are deleted and rebuilt. Any triggers that you have modified
are preserved.
3. The Trigger selection box shows an expandable tree view of trigger types.
There are three levels in this tree:
All trigger types supported by the current DBMS
All trigger templates corresponding to the trigger types
All template items defined for each trigger template
For example, in the list below, the two template items
InsertChildParentExist and InsertTooManyChildren are used
in the BeforeInsertTrigger template that is, in turn, used in all
triggers with a time of Before and an event type of Insert:
You can select which trigger types, trigger templates, and template items
will be rebuilt by expanding the appropriate nodes and selecting or
clearing the check boxes as required.
4. [optional] Click the Error Messages tab to define the types of error
messages to generate. For more information about this tab, see the
Creating and generating user-defined error messages on page 278
section.
231
Triggers (PDM)
5. [optional] Click the Selection tab. to specify which tables to rebuild the
triggers for.
Whether you use the automatic model option or rebuild triggers manually,
all triggers that are based on a trigger template are rebuilt. These include:
The default PowerDesigner triggers that are used to maintain referential
integrity between tables
Any other triggers that you have created via a user-defined trigger
template
Click the User-defined button in the Definition tab of the trigger property
sheet to reset your edits. This removes the changes performed on the
trigger and reapplies the trigger template
Select <None> in the trigger template list in the Definition tab of the
trigger property sheet. This detaches the trigger template from the
user-defined trigger. The next time you will rebuild triggers, a new trigger
based on the previously mentioned trigger template will be created
For example, Trigger1 is based on template TrigTpl1. You modify Trigger1
so PowerDesigner turns it into a user-defined trigger. If you want to recreate
a trigger based on TrigTpl1 you can click the User-defined button in the
Definition tab of the Trigger1 property sheet: you restore the trigger
template code, but you lose the modifications on the trigger. You can also
keep the changes performed on the trigger by selecting <None> in the
trigger template list in the Definition tab of the trigger property sheet. The
232
Chapter 5. Building Triggers and Procedures
trigger template is detached from the trigger and a new trigger based on this
trigger template will be created the next time you rebuild triggers.
Modifying Triggers
PowerDesigner provides various methods for editing a trigger. You can:
Edit the code directly in the Definition tab of its property sheet.
Insert predefined trigger template item code or create your own reusable
trigger template items
v To modify a trigger
1. Open the trigger property sheet in one of the following ways:
Open the relevant table property sheet click the Triggers tab, select the
trigger from the list, and then click the Properties tool
Select Model Triggers Triggers to open the List of Triggers, select
the trigger from the list, and then click the Properties tool
In the Browser, find the entry for the trigger, right-click it, and select
Properties from the contextual menu
2. Click the Definition tab to display the trigger code.
233
Triggers (PDM)
3. Enter the trigger definition code. You can attach a trigger template, add
template items, use PDM variables and macros and various other tools
available from the toolbar (see SQL Code Definition Toolbars on
page 270).
The trigger will be marked as user-defined and will be excluded from
most forms of rebuilding (see Rebuilding Triggers on page 229), if you
select the Preserve mode.
4. You can also modify the triggers other properties. For a full list of the
properties available, see Trigger properties on page 228.
2. Click at the point in the code where you want to insert the trigger
template item, and then click one of the following tools:
Add Trigger Item From DBMS to open a selection box containing a
list of trigger template items defined in the DBMS definition file
Add Trigger Item From Model to open a selection box containing a
list of trigger template items defined in the model
234
Chapter 5. Building Triggers and Procedures
3. Select the item to insert and then click OK to return to the definition tab.
The trigger template item will be inserted in your code. It will also
appear in the list on the Template Items tab.
Certain DBMS require that a cursor and variables are declared for each
template item before the template item name is used in the script. This can
be a statement that calls a corresponding procedure. You can use the
following format to declare a template item: Decl template item name.
235
Triggers (PDM)
236
Chapter 5. Building Triggers and Procedures
pre-defined DBMS trigger templates from the Trigger Templates tab of the
DBMS property sheet.
3. Type a new trigger name in the Trigger Name text box at the bottom of
the tab.
For example, mytempl_%TABLE%
4. Click OK in each of the dialog boxes.
237
Triggers (PDM)
.InsertChildParentExist
.InsertTooManyChildren
end procedure;
/
Multiple triggers
Some DBMSs allow you to have multiple triggers of the same type (time
and event) defined for any given table. Triggers of the same type are triggers
that are invoked for the same insert, update, or delete event.
Example A company is considering large numbers of candidates for new positions in
various posts. You want to ensure that all new employees will have a salary
that is within the range of others working in the same field, and less than his
or her prospective manager.
On an EMPLOYEE table, you create two BeforeInsert triggers ,
tibTestSalry1_EMPLOYEE to verify that a proposed salary falls within
the correct range, and tibTestSalry2_EMPLOYEE to verify that the
proposed salary is less than that of the prospective manager.
create trigger tibTestSalry1 before insert order 1 on EMPLOYEE
referencing new as new_ins for each row
begin
[Trigger code]
end
[Trigger code]
end
For a specified table, you can indicate the order that a trigger executes, or
fires, within a group of triggers of the same type.
238
Chapter 5. Building Triggers and Procedures
239
Trigger Templates (PDM)
Code that performs the trigger action. The code may contain references
to trigger template items, which are re-usable blocks of script.
You can create trigger templates and trigger template items in your DBMS
definition file or in your model. These elements will be available as follows:
240
Chapter 5. Building Triggers and Procedures
or
To create a model trigger template: select Model Triggers Trigger
Templates to open the List of User-Defined Trigger Templates:
241
Trigger Templates (PDM)
3. Type a new name and code for the new template and click Apply to
commit its creation.
4. Click the Properties tool to open the property sheet of the new trigger
template:
242
Chapter 5. Building Triggers and Procedures
5. Click the Definition tab and enter or modify the definition code. You can
add trigger template items, use PDM variables and macros and various
other tools available from the toolbar. For more information, see SQL
Code Definition Toolbars on page 270.
6. You can also modify other of the trigger templates properties. For a full
list of the properties available, see Trigger template properties on
page 245.
7. Click OK in each of the dialog boxes.
If you have created DBMS trigger template, a confirmation box will
appear, asking if you want to save the changes to the DBMS.
Click Yes to confirm the template creation.
243
Trigger Templates (PDM)
Before insert
BeforeInsertTrigger
Before update
BeforeUpdateTrigger
Before delete
BeforeDeleteTrigger
244
Chapter 5. Building Triggers and Procedures
4. Click a trigger template in the list, and then click the Properties tool to
open its property sheet.
5. Click the Definition tab and modify the trigger definition code. You can
add trigger template items, use PDM variables and macros and various
other tools available from the toolbar. For more information, see SQL
Code Definition Toolbars on page 270.
6. You can also modify other of the trigger templates properties. For a full
list of the properties available, see Trigger template properties on
page 245.
7. Click OK in each of the dialog boxes.
If you have created DBMS trigger template, a confirmation box will
appear, asking if you want to save the changes to the DBMS.
Click Yes to confirm the template creation.
Property Description
Name The name of the item which should be clear and meaning-
ful, and should convey the items purpose to non-technical
users
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces
245
Trigger Templates (PDM)
Property Description
Trigger time Time attribute of the trigger template. The list displays the
values defined in the trigger templates and template items
of the current DBMS
Trigger event Event attribute of the trigger template. The list displays the
values defined in the trigger templates and template items
of the current DBMS
Trigger name Name of trigger associated with template
Applies to ta- For those DBMS that support view triggers, it allows you
ble triggers or to define if the trigger template applies to table or view
view triggers triggers
The Definition tab contains a field for entering its definition code. For
information about editing this code, see Modifying Triggers on page 233.
The Template Items tab list the template items that are defined in the trigger
template and that will be generated when a trigger is generated from the
template.
A template item that is deleted from the Template Items tab is not deleted
from the trigger template definition. You can therefore limit the template
items available for generation by removing template items from the
Template Item tab, without having to remove them from the trigger template
definition.
Rebuild triggers When you use Rebuild Triggers to automatically create triggers for selected
tables, the template items that are listed on this tab are those available for
generation. Whether they are generated or not depends on the following:
Template items are generated in a trigger if they match the trigger
implemented referential integrity defined for a reference attached to the
table
Template items are generated in a trigger if they are user-defined,
regardless of trigger referential integrity constraints
Adding template items to You can add any template item from the model or DBMS to the Trigger
trigger template definition template definition by clicking an Add Trigger Item tool from the Definition
246
Chapter 5. Building Triggers and Procedures
tab of the trigger template property sheet, and selecting a trigger item. It is
automatically added to the Template Items tab.
247
Trigger Template Items (PDM)
248
Chapter 5. Building Triggers and Procedures
or
To create a model trigger template item: select Model Triggers
Trigger Template Items to open the List of User-Defined Trigger
Template Items:
249
Trigger Template Items (PDM)
check box for the type of item that you want to use as the basis for
your new item and click OK to return to the trigger template item list.
The duplicate DBMS template item has been added to the list.
Add a Row adds a new blank template item to the list.
3. Type a new name and code for the new template item and click Apply to
commit its creation.
4. Click the Properties tool to open the property sheet of the new template
item:
5. Click the Definition tab and enter or modify the definition code. You can
use PDM variables and macros and various other tools available from the
toolbar. For more information, see SQL Code Definition Toolbars on
page 270.
6. You can also modify other of the trigger template items properties. For a
full list of the properties available, see Trigger template properties on
page 245.
250
Chapter 5. Building Triggers and Procedures
251
Trigger Template Items (PDM)
Update constraints The template items below implement referential integrity in update trigger
templates.
Delete constraints The template items below implement referential integrity in delete trigger
templates.
252
Chapter 5. Building Triggers and Procedures
Constraint messages You can insert the following template items in any trigger template. They
generate error messages that indicate the violation of an integrity constraint.
253
Trigger Template Items (PDM)
6. You can also modify other of the trigger template items properties. For a
full list of the properties available, see Trigger template properties on
page 245.
7. Click OK in each of the dialog boxes.
If you have created DBMS trigger template item, a confirmation box will
appear, asking if you want to save the changes to the DBMS.
Click Yes to confirm the template creation.
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces
254
Chapter 5. Building Triggers and Procedures
Select Model Procedures to access the List of Procedures, and click the
Add a Row tool
v To create a procedure
1. Double-click a table symbol to open its property sheet, and then click the
Procedures tab.
2. Click the Add a Row tool to create a new procedure, and type a name and
code.
255
Stored Procedures and Functions (PDM)
3. Click Apply to commit the creation of the new procedure, and then click
the Properties tool to open its property sheet.
6. Modify the procedure definition code. You can use PDM variables and
macros and various other tools available from the toolbar (see SQL
Code Definition Toolbars on page 270).
7. You can also modify the procedures other properties. For a full list of the
properties available, see Procedure properties on page 256.
Procedure properties
You can modify an objects properties from its property sheet. To open a
procedure property sheet, double-click its diagram symbol or its Browser
entry in the Procedures folder. The following sections detail the property
sheet tabs that contain the properties most commonly entered for procedures.
256
Chapter 5. Building Triggers and Procedures
Property Description
Name Specifies the name of the item which should be clear and
meaningful, and should convey the items purpose to non-
technical users.
Code Specifies the technical name of the item used for generating
code or scripts, which may be abbreviated, and should not
generally include spaces.
Comment Specifies a descriptive label for the procedure.
257
Stored Procedures and Functions (PDM)
The Dependencies tab of the Employee table property sheet shows that
ProcChangeLocation is dependent upon it.
258
Chapter 5. Building Triggers and Procedures
259
Stored Procedures and Functions (PDM)
260
Chapter 5. Building Triggers and Procedures
261
Stored Procedures and Functions (PDM)
Merging PDMs
You can also manually rebuild trigger and procedure dependencies at any
time.
2. Specify a rebuild mode for each of Procedures and Triggers. You can
choose between the following options:
Delete and Rebuild all triggers and/or procedures attached to
templates are deleted and rebuilt, including those to which you have
made modifications
Preserve only those triggers and/or procedures attached to templates
that have not been modified are deleted and rebuilt. Any triggers
and/or procedures that you have modified are preserved.
3. [optional] Click the Selection tab and specify the tables, views,
procedures, and (for Oracle only) database packages for which you want
to rebuild dependencies. By default all are selected.
4. Click OK to begin the rebuild process.
262
Chapter 5. Building Triggers and Procedures
263
Stored Procedures and Functions (PDM)
3. Click OK.
264
Chapter 5. Building Triggers and Procedures
2. Specify a rebuild mode. You can choose between the following options:
Delete and Rebuild all procedures attached to tables are deleted and
rebuilt
Add missing table stored procedures adds procedures to any selected
tables that do not presently have them.
3. [optional] Click the Selection tab to specify for which tables you want to
rebuild stored procedures.
4. Click OK to begin the rebuild process.
265
Procedure Templates (PDM)
266
Chapter 5. Building Triggers and Procedures
2. Click the Add a Row tool to add a new blank template to the list.
3. Type a new name and code for the new template and click Apply to
commit its creation.
4. Click the Properties tool to open the property sheet of the new procedure
template:
5. Click the Definition tab and enter or modify the definition code. You can
267
Procedure Templates (PDM)
use PDM variables and macros and various other tools available from the
toolbar (see SQL Code Definition Toolbars on page 270).
6. You can also modify other of the procedure templates properties. For a
full list of the properties available, see Procedure template properties
on page 269.
7. Click OK in each of the dialog boxes.
A confirmation box will appear, asking if you want to save the changes to
the DBMS.
Click Yes to confirm the template creation.
268
Chapter 5. Building Triggers and Procedures
the toolbar. For more information, see SQL Code Definition Toolbars
on page 270.
4. You can also modify other of the procedure templates properties. For a
full list of the properties available, see Procedure template properties
on page 269.
5. Click OK in each of the dialog boxes.
A confirmation box will appear, asking if you want to save the changes to
the DBMS.
Click Yes to confirm the template creation.
Property Description
Name The name of the item which should be clear and meaning-
ful, and should convey the items purpose to non-technical
users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Comment Descriptive label for the procedure template.
269
SQL Code Definition Toolbars
Tool Description
Edit with SQL Editor - Opens the SQL Editor dialog box. Pro-
vides object types and available objects for insertion in the trigger
definition.
270
Chapter 5. Building Triggers and Procedures
2. Click the SQL/XML Wizard tool to launch the wizard at the Tables and
Views Selection page:
271
Creating SQL/XML Queries with the Wizard
3. Select the tables and views that you want to include in your query and
click Next to go to the XML Hierarchy Design page:
On this tab, you construct the XML hierarchy that you want to generate:
The left-hand pane lists the tables and views that you have selected
272
Chapter 5. Building Triggers and Procedures
273
Creating SQL/XML Queries with the Wizard
274
Chapter 5. Building Triggers and Procedures
3. [optional] Click the Selection tab and select the Table or Procedure
subtab at the bottom of the tab. Select the tables or procedures that you
want to generate for. Note that if you want to generate a trigger script for
tables owned by a particular owner, you can select an owner from the
Owner list.
275
Generating Triggers and Procedures
The procedure from which you start the extended dependency is the
dependent procedure and the procedure at the other end of the link is the
influent procedure. The influent procedure will be generated before the
dependent procedure.
Circular extended If you create a reflexive and/or circular set of extended dependencies with
dependencies the <<DBCreateAfter>> stereotype, an error message is displayed during
the check model. If you choose to ignore this error, the stored procedures
will be generated in alphabetical order, without taking into account the
generation order, which could cause errors in the creation of stored
procedures in the database.
Example A publisher may decide to sell certain books at a reduced rate (15%) when a
customers order is above 10 000$.
In this model, one stored procedure GENERAL CHECK globally verifies
orders: check books availability, check the order amount, check if discount
rate is calculated, and applies discount rate to order bill. During the
execution of this stored procedure, the procedure DISCOUNT CALC is
called to calculate the 15% discount rate. It is important to generate
GENERAL CHECK before DISCOUNT CALC; you can define an extended
dependency to set the generation order between these two objects. To do so,
you have to open the property sheet of the dependent stored procedure, click
the Extended Dependencies tab and create an extended dependency with the
<<DBCreateAfter>> stereotype with the influent stored procedure.
276
Chapter 5. Building Triggers and Procedures
2. Select a dependent stored procedure in the list and click the Properties
tool.
The property sheet of the stored procedure is displayed.
3. Click the Extended Dependencies tab to display the Extended
Dependencies tab.
4. Click the Add Objects tool.
5. Select the Procedure tab in the Add Object selection dialog box.
6. Select the influent stored procedure check box and click OK.
7. Select the <<DBCreateAfter>> stereotype in the Stereotype list.
8. Click OK.
The influent stored procedure is displayed in the Influent Object column
of the list of extended dependencies of the dependent stored procedure.
+ For more information on extended dependencies, see Using extended
dependencies, in the Objects chapter of the Core Features Guide.
277
Generating Triggers and Procedures
278
Chapter 5. Building Triggers and Procedures
7. Click Execute.
A message box tells you that the command has been successfully
executed.
8. Click OK.
You return to the SQL query box.
9. Click Close.
You can choose to generate a user-defined error message from the trigger
generation parameters box.
5. Type the name of the column that contains the error number in the
Message Number box.
6. Type the name of the column that contains the error message text in the
Message Text column.
Below is an example of the details for a table called ERR_MSG.
279
Generating Triggers and Procedures
7. Click the General tab and select the mode and triggers to create.
8. Click the Selection tab and select the tables for which you want to create
triggers.
+ For more information on rebuilding triggers, see section Rebuilding
Triggers on page 229.
9. Click OK.
The trigger rebuilding process is shown in the Output window.
Select Database Generate Database to open the Database Generation
window.
280
CHAPTER 6
About this chapter This chapter explains how to manage access to the database using privileges
and permissions, and defining users, groups, roles, and object synonyms.
Contents Topic: page
281
Introducing database access
282
Chapter 6. Building a Database Access Structure
Users (PDM)
A user is a database object that identifies a person who can login or connect
to the database. Users may have:
a role that specifies their responsibilities (see Roles (PDM) on
page 298)
membership in a group that specifies their rights (see Groups (PDM)
on page 300)
Note
Not all DBMSs support the concepts of user, role and group.
Creating a user
You can create a user in any of the following ways:
Select Model Users and Roles Users to access the List of Users, and
click the Add a Row tool.
Right-click the model or package in the Browser, and select New User.
+ For general information about creating objects, see the Objects Core
Features Guide .
User properties
You can modify an objects properties from its property sheet. To open a
user property sheet, double-click its Browser entry in the Users folder. The
following sections detail the property sheet tabs that contain the properties
most commonly entered for users.
The General tab contains the following properties:
283
Users (PDM)
Property Description
284
Chapter 6. Building a Database Access Structure
3. Click OK.
You can specify a default owner for each type of object that supports the
concept of ownership. The default owner will automatically be linked to all
the objects of this type that you create after making this change.
2. Select a user in the Default owner list in the Table groupbox. You can
create a new user by clicking the ellipsis button to the right of the Default
owner list.
3. Click OK.
285
Users (PDM)
Terminology
In some DBMS, system privileges are called permissions. In this manual,
the term privilege is used for any right granted to a user, a group, or a role.
Permissions are defined for objects.
System privileges vary according to the DBMS you are using. The list of
privileges also includes predefined roles (like connect, or resource) for an
easier use.
System privileges are granted to a user. A user with administrative profile is
also allowed to revoke a privilege in order to prevent a user from performing
certain actions over the database content.
The list of predefined system privileges allowed in the current DBMS is
available in the System entry under Script\Object\Privileges in the DBMS
resource file. The Privileges category also contains entries used to provide
the syntax for the different order corresponding to the DBMS privileges.
The procedure for defining privileges is identical for users, groups, and roles.
286
Chapter 6. Building a Database Access Structure
When you select specific privileges for the user, the list of privileges
displays the user privilege above the group privilege. The following table
summarizes the different privilege combinations:
3. Select one or more privileges and click OK to add them to the list of
privileges of the user, role, or group. By default, privileges are granted.
287
Users (PDM)
In the example below, the privileges in red are granted to the group to
which the user belongs.
288
Chapter 6. Building a Database Access Structure
5. Click OK.
Generating privileges
v To generate privileges
1. Select Database Generate Database to open the Database Generation
window, and specify the standard options, including whether you want to
generate to a script or to a live database connection.
+ For detailed information about using this window, see Generating a
Database section in the Generating a Database from a PDM chapter.
2. Select Users & Groups (with privileges) from the Settings set list in the
Quick Launch groupbox at the bottom of the window. This settings set
specifies standard options for generating privileges.
or:
Click the Options tab and click on User in the left-hand pane to display
the user generation options. Change the default options as appropriate.
+ For detailed information about settings sets, see Quick launch
selection and settings sets section in the Generating a Database from a
PDM chapter.
289
Users (PDM)
3. [optional] Click the Selection tab and select the Users sub-tab at the
bottom of the tab. Select the users that you want to generate for.
Permission Description
The procedure for defining privileges is identical for users, groups, and roles.
Inherited permissions A user belonging to a group or having a role with permissions inherits these
permissions. You can display or hide users with inherited permissions using
the following tools in the upper part of the Permissions tab:
290
Chapter 6. Building a Database Access Structure
Tool Action
When you select specific permissions for the user, the list of permissions
displays the user permission above the group permission. The following
table summarizes the different permission combinations:
Permission Description
combination
3. Select one or more objects and click OK to add them to the list of
permissions of the user, role, or group. If the current user belongs to a
group with permissions on the selected objects, these permissions appear
in red in the list.
291
Users (PDM)
292
Chapter 6. Building a Database Access Structure
You can also grant permissions for an object directly in its property sheet.
2. Click the Add Objects tool to open a selection box listing all the users (or
roles or groups) in the model.
3. Select one or more users and click OK to add them to the list of users
with permissions on the object. If the user belongs to a group with
permissions on the object, these permissions appear in red in the list.
293
Users (PDM)
294
Chapter 6. Building a Database Access Structure
6. Click OK.
295
Users (PDM)
2. Click the Ellipsis button beside the Columns box to open the Column
Permissions dialog box. The columns in the list show the permissions
available for each of the tables columns.
296
Chapter 6. Building a Database Access Structure
3. Click inside a column cell until the desired state is displayed, or select
one of the Permission state tools at the bottom of the tab.
4. Click OK to close the Column Permissions dialog box and return to the
property sheet. The cells corresponding to selected column permissions
contain ellipsis symbols. Click on one of these symbols to display the
associated column permissions information in the Columns box.
5. Click OK.
297
Roles (PDM)
Roles (PDM)
A role is a predefined profile that can be assigned to users, or roles in those
DBMS that support this concept. Roles are reverse engineered in your model
and you can also create user-defined roles.
Roles may have:
privileges that control their level of access (see Granting system
privileges on page 286)
permissions that allow them to perform actions on objects (see Granting
object permissions on page 290)
Creating a role
You can create a role in any of the following ways:
Select Model Users and Roles Roles to access the List of Roles, and
click the Add a Row tool.
Right-click the model or package in the Browser, and select New Role.
+ For general information about creating objects, see the Objects Core
Features Guide .
Role properties
You can modify an objects properties from its property sheet. To open a role
property sheet, double-click its Browser entry in the Roles folder. The
following sections detail the property sheet tabs that contain the properties
most commonly entered for roles.
The General tab contains the following properties:
Property Description
298
Chapter 6. Building a Database Access Structure
4. Select one or more users and click OK to assign these users to the role.
5. Click OK.
299
Groups (PDM)
Groups (PDM)
Groups are used to facilitate the granting of privileges and permissions to
users. They prevent the time-consuming and error-prone process of
assigning privileges and permissions individually to each user.
Groups may have:
privileges that control their level of access (see Granting system
privileges on page 286)
permissions that allow them to perform actions on objects (see Granting
object permissions on page 290)
Creating a group
You can create a group in any of the following ways:
Select Model Users and Roles Groups to access the List of Groups,
and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Group.
+ For general information about creating objects, see the Objects Core
Features Guide .
Group properties
You can modify an objects properties from its property sheet. To open a
group property sheet, double-click its Browser entry in the Groups folder.
The following sections detail the property sheet tabs that contain the
properties most commonly entered for groups.
The General tab contains the following properties:
Property Description
300
Chapter 6. Building a Database Access Structure
5. Click OK.
301
Synonyms (PDM)
Synonyms (PDM)
A synonym is an alternative name for various types of objects (table, view,
sequence, procedure, function, synonym or database package). Synonyms
are created to:
Mask the name and owner of an object
Provide location transparency for remote objects of a distributed database
The database administrator can create a synonym for this table and owner
and call it SALES. In this case, the SQL statement is simplified in the
following way:
SELECT * FROM sales
In PowerDesigner synonyms are created for base objects. The base object is
the object used to create a synonym. Base objects support multiple
synonyms while each synonym must have only one base object. You can
view the synonyms depending on a base object in the Dependencies tab of
the base object property sheet.
If you delete the base object of a synonym, the synonym is deleted as well.
Creating a synonym
You can create a synonym as follows:
302
Chapter 6. Building a Database Access Structure
v To create a synonym
1. Select Model Synonyms to open the List of Synonyms.
2. Click the Create Synonyms tool to open a selection box listing all the
available objects in the model on various sub-tabs.
303
Synonyms (PDM)
4. Click in the Name column of one of the rows and enter a new name for
the synonym. Alternatively, you can click the Properties tool to open the
property sheet of the synonym and edit its name and other properties
there.
Synonym properties
You can modify an objects properties from its property sheet. To open a
synonym property sheet, double-click its Browser entry in the Synonyms
folder.
The General tab contains the following properties:
Property Description
304
Chapter 6. Building a Database Access Structure
Property Description
Type For those DBMS that support it (for example DB2) you can
create an alias instead of a synonym. In PowerDesigner
synonyms and aliases are managed in the same way whereas
their behavior in the database may be different
If you create a view for the ORDERS synonym, the view query displays the
select order of the table content:
305
Synonyms (PDM)
Generating synonyms
You can generate synonyms from the Database Generation dialog box. For
more information, see Generating a Database section in the Generating a
Database from a PDM chapter.
306
Chapter 6. Building a Database Access Structure
307
CHAPTER 7
About this chapter This chapter describes how to create, generate and reverse engineer web
services in the following databases:
Sybase Adaptive Server Anywhere 9 and over
Sybase Adaptive Server Enterprise 15 and over
Sybase IQ12.6 and over
IBM DB2 v8.1 and over
309
Introducing Web Services
Web services are made of a set of operations. Each operation contains a SQL
query for retrieving data from a database.
310
Chapter 7. Building Web Services
311
Web Services (PDM)
312
Chapter 7. Building Web Services
Property Description
Name Name of the web service. Used in URIs to access the web
service. It can neither start with a slash nor contain two
consecutive slashes
Local path Name prefixing the web service. If you type a path, the
User-Defined tool (beside the Local path box) is pushed-in.
Click the User-Defined tool to recover the original path.
The default value is the name of the web service
313
Web Services (PDM)
Property Description
Service type [ASA, ASE, and IQ only] Specifies the type of web service.
You can choose from:
DISH - [ASA and IQ only] acts as a proxy for a group
of SOAP services and generates a WSDL (Web Ser-
vices Description Language) file for each of its SOAP
services. When you create a DISH service, you must
specify a prefix name (on the Extended Attributes tab)
for all the SOAP services to which the DISH service ap-
plies. PowerDesigner treats SOAP web services as Web
operations (see Web Operations (PDM) on page 316)
of DISH web services.
HTML [ASA and IQ only] the result of the SQL state-
ment or procedure is formatted as an HTML document
(with a table containing rows and columns).
RAW - the result of the SQL statement or procedure is
sent without any additional formatting.
SOAP - [ASE only] generates a WSDL (Web Services
Description Language) file.
XML - the result of the SQL statement or procedure
is sent in XML. By default, the result is converted into
XML RAW format.
This tab lists the web operations associated with the web service (see Web
Operations (PDM) on page 316).
314
Chapter 7. Building Web Services
Property Description
Port number Specifies the port number for the test URL.
Server name Specifies the server name for the test URL.
Name prefix [ASA and IQ only] Specifies the name prefix for DISH
(dish services services.
only)
Database name [ASE only] Specifies the database name for the test URL.
Property Description
Required au- If selected, all users must provide a name and a password.
thorization When cleared, a single user must be identified
315
Web Operations (PDM)
Property Description
Name Name of the web operation. In URIs, it comes after the name
of the web service followed by a slash. It can neither start with
a slash nor contain two consecutive slashes
316
Chapter 7. Building Web Services
Property Description
Operation [IBM DB2 only] Specifies the type of operation. You can
Type choose from the following:
call - invokes a stored procedure with parameters and result
columns for the web operation
query - retrieves relational data using the SQL select state-
ment in the Implementation tab
retrieveXML - retrieves an XML document from relational
data. The mapping of relational data to XML data is defined
by a DAD file with SQL or RDB as MappingType
storeXML - stores an XML document as relational data.
The mapping of XML data to relational data is defined by a
DAD file, with RDB as MappingType
update - executes the SQL update statement with optional
parameters. Parameters can be created from the Parameters
tab in the web operation property sheet
This tab lists the web parameters associated with the web operation. These
parameters are part of the SQL statement defined on the Implementation tab.
They can be created on this tab, before generating a web service, or reverse
engineered from a web service (ASA, ASE, and IQ only).
You can use the following tools to add parameters on this tab:
This tab displays the SQL statement for the web service. You can use the
following tools to type the SQL statement:
317
Web Operations (PDM)
Edit with Opens the SQL Editor dialog box. Provides object
SQL Editor types and available objects to insert in the SQL
statement
318
Chapter 7. Building Web Services
This tab lists the result columns associated with the web operation (see
Web Operation Result Columns on page 320).
You can use the following tools to add result columns on this tab:
Property Description
Required au- If selected, all users must provide a name and a password.
thorization When cleared, a single user must be identified
319
Web Operations (PDM)
Property Description
Property Description
Data Type [IBM DB2 only] Select an XML schema data type from the
list, or click the Select Object tool to open a selection dialog
box where you select a global element in an XML model open
in the workspace
Is element [IBM DB2 only] Checked and greyed when a global element is
attached to a result column
320
Chapter 7. Building Web Services
+ For general information about creating objects, see the Objects Core
Features Guide .
Property Description
Web Oper- Name of the web operation containing the web parameter.
ation
321
Web Parameters (PDM)
Property Description
Data Type [For IBM DB2] Select an XML schema data type from the list,
or click the Select Object tool to open a selection dialog box
where you select a global element in an XML model open in
the workspace.
[For ASE] Select a datatype from the list.
Is element [IBM DB2 only] Checked and greyed when a global element is
attached to a web parameter.
322
Chapter 7. Building Web Services
323
Generating Web Services
2. [optional] Click the Options tab and click on Web Service in the left-hand
pane to display the web service generation options. Change the default
options as appropriate.
3. [optional] Click the Selection tab and select the Web Services subtab at
the bottom of the tab. Select the web services that you want to generate.
4. Click OK to begin the generation.
Note that for web services generated to a live database connection, you may
have to refresh the Web Services folder before they appear.
324
Chapter 7. Building Web Services
5. Click the Select a Path button, to the right of the Directory box, and
specify a path for the DADX files.
6. Click the Selection tab, and select the web services for which you want to
generate a DADX file.
325
Generating Web Services
326
Chapter 7. Building Web Services
327
Reverse Engineering Web Services
Database HTTP web services without a common local path are grouped
as PowerDesigner web operations of an HTTP web service named raw,
xml or html:
Software Web service Type Web operation
name name
328
Chapter 7. Building Web Services
329
CHAPTER 8
About this chapter This chapter describes how to work with data models.
Contents Topic: page
331
Customizing the Data Modeling Environment
332
Chapter 8. Working with Data Models
The options on this tab affect all the objects in the model, including those
already created, while changes to the object-specific options on the
sub-category tabs only affect objects created subsequently.
You can set the following options on this tab:
Option Description
Name/Code Specifies that the names and codes for all objects are case
case sensi- sensitive, allowing you to have two objects with identical
tive names or codes but different cases in the same model.
If you change case sensitivity during the design process,
we recommend that you check your model (Tools Check
Model) to verify that your model does not contain any
duplicate objects.
333
Customizing the Data Modeling Environment
Option Description
Use data Specifies that the complete data type is displayed in entity
type full symbols.
name
Default data Specifies a default data type to apply to domains and attributes
type if none is selected for them.
Notation You can choose between the following notations:
Entity / Relationship [Default used throughout this man-
ual] Entity/relationship notation connects entities with
links representing one of four relationships between them.
These relationships have properties that apply to both en-
tities involved in the relationship
Merise - uses associations instead of relationships
E/R + Merise - both entity/relationship and Merise are
used in the same model
IDEF1X - data modeling notation for relationships and en-
tities. In this notation, each set of relationship symbols de-
scribes a combination of the optionality and cardinality of
the entity next to it
Barker inheritances are represented by placing the child
entities inside the parent entity symbol, and relationships
are drawn in two parts, each reflecting the multiplicity of
the associated entity role.
For more information about these notations, see Supported
CDM/LDM notations on page 361
Unique code Requires that data items or relationships have unique codes
334
Chapter 8. Working with Data Models
Option Description
Allow reuse Allows the reuse of one data item as an attribute for more
than one entity provided the attributes have same name and
data type and do not belong to a primary key.
When deselected or when the attribute belongs to a primary
key, the data item cannot be reused. In this case, if the Unique
code check box is selected, a new data item with identical
name but different code is created, otherwise a new data item
with identical name and code is created.
When you delete an entity or entity attributes, these options
determine whether or not the corresponding data items are
also deleted, as follows:
Both deletes the entity attribute.
Unique Code only deletes the entity attribute.
Allow Reuse only deletes the entity attribute and the cor-
responding data item (if it is not used by another entity).
None deletes the entity attribute and the corresponding
data item.
To set migration settings, select Tools Model Options, and select the
Migration settings sub-category in the left-hand Category pane.
Option Description
Migrate at- Enables the domain, the checks or the rules to be kept when
tribute prop- an attribute is migrated.
erties
335
Customizing the Data Modeling Environment
Option Description
Foreign at- Specifies the naming convention for migrated foreign iden-
tribute name tifiers. You can select one of the default templates from the
list or enter your own using the following variables:
%PARENT% - Name/Code of the parent entity
%ATTRIBUTE% - Name/Code of the parent attribute
%IDENTIFIER% - Name/Code of the identifier con-
straint attached to the relationship
%RELATIONSHIP% - Name/Code of the relationship
%PARENTROLE% - Role of the entity that generated the
parent entity, this variable proceeds from the conceptual
environment. If no role is defined on the relationship,
%PARENTROLE% takes the content of %PARENT% to
avoid generating an attribute with no name
The following example checks the %PARENTROLE%
value; if it is equal to the parent name (which is
the replacement value) then the template %.3:PAR-
ENT%_%ATTRIBUTE% will be used, otherwise template
%PARENTROLE% will be used because the user has
entered a parent role for the relationship:
Note that customized naming templates reappear in the
generation dialog box the next time you open it, but are not
saved to the list of predefined templates.
Use template Controls when the primary identifier attribute name template
will be used. You can choose between the following radio
buttons:
Always use template.
Only use template in case of conflict.
These options are available for relationships and automatic for inheritances,
except the Only use template in case of conflict option, which is always
triggered.
336
Chapter 8. Working with Data Models
The options on this tab affect all the objects in the model, including those
already created, while changes to the object-specific options on the
sub-category tabs only affect objects created subsequently.
You can set the following options on this tab:
Option Function
Name/Code Specifies that the names and codes for all objects are case
case sensitive sensitive, allowing you to have two objects with identical
names or codes but different cases in the same model.
If you change case sensitivity during the design process,
we recommend that you check your model (Tools Check
Model) to verify that your model does not contain any
duplicate objects.
337
Customizing the Data Modeling Environment
Option Function
To set model options for tables and views, select Tools Model Options,
and select the Table & View sub-category in the left-hand Category pane.
338
Chapter 8. Working with Data Models
339
Customizing the Data Modeling Environment
Option Function
Table: Default Specifies a default owner for the tables in your model from
owner the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click
the Add a Row tool.
If the user specified is subsequently deleted, this option
(and the ownership of all associated objects) will be reset
to none.
View: Default Specifies a default owner for the views in your model from
owner the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click
the Add a Row tool.
If the user specified is subsequently deleted, this option
(and the ownership of all associated objects) will be reset
to none.
To set model options for columns and domains, select Tools Model
Options, and select the Column & Domain sub-category in the left-hand
Category pane.
340
Chapter 8. Working with Data Models
Option Function
To set model options for references, select Tools Model Options, and
select the Reference sub-category in the left-hand Category pane.
341
Customizing the Data Modeling Environment
Option Function
Unique code Requires that references have unique codes. If this option
is not selected then different references can have the same
code (except when two references share the same child
table).
342
Chapter 8. Working with Data Models
Option Function
Default link on Specifies how reference links are created. You can select
creation either:
Primary key automatically create links from primary
key to foreign key columns at creation
User-defined manually create your own links
343
Customizing the Data Modeling Environment
Option Function
Default Con- Controls how updating a key value in the parent table will,
straints: Up- by default, affect the foreign key value in the child table.
date Depending on your DBMS, you can choose from some or
all of the following settings:
None no effect
Restrict cannot update parent value if one or more
matching child values exist (no effect)
Cascade - update matching child values
Set null - set matching child values to NULL
Set default set matching child values to default value
Default Con- Controls how deleting a key value in the parent table will,
straints: Delete by default, affect the foreign key value in the child table.
Depending on your DBMS, you can choose from some or
all of the following settings:
None no effect
Restrict cannot delete parent value if one or more
matching child values exist (no effect)
Cascade - delete matching child values
Set null - set matching child values to NULL
Set default set matching child values to default value
To set model options for sequences, select Tools Model Options, and
select the Sequence sub-category in the left-hand Category pane.
344
Chapter 8. Working with Data Models
Option Function
To set model options for indexes, select Tools Model Options, and select
the Index sub-category in the left-hand Category pane.
You can set the following options on this tab:
Option Function
Table: De- Specifies a default owner for the table indexes in your model
fault Owner from the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click the
Add a Row tool.
If no default user is specified here, then the owner of the
parent table is used by default.
If the user specified is subsequently deleted, this option (and
the ownership of all associated objects) will be reset to none.
View: De- Specifies a default owner for the view indexes in your model
fault Owner from the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click the
Add a Row tool.
If no default user is specified here, then the owner of the
parent view is used by default.
If the user specified is subsequently deleted, this option (and
the ownership of all associated objects) will be reset to none.
To set model options for join indexes, select Tools Model Options, and
select the Join Index sub-category in the left-hand Category pane.
345
Customizing the Data Modeling Environment
Option Function
Default Specifies a default owner for the join indexes in your model
owner from the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click the
Add a Row tool.
If the user specified is subsequently deleted, this option (and
the ownership of all associated objects) will be reset to none.
To set model options for procedures, select Tools Model Options, and
select the Procedure sub-category in the left-hand Category pane.
You can set the following options on this tab:
Option Function
To set model options for triggers, select Tools Model Options, and select
the Trigger sub-category in the left-hand Category pane.
You can set the following options on this tab:
346
Chapter 8. Working with Data Models
Option Function
Option Function
Table: De- Specifies a default owner for the table triggers in your model
fault Owner from the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click the
Add a Row tool.
If no default user is specified here, then the owner of the
parent table is used by default.
If the user specified is subsequently deleted, this option (and
the ownership of all associated objects) will be reset to none.
View: De- Specifies a default owner for the view triggers in your model
fault Owner from the list of users (see the section Creating a user in the
Managing Database Users chapter). To create a User, click
on the ellipsis button to open the List of Users, and click the
Add a Row tool.
If no default user is specified here, then the owner of the
parent view is used by default.
If the user specified is subsequently deleted, this option (and
the ownership of all associated objects) will be reset to none.
Rebuild au- Automatically rebuilds the triggers on the child and parent
tomatically tables of a reference when you:
triggers change the implementation of a reference
change the referential integrity rules of a reference imple-
mented by a trigger
change the child or parent table of a reference imple-
mented by a trigger (new and old)
create or delete a reference implemented by a trigger
change the maximum cardinality of the references
Note: If this option is not selected, you can manually instruct
PowerDesigner to rebuild triggers at any time by selecting
Tools Rebuild Objects Rebuild Triggers.
To set model options for database packages, select Tools Model Options,
and select the Database Package sub-category in the left-hand Category
pane.
347
Customizing the Data Modeling Environment
Option Function
For information about changing the format of symbols, see Format display
preferences in the Customizing your Modeling Environment chapter of the
Core Features Guide . The following sections list the options available to
customize the information displayed on a data model object symbols. Note
that the objects available to be customized in the Display Preferences
348
Chapter 8. Working with Data Models
Default options
Click the Default button to display default display preferences. Click
the Set As Default button to set current display preferences as default
selections.
349
Customizing the Data Modeling Environment
Category pane.
Preference Description
Hierarchy Displays the name of the hierarchy used to compute the cube
Preference Description
To set display preferences for cubes, select Tools Display Preferences, and
select the Cube sub-category in the left-hand Category pane.
Preference Description
Fact Mea- Displays fact measures. When selected, you can additionally
sures specify whether to display all fact measures, or to limit them
to a given number.
Fact Displays cube facts.
Stereotype Displays the stereotype of the cub. You can also display the
stereotype of the cube measures and facts.
350
Chapter 8. Working with Data Models
Preference Description
Preference Description
351
Customizing the Data Modeling Environment
symbol:
Stereotype:
Entity attributes
352
Chapter 8. Working with Data Models
attribute:
Replace by Domain for each entity attribute. You can only display
Domains domains when the Data type check box is selected.
Data types and Domain - Displays both data type and do-
main, if any:
attribute:
353
Customizing the Data Modeling Environment
identifiers:
Entity identifiers
Preference Description
Preference Description
354
Chapter 8. Working with Data Models
Preference Description
Preference Description
355
Customizing the Data Modeling Environment
Preference Description
Role names Displays the role names for parent and child tables of
references
Reference display mode + For information about changing the notation of references, see Setting
Model Settings on page 337.
356
Chapter 8. Working with Data Models
To set display preferences for tables, select Tools Display Preferences, and
select the Table sub-category in the left-hand Category pane.
Preference Description
Stereotype Displays stereotype of the table. You can also display the
stereotype of columns, keys, indexes, and triggers
357
Customizing the Data Modeling Environment
358
Chapter 8. Working with Data Models
Default options
Click the Default button to display default table display preferences. Click
the Set As Default button to set current display preferences as default
selections.
Table notation + For information about changing the notation of tables, see Setting
Model Settings on page 337.
To set display preferences for views, select Tools Display Preferences, and
select the View sub-category in the left-hand Category pane.
359
Customizing the Data Modeling Environment
Preference Description
Columns Displays the columns in the view. When selected, you can
choose between displaying all the columns, or to limit them
to a given number.
Tables Displays the tables in the view.
Indexes For those DBMS that support query tables, displays the
indexes in the views of type materialized view, summary
table or snapshot.
Owner Displays the names of view owners.
Index indica- For those DBMS that support query tables, displays the
tor indicator next to indexed columns.
To set display preferences for views, select Tools Display Preferences, and
select the View reference sub-category in the left-hand Category pane.
Preference Description
Role names Displays the role names for parent and child tables or views
of view references.
View reference display + For information about changing the notation of view references, see
mode
360
Chapter 8. Working with Data Models
361
Customizing the Data Modeling Environment
Inheritance symbols indicate if they are complete and if they have mutually
exclusive children:
No No
Yes No
No Yes
Yes Yes
IDEF1X notation In the Idef1x notation, entity names are displayed outside the symbol, and
dependent entities are drawn with round corners.
362
Chapter 8. Working with Data Models
Complete Symbol
Yes
No
Barker notation In the Barker notation, entities are drawn with round corners, and
inheritances are displayed by placing children inside the parent entity.
363
Customizing the Data Modeling Environment
Only attributes are listed and a symbol specifies whether each attribute is a
key, a mandatory or an optional attribute as follows:
364
Chapter 8. Working with Data Models
When you create a PDM, you select a target DBMS (see Creating a PDM
in the Building Physical Diagrams chapter). You can change the DBMS of a
model at any time.
You may be required to change the DBMS if you open a PDM and the
associated DBMS file has been deprecated, or is otherwise unavailable. In
this case the Choose DBMS dialog box will open, inviting you to select a
DBMS from the list.
If you change the target DBMS, the model may be altered to conform with
the new DBMS as follows:
All data types specified in your model will be converted to their
equivalents in the new DBMS. For more information about data types,
see Script/Data Type Category in the DBMS Resource File Reference
chapter of the Customizing and Extending PowerDesigner manual.
365
Customizing the Data Modeling Environment
366
Chapter 8. Working with Data Models
5. Select check boxes for the objects and options that you want to preserve.
6. Click OK.
A message box opens to tell you that the target database has been
changed.
7. Click OK to return to the model with the new DBMS.
367
Customizing the Data Modeling Environment
Option Definition
368
Chapter 8. Working with Data Models
Model Definitions in the Resource Files and the Public Metamodel chapter
of the Customizing and Extending PowerDesigner manual.
369
Generating Other Models from a Data Model
CDM X X X X
LDM X X X
PDM X X X X X
Generation options
For detailed information about the options available on the various tabs of
the Generation window, see the Linking and Synchronizing Models chapter
of the Core Features Guide .
370
Chapter 8. Working with Data Models
Inheritance Generalization -
Relationship - Reference
Persistent entities (OOM) All entities are generated as persistent classes with the Generate table
persistence mode.
When the Generate check box of an entity is not selected, the generated class
has the Migrate columns persistence mode.
The type of key that is generated in the PDM depends on the cardinality and
type of dependency defined for a relationship in the CDM. Primary
identifiers generate primary and foreign keys. Other identifiers that are not
primary identifiers generate alternate keys:
A primary key is a column or columns whose values uniquely identify a
row in a table.
371
Generating Other Models from a Data Model
Foreign key in the table generated by the entity on the many side of the
relationship
The following CDM shows an independent relationship. Each division
contains one or more employees:
372
Chapter 8. Working with Data Models
373
Generating Other Models from a Data Model
View - - Element
374
Chapter 8. Working with Data Models
Index - - Unique
375
Generating Other Models from a Data Model
When you configure the options of a CDM to generate, you may define
options diverging from the PDM options.
To avoid conflicts, PowerDesigner applies the following rule for default
values of CDM options: an option defined for the generated CDM should
respect the equivalent option of the PDM.
Equivalent Enforce non-divergence model options are available in both the
PDM and CDM.
The XML Builder Wizard helps you build an XML model (XSM) that will
be used to generate SQL/XML queries for retrieving data from databases. It
376
Chapter 8. Working with Data Models
377
Generating Other Models from a Data Model
Select the tables and views you want to generate. By default, all tables
and views are selected.
3. Click Next to go to the XML Hierarchy Design tab:
On this tab, you construct the XML hierarchy that you want to generate:
The left-hand pane lists the tables and views that you have selected
378
Chapter 8. Working with Data Models
4. You can build your XML hierarchy using the following techniques:
Specify whether columns will be generated as elements or attributes by
using the radio buttons above the panes.
Drag and drop a table, view, or column onto a node in the XML
hierarchy. You must respect the PDM hierarchy: You cannot create an
XML hierarchy between two elements if there is no reference between
their corresponding tables, and a parent table cannot be placed
beneath one of its children.
Right-click a table, view, or column and select Add from the contextual
menu to add it to the last selected node in the XML hierarchy.
Rename an element or attribute by clicking its node and typing a new
name.
Create new elements and attributes not in the PDM, and Sequence,
Choice and All group particles, by right-clicking an XML node and
selecting New object from the contextual menu.
Delete an XML node by right-clicking it and selecting Delete from the
contextual menu.
379
Generating Other Models from a Data Model
Tool Description
Properties Opens the property sheet for the selected table, view, or
column.
Add Object - Adds the selected PDM object to the XML hierarchy.
380
Chapter 8. Working with Data Models
Right-click the diagram background and select Check Model from the
contextual menu
The Check Model Parameters window opens, which allows you to specify
the kinds of checks to perform, and the objects to apply them to. For detailed
information about this window and correcting problems reported, see
Checking a Model in the Models chapter of the Core Features Guide .
The following sections document the data model-specific checks available
by default. For information about checks made on generic objects available
in all model types, see Checking a Model in the Models chapter of the
Core Features Guide .
381
Checking a Data Model
Abstract data Abstract data type names and codes must be unique in
type name and the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Abstract Data The code of the ADT is longer than the maximum
Type code maxi- allowed by the DBMS.
mum length Manual correction: Reduce the length of the code
Automatic correction: Reduces the code to a permissible
length
Instantiable ob- If an abstract data type of type Object (or SQLJ Object)
ject type must is instantiable (Abstract option not checked), then it must
have attributes have attributes and no abstract procedure.
and no abstract Manual correction: Define at least one attribute in the
procedures ADT Attributes tab and clear the Abstract option in the
procedures property sheet
Automatic correction: None
Abstract object If an abstract data type of type Object (or SQLJ Object)
type must not is not instantiable (Abstract option checked), then it must
have tables based not have tables based on it.
on it Manual correction: Set the Based on property to
<None> in the tables property sheet
Automatic correction: None
Abstract data Abstract data type procedure names and codes must be
type procedure unique in the abstract data type.
name and code Manual correction: Modify the duplicate name/code
uniqueness Automatic correction: Appends a number to the dupli-
cate name/code
382
Chapter 8. Working with Data Models
Abstract Data The code of the ADT procedure is longer than the
Type procedure maximum allowed by the DBMS.
code maximum Manual correction: Reduce the length of the code
length Automatic correction: Reduces the code to a permissible
length
Procedure cannot An abstract data type procedure cannot have the same
have the same name as an attribute.
name as an at- Manual correction: Change the name of the ADT proce-
tribute dure
Automatic correction: None
383
Checking a Data Model
Maximal cardi- An association with more than two links can only have
nality links links with a maximum cardinality greater than one.
Manual correction: Change the maximum cardinality of
such links to be greater than 1.
Automatic correction: None.
384
Chapter 8. Working with Data Models
Attribute name Attribute names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
385
Checking a Data Model
Detect inconsis- The values entered in the check parameters tab are
tencies between inconsistent for numeric and string data types: default
check parameters does not respect minimum and maximum values, or
default does not belong to list of values, or values in
list are not included in minimum and maximum values,
or minimum is greater than maximum value. Check
parameters must be defined consistently.
Manual correction: Modify default, minimum, maximum
or list of values in the check parameters tab
Automatic correction: None
Precision > Max- The data type precision should not be greater than the
imum length length. Note that some DBMS accept a precision higher
than the length.
Manual correction: Make the data type length greater
than the precision
Automatic correction: None
386
Chapter 8. Working with Data Models
Undefined data A model should not contain columns with undefined data
type type, all columns should have a defined data type.
Manual correction: Select a data type in the column
property sheet
Automatic correction: None
387
Checking a Data Model
Cube name and Cubes names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Existence of as- A cube must have at least one association with a dimen-
sociation sion.
Manual correction: Create an association between the
cube and a dimension
Automatic correction: None
Duplicated asso- A cube cannot have more than one association with the
ciation with the same dimension.
same dimension Manual correction: Delete one of the associations
Automatic correction: None
Database name Database names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
Database code The code of the database is longer than the maximum
maximum length allowed by the DBMS.
Manual correction: Reduce the length of the code
Automatic correction: Reduces the code to a permissible
length
388
Chapter 8. Working with Data Models
Database not The database you have created is not used in the model.
used Manual correction: Delete the database or apply the
database as a physical option to a table, an index, a key,
a column, a storage, a tablespace or a view (Options tab
of the object property sheet)
Automatic correction: None
389
Checking a Data Model
Check for unde- You should define a return data type for a cursor.
fined return types Manual correction: Select a return data type in the cursor
property sheet
Automatic correction: None
390
Chapter 8. Working with Data Models
391
Checking a Data Model
Check for unde- If the package procedure is a function, you should define
fined return types a return data type for the function.
Manual correction: Select a return data type in the Return
Data Type list
Automatic correction: None
Package type Package type names and codes must be unique in the
name and code database package.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Package variable Variable names and codes must be unique in the database
name and code package.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
392
Chapter 8. Working with Data Models
Data item name Data item names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code.
Data item not There are unused data items. These are useless for PDM
used generation.
Manual correction: To use a data item, add it to an entity.
If you do not need an unused data item, delete it to allow
PDM generation.
Automatic correction: None.
Data item used There are entities using the same data items. This can be
multiple times tolerated if you defined this check as a warning.
Manual correction: Take care to ensure consistency
when defining data item properties.
Automatic correction: None.
Detect inconsis- The values entered in the check parameters page are
tencies between inconsistent for numeric and string data types: default
check parameters does not respect minimum and maximum values, or
default does not belong to list of values, or values in
list are not included in minimum and maximum values,
or minimum is greater than maximum value. Check
parameters must be defined consistently.
Manual correction: Modify default, minimum, maximum
or list of values in the check parameters page
Automatic correction: None.
393
Checking a Data Model
Precision > max- The data type precision should not be greater than or
imum length equal to the length.
Manual correction: Make the data type length greater
than or equal to the precision.
Automatic correction: None.
Undefined data Undefined data types for data items exist. To be com-
type plete, a model should have all its data items data types
defined.
Manual correction: While undefined data types are toler-
ated, you must select data types for currently undefined
data types before you can generate a PDM.
Automatic correction: None.
Invalid data type Invalid data types for data items exist. To be complete,
a model should have all its data types for data items
correctly defined.
Manual correction: While tolerated, you must select
valid data types for currently non-valid data types to
generate the PDM.
Automatic correction: None.
Data source name Data source names and codes must be unique in the
and code unique- model.
ness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
394
Chapter 8. Working with Data Models
Data source con- The models in a data source should share the same
taining models DBMS since they represent a single database.
differing DBMS Manual correction: Delete models with different DBMS
types or modify the DBMS of models in the data source
Automatic correction: None
Default name and Default names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Default value You must type a value for the default, this value is used
empty during generation.
Manual correction: Type a value in the Value box of the
default property sheet
Automatic correction: None
Several defaults A model should not contain several defaults with identi-
with same value cal value.
Manual correction: Modify default value or delete
defaults with identical value
Automatic correction: None
395
Checking a Data Model
396
Chapter 8. Working with Data Models
Domain name Domain names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
397
Checking a Data Model
Detect Inconsis- The values entered in the Check Parameters tab are
tencies between inconsistent for numeric and string data types. Default
check parameters does not respect minimum and maximum values, or
default does not belong to list of values, or values in
list are not included in minimum and maximum values,
or minimum is greater than maximum value. Check
parameters must be defined consistently.
Manual correction: Modify default, minimum, maximum
or list of values in the check parameters tab
Automatic correction: None
Precision > max- The data type precision should not be greater than the
imum length length.
Manual correction: Make the data type length greater
than the precision
Automatic correction: None
Undefined data A model should not contain domains with undefined data
type type, all domains should have a defined data type.
Manual correction: Select a data type from the domain
property sheet
Automatic correction: None
Invalid data type [CDM/LDM only] Invalid data types for domains exist.
To be complete, a model should have all its domain data
types correctly defined.
Manual correction: While tolerated, you must select
valid data types for currently non-valid data types to
generate the PDM.
Automatic correction: None.
398
Chapter 8. Working with Data Models
Entity attribute Attribute names and codes must be unique in the entity.
name and code Manual correction: Modify the duplicate name/code
uniqueness
Automatic correction: Appends a number to the dupli-
cate name/code.
Entity attribute Attribute names and codes must be unique in the entity.
name and code Manual correction: Modify the duplicate name/code
uniqueness
Automatic correction: Appends a number to the dupli-
cate name/code.
399
Checking a Data Model
Detect inconsis- The values entered in the Check Parameters page are
tencies between inconsistent for numeric and string data types. Default
check parameters does not respect minimum and maximum values, or
default does not belong to list of values, or values in
list are not included in minimum and maximum values,
or minimum is greater than maximum value. Check
parameters must be defined consistently.
Manual correction: Modify default, minimum, maximum
or list of values in the check parameters page
Automatic correction: None.
Precision > max- The data type precision should not be greater than or
imum length equal to the length.
Manual correction: Make the data type length greater
than or equal to the precision.
Automatic correction: None.
Invalid data type Invalid data types for attributes exist. To be complete,
a model should have all its data types for attributes
correctly defined.
Manual correction: While tolerated, you must select
valid data types for currently non-valid data types to
generate the PDM.
Automatic correction: None.
400
Chapter 8. Working with Data Models
Entity identifier Entity identifier names and codes must be unique in the
name and code namespace.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code.
Existence of en- At least one attribute must exist for an entity identifier.
tity attribute Manual correction: Add an attribute to the entity identi-
fier or delete the identifier.
Automatic correction: None.
Entity name and Entity names and codes must be unique in the names-
code uniqueness pace.
Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code.
Entity name and The entity name and code length is limited to a maxi-
code maximum mum length of 254 characters specified in the naming
length conventions of the model options.
Manual correction: Modify the entity name/code length
to meet this requirement.
Automatic correction: Truncates the entity name/code
length to the maximum length specified in the naming
conventions.
401
Checking a Data Model
Number of serial An entity cannot have more than one serial type attribute.
types > 1 Serial types are automatically calculated values.
Manual correction: Change the types of the appropriate
entity attributes to have only one serial type attribute.
Automatic correction: None.
Redundant inher- An entity inherits from another entity more than once.
itance This is redundant and adds nothing to the model.
Manual correction: Delete redundant inheritances
Automatic correction: None.
Multiple inheri- An entity has multiple inheritance. This is unusual but
tance can be tolerated if you defined this check as a warning.
Manual correction: Make sure that the multiple inheri-
tance is necessary in your model.
Automatic correction: None.
402
Chapter 8. Working with Data Models
Fact name and Fact names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
403
Checking a Data Model
Fact measure Fact measure names and codes must be unique in the
name and code model.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Group name and Group names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Group code max- The group code length is limited by the maximum length
imum length specified in the DBMS definition (MaxLen entry, in the
Objects Group category) or in the naming conventions
of the model options.
Manual correction: Modify the group code length to
meet this requirement
Automatic correction: Truncates the group code length
to the maximum length specified in the DBMS definition
404
Chapter 8. Working with Data Models
objects:
405
Checking a Data Model
Index code maxi- The index code length is limited by the maximum length
mum length specified in the DBMS definition (MaxLen entry, in the
Objects Index category) or in the naming conventions
of the model options.
Manual correction: Modify the index code length to
meet this requirement
Automatic correction: Truncates the index code length
to the maximum length specified in the DBMS definition
Index column The current DBMS does not support more than the
count number of index columns specified in the MaxColIndex
entry of the current DBMS.
Manual correction: Delete one or more columns in the
index property sheet. You can create additional indexes
for these columns
Automatic correction: None
406
Chapter 8. Working with Data Models
Join index name Join index names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
Existence of base Join index must have a base table.
table Manual correction: Select a base table in the join index
property sheet
Automatic correction: None
Join Index tables The tables associated to a join index must have the same
owners owner.
Manual correction: Modify the join index owner or the
table owner
Automatic correction: None
407
Checking a Data Model
Join index refer- Join index references must be connected to selected table
ences connection on a linear axis.
Manual correction: Delete or replace references in the
join index
Automatic correction: None
Duplicated join Join indexes cannot have the same set of references.
indexes Manual correction: Delete one of the duplicated join
indexes
Automatic correction: None
Key name and Key names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Key code length The key code length is limited by the maximum length
specified in the DBMS definition (MaxConstLen entry,
in the Object Key category).
Manual correction: Modify the key code length to meet
this requirement
Automatic correction: Truncates the key code length to
the maximum length specified in the DBMS definition
Key column ex- Each key must have at least one column.
ists Manual correction: Add a column to the key from the
Column tab of the key property sheet
Automatic correction: Deletes key without column
Key inclusion A key cannot include another key (on some columns,
regardless of their order).
Manual correction: Delete the key that includes an
existing key
Automatic correction: None
408
Chapter 8. Working with Data Models
409
Checking a Data Model
Constraint name [PDM only] The constraint name length cannot be longer
maximum length than the length specified in the DBMS definition: either
in the MaxConstLen entry, in the Object category, or in
each object category.
Manual correction: Modify the constraint name to meet
this requirement
Automatic correction: Truncates the constraint name to
the maximum length specified in the DBMS definition
410
Chapter 8. Working with Data Models
Procedure name Procedure names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
411
Checking a Data Model
Reference name Reference names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
412
Chapter 8. Working with Data Models
Join order The join order must be the same as the key column order
for some DBMS.
Manual correction: If required, change the join order to
reflect the key column order
Automatic correction: The join order is changed to
match the key column order
During a reference check, the following object controls
are made.
413
Checking a Data Model
Role name and Role names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
414
Chapter 8. Working with Data Models
Role code maxi- The role code length is limited by the maximum length
mum length specified in the DBMS definition (MaxLen entry, in the
Objects Role category) or in the naming conventions
of the model options.
Manual correction: Modify the role code length to meet
this requirement
Automatic correction: Truncates the role code length to
the maximum length specified in the DBMS definition
Sequence name Default names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
Sequence code The code of the sequence is longer than the maximum
maximum length allowed by the DBMS.
Manual correction: Reduce the length of the code
Automatic correction: Reduces the code to a permissible
length
415
Checking a Data Model
Storage name and Storage names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Storage code The code of the storage is longer than the maximum
maximum length allowed by the DBMS.
Manual correction: Reduce the length of the code
Automatic correction: Reduces the code to a permissible
length
Storage not used The storage you have created is not used in the model.
Manual correction: Delete the storage or apply the
storage as a physical option to a table, an index, a key, a
column, a tablespace or a view (Options tab of the object
property sheet)
Automatic correction: None
Synonym name Synonym names and codes must be unique in the model.
and code unique- Manual correction: Modify the duplicate name/code
ness
Automatic correction: Appends a number to the dupli-
cate name/code
Synonym name The synonym name and code length is limited by the
and code maxi- maximum length specified in the DBMS definition
mum length (MaxLen entry, in the Objects Synonym category) and
in the naming conventions of the model options.
Manual correction: Modify the name/code length to
meet this requirement
Automatic correction: Truncates the name/code length
to the maximum length specified in the DBMS definition
416
Chapter 8. Working with Data Models
Table name and Tables names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Table name and The table name and code length is limited by the maxi-
code length mum length specified in the DBMS definition (MaxLen
entry, in the Objects Table category) and in the naming
conventions of the model options.
Manual correction: Modify the name/code length to
meet this requirement
Automatic correction: Truncates the name/code length
to the maximum length specified in the DBMS definition
Existence of col- A table should contain at least one column, one index,
umn, reference, one key, and one reference.
index, key Manual correction: Add missing item to the definition of
the table
Automatic correction: None
417
Checking a Data Model
Table index defi- Identical indexes are indexes with the same columns,
nition uniqueness order and type. A table cannot have identical indexes.
Manual correction: Delete index or change its properties
Automatic correction: None
418
Chapter 8. Working with Data Models
Table collapsing Table collapsing names and codes must be unique in the
name and code model.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Unavailable tar- The table resulting from the collapsing should be avail-
get table able.
Manual correction: Delete the table collapsing object
Automatic correction: Deletes the table collapsing object
Tablespace code The code of the tablespace is longer than the maximum
maximum length allowed by the DBMS.
Manual correction: Reduce the length of the code
Automatic correction: Reduces the code to a permissible
length
419
Checking a Data Model
Tablespace not The tablespace you have created is not used in the model.
used Manual correction: Delete the tablespace or apply the
tablespace as a physical option to a table, an index, a key,
a column, a storage or a view (Options tab of the object
property sheet)
Automatic correction: None
Trigger name and Trigger names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
User name and User names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
420
Chapter 8. Working with Data Models
User code maxi- The user code length is limited by the maximum length
mum length specified in the DBMS definition (MaxLen entry, in the
Objects User category).
Manual correction: Modify the user code length to meet
this requirement
Automatic correction: Truncates the user code length to
the maximum length specified in the DBMS definition
User password Users must have a password to be able to connect to the
empty database.
Manual correction: Define a password for the user
Automatic correction: None
421
Checking a Data Model
View name and View names and codes must be unique in the model.
code uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
View code maxi- The view code length is limited by the maximum length
mum length specified for the table code length.
Manual correction: Modify the view code length to meet
this requirement
Automatic correction: Truncates the view code length to
the maximum length specified in the DBMS definition
Existence of per- Permissions are usage restrictions set on a view for a
mission particular user, group or role.
Manual correction: Define permissions on the view for
users, groups and roles
Automatic correction: None
422
Chapter 8. Working with Data Models
Index code maxi- The view index code length is limited by the maximum
mum length length specified in the DBMS definition (MaxLen entry,
in the Objects Index category) or in the naming
conventions of the model options.
Manual correction: Modify the view index code length
to meet this requirement
Automatic correction: Truncates the view index code
length to the maximum length specified in the DBMS
definition
Existence of in- A view index must have at least one index column.
dex column Manual correction: Add an index column from the
Column tab of the view index property sheet or delete
the index
Automatic correction: Deletes the view index without
column
Index column The current DBMS does not support more than the
count number of index columns specified in the MaxColIndex
entry in the Index category of the current DBMS.
Manual correction: Delete one or more columns in the
view index property sheet. You can create additional
view indexes for these columns
Automatic correction: None
View index inclu- A view index should not include another index.
sion Manual correction: Delete the view index that includes
an existing index
Automatic correction: None
423
Checking a Data Model
View reference View reference names and codes must be unique in the
name and code model.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Existence of view A view reference must have at least one view reference
reference join join.
Manual correction: Create a view reference join for the
view reference or delete the reference
Automatic correction: Deletes view reference without
join
Web operation Web operation names and codes must be unique in the
name and code model.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Web operation The Web operation code length is limited by the maxi-
code maximum mum length specified in the DBMS definition (Maxlen
length entry, in the Objects Web Operation category).
Manual correction: Modify the Web operation code
length to meet this requirement
Automatic correction: Truncates the Web operation code
length to the maximum length specified in the DBMS
definition
424
Chapter 8. Working with Data Models
Web service Web service names and codes must be unique in the
name and code model.
uniqueness Manual correction: Modify the duplicate name/code
Automatic correction: Appends a number to the dupli-
cate name/code
Web service code The Web service code length is limited by the maximum
maximum length length specified in the DBMS definition (Maxlen entry,
in the Objects Web Service category).
Manual correction: Modify the Web service code length
to meet this requirement
Automatic correction: Truncates the Web service code
length to the maximum length specified in the DBMS
definition
425
Working with SQL
426
Chapter 8. Working with Data Models
+ For more information on defining views, see Defining a query for a view
in chapter Building Physical Diagrams.
+ For more information on defining computed columns, see Creating a
computed column in chapter Building Physical Diagrams.
2. Select an object type from the upper left part of the dialog box.
For example, select Tables to display the list of available tables. The list
of available objects of this type is displayed in the upper right part of the
dialog box.
3. Double-click the available object that you want to add to the script.
The item is added to the query script.
4. Select a function or an operator to add to the script from the Function or
Operator lists.
The item is added to the query script.
5. Click OK.
427
Working with SQL
Red Variable
Green Comment
You can use the following tools and keyboard shortcuts from the Preview
toolbar:
428
Chapter 8. Working with Data Models
Refresh F5
429
Working with SQL
Keyboard Description
shortcut
430
Chapter 8. Working with Data Models
3. Click OK.
431
Working with SQL
432
PART II
W ORKING WITH
DATABASES
This part explains how to link your Physical Data Models to your databases,
including how to generate a database from a PDM, and reverse-engineer a
PDM from a database.
CHAPTER 9
About this chapter This chapter explains how to connect to a database, and to generate and
modify databases via scripts or a live database connection.
Contents Topic: page
435
Connecting to a Database
Connecting to a Database
PowerDesigner provides various methods for connecting to your database.
Before connecting to your database for the first time, you will have to
configure a PowerDesigner connection profile. Your choice will depend on
the interface that you have installed:
v To connect to a database
1. Select Database Connect to open the Connect to a Data Source
window:
436
Chapter 9. Generating a Database from a PDM
3. Enter your user ID and password, and then click Connect. If prompted by
your database, you may need to enter additional connection parameters.
Connection time
You stay connected until you disconnect or terminate the shell session.
437
Generating a Database
Generating a Database
This section explains how to generate a database from a PDM.
PowerDesigner can generate a database creation script that you can run in
your DBMS environment or generate a database structure directly to a live
database connection.
v To generate a database
1. Select Database Generate Database to open the Database Generation
dialog box (for more information, see Database Generation dialog
General tab on page 440).
2. Type a destination directory and a filename for the script file in the
Directory and File Name boxes.
3. Select the Script generation or Direct Generation radio button.
4. [optional] Click the Options tab, and specify creation options for your
database objects (for more information, see Database Generation dialog
Options tab on page 443).
5. [optional] Click the Format tab, and specify format options for your
database objects (for more information, see Database Generation dialog
Format tab on page 456).
6. [optional] Click the Selection tab, and specify the database objects to be
created (for more information, see Database Generation dialog Selection
tab on page 458).
438
Chapter 9. Generating a Database from a PDM
7. [optional] Click the Summary tab to view the summary of your settings
and selections (for more information, see Database Generation dialog
Summary tab on page 459).
8. [optional] Click the Preview tab to preview the database script to be used
(for more information, see Database Generation dialog Preview tab on
page 459).
9. Click OK to begin the generation.
If you are creating a database script: The output window shows the
progress of the generation process, and indicates the syntax for running
the script. At the end of script generation, a Result box is displayed. It
lists the file path of the generated script file. Click Edit to open the script
in a text editor or Close to close the Result box.
If you are generating a database directly: If you are not currently
connected to a database, a dialog box asks you to identify a data source
and connection parameters.
Select a machine data source or file data source, type your user ID and
password and then click Connect. You may be prompted for additional
connection parameters.
439
Generating a Database
Parameter Description
One file only Specifies that the generation script is created as a single file.
By default, a separate script file is created for each table.
Edit genera- [available only when Direct generation is selected] Opens the
tion script generation script in a text editor for review or editing before
execution on the database.
440
Chapter 9. Generating a Database from a PDM
Parameter Description
The Quick Launch groupbox at the bottom of the General tab allows you to
load pre-configured selections and settings sets for use when generating the
database.
Selection A selection comprises:
a set of selections of database objects made on the Selection tab (see
Database Generation dialog Selection tab on page 458)
To save a selection, enter a name in the Selection bar at the bottom of the
General or Selection tab and then click Save. The selection is saved as part
of the model file.
Settings set A settings set comprises:
a set of options selected on the Options tab (see Database Generation
dialog Options tab on page 443) and
the format options specified on the Format tab (see Database Generation
dialog Format tab on page 456)
441
Generating a Database
3. Click OK.
Managing settings sets You can review your settings sets at any time by clicking on the Settings Set
Manager tool to launch the Settings Set Manager:
Icon Use
Import the selected settings sets to inside the model. Only available
when an externally-saved settings set is selected.
Note that settings sets should not be copied and renamed outside of
PowerDesigner. If you want to create a variant of an existing settings set,
then you should load it, make the necessary changes, and then save it under a
different name.
442
Chapter 9. Generating a Database from a PDM
Depending on the objects present in your model, some or all of the following
options will be available.
You can save your option settings via the Settings set bar at the bottom of the
tab. For more information, see Quick launch selection and settings sets on
page 441.
443
Generating a Database
Database options
Tablespace options
444
Chapter 9. Generating a Database from a PDM
Storage options
User options
Drop user Deletes the existing user before creating the new user.
Group options
Drop group Deletes the existing group before creating the new group.
Role options
445
Generating a Database
Drop group Deletes the existing role before creating the new role.
Domain options
446
Chapter 9. Generating a Database from a PDM
Default options
447
Generating a Database
Sequence options
These options control the generation of tables, columns, indexes, and keys.
Table options These options control the generation of tables.
448
Chapter 9. Generating a Database from a PDM
Drop table Deletes the existing table before creating the new table.
Primary key options These options control the generation of primary keys.
Create pri- Generates primary keys. If selected you can choose between:
mary key Inside Table - primary keys are generated during table
creation
Outside - primary keys are generated with a separate SQL
command, generally using an ALTER command after the
creation of the table
The generation of primary keys outside the table is possible
if the Create entry exists in the PKey category of the current
DBMS.
449
Generating a Database
Alternate key options These options control the generation of alternate keys.
Create alter- Generates alternate keys. If selected you can choose be-
nate key tween:
Inside Table - alternate keys are generated during table
creation
Outside - alternate keys are generated with a separate
SQL command, generally using an ALTER command af-
ter the creation of the table
The generation of alternate keys outside the table is possible
if the Create entry exists in the Key category of the current
DBMS.
Foreign keys options These options control the generation of foreign keys.
450
Chapter 9. Generating a Database from a PDM
Create for- Generates foreign keys. If selected you can choose between:
eign key Inside Table - foreign keys are generated during table cre-
ation
Outside - foreign keys are generated with a separate SQL
command, generally using an ALTER command after the
creation of the table
The generation of foreign keys outside the table is possible
if the Create entry exists in the Reference category of the
current DBMS.
451
Generating a Database
452
Chapter 9. Generating a Database from a PDM
View options
Force column Generates a view with a list of columns, even if this list is
list identical to the corresponding columns in the SQL order.
Allows you to generate the list of view columns with the
view creation order. By default, the list of view columns is
generated only if it is different from the list of columns of
the view query. For example, in the following view query:
select a, b from Table1
453
Generating a Database
Permission Generates the permission statement for the user during view
creation
Synonym options
454
Chapter 9. Generating a Database from a PDM
Physical op- Generates physical options for join indexes for those DBMS
tions that support it
Drop join Deletes an existing join index, before creating a new join
index index
Procedure options
Drop proce- Deletes the existing procedure before creating the new
dure procedure.
455
Generating a Database
Drop web Deletes the existing web service before creating the new web
service service.
Dimension options
Drop dimen- Deletes the existing dimension before creating the new
sion dimension.
456
Chapter 9. Generating a Database from a PDM
Database pre- Table and view names in the script are prefixed by the
fix database name.
Owner prefix Table and view names in the script are prefixed by their
owner names. For those DBMSs that support sequence
owners, this option will also prefix sequence names by their
owner names.
457
Generating a Database
Generate For those DBMSs that support comments, this option allows
name in to generate the name in the comment when the comment
empty com- box is empty. This option applies to tables, columns, and
ment views. The comment generated using the object name will
be reversed as a comment.
Character Specifies the case to use in the script. You can choose
case between:
Upper - all uppercase characters
Lower - all lowercase characters
Mixed - lowercase and uppercase characters
By default, all the objects in the model except for those that belong to a
458
Chapter 9. Generating a Database from a PDM
package, or that are shortcuts from another model are listed and selected for
generation.
You can save your selection via the Selection bar at the bottom of the tab.
For more information, see Quick launch selection and settings sets on
page 441.
For more information about Selection windows, see Adding an item from a
selection list section in the Objects chapter of the Core Features Guide .
459
Generating a Database
460
Chapter 9. Generating a Database from a PDM
For some DBMSs, a tablespace can use a specified storage in its definition.
The following table lists the DBMSs that support tablespaces and storages,
explains which concept they represent and indicates the commands that
implement PowerDesigner tablespace and storage options:
ADABAS NA NA
Informix NA NA
Ingres NA NA
InterBase NA NA
Microsoft Access NA NA
MySQL NA NA
PostgreSQL NA NA
461
Generating a Database
Teradata NA NA
The lists of tablespace and storage options offer pre-defined parameters for
each DBMS where applicable. The lists show default values and value lists
for certain parameters which correspond to the recommended values for the
DBMS.
+ For more information on tablespace and storage options for a particular
DBMS, see its reference manual.
2. Click the Add a Row tool to create a tablespace or storage and then click
the Properties tool to open its property sheet.
3. Click the Physical Options tab, and select and set the necessary physical
options:
462
Chapter 9. Generating a Database from a PDM
463
Generating a Database
5. Click OK.
The selected options appear in Options column of the List of Tablespaces
or List of Storages.
Customizing scripts
You can customize scripts as follows:
Insert scripts at the beginning and end of database creation script
Insert scripts before and after a table creation command
464
Chapter 9. Generating a Database from a PDM
You can use the following tools and keyboard shortcut from the script
toolbar:
End script After the last command in the database creation script
You can use the following variables in these scripts:
Variable Description
465
Generating a Database
466
Chapter 9. Generating a Database from a PDM
For each table, you have the option to insert the following scripts:
Begin script Immediately before the table creation command (after the
table title)
467
Generating a Database
Variable Description
468
Chapter 9. Generating a Database from a PDM
For each tablespace, you have the option to insert the following scripts:
Variable Description
469
Generating a Database
Variables have a syntax that can force a format on their values. Typical uses
are as follows:
Force values to lowercase or uppercase characters
Truncate the length of values
Enquote text
You embed formatting options in variable syntax as follows:
%[[?][-][width][.[-
]precision][c][H][F][U|L][T][M][q][Q]:]<varname>%
n (where n is an Blanks or zeros added to the left to fill the width and
integer) justify the output to the right
.L Lower-case characters
.U Upper-case characters
470
Chapter 9. Generating a Database from a PDM
471
Using Test Data
Date/Time
Example For a column named Employee Location, you create a test data profile
named Address using the Character class. You then define a test data source
472
Chapter 9. Generating a Database from a PDM
for Address. You can also assign it to other columns, such as Store Location,
and Client Address.
Default test data profiles If you do not assign a test data profile for a column, a default test data profile
is assigned to the column when you generate test data for the table. You
define default test data profiles for each class used to generate test data.
Test data restrictions The following objects are not taken into account when you generate test data:
Alternate keys
Foreign keys
Business and validation rules
Property Description
Profile class You can assign one of the following data type classes:
Number
Character
Date/Time
473
Using Test Data
When you define the profile class, make sure it reflects the DBMS
limitations, for example, someDBMS do not support dates prior to a certain
date.
Generation source You define a test data generation source for each data profile. You can use
the following test data generation sources:
Automatic By PowerDesigner
474
Chapter 9. Generating a Database from a PDM
You have the following options to define generation source parameters for
the profile class Number:
Option Description
475
Using Test Data
476
Chapter 9. Generating a Database from a PDM
You have the following options to define generation source parameters for
the profile class Character:
477
Using Test Data
Character selection You can specify valid characters to accept and invalid characters to refuse.
You use a comma ( , ) to separate each single character, character interval, or
string.
The following syntax applies to valid and invalid characters.
Mask characters A mask character is a pre-defined character that indicates to users that they
need to type a particular piece of information. The test data that is generated
respects the following mask characters:
A Letter
9 Number
? Any character
478
Chapter 9. Generating a Database from a PDM
479
Using Test Data
Defining an automatic test data generation source for date and time
You can define the following generation source parameters for the profile
class Date/Time:
Step Date/Time step Indicates date and time intervals for sequen-
tial data values.
480
Chapter 9. Generating a Database from a PDM
481
Using Test Data
482
Chapter 9. Generating a Database from a PDM
4. Click the Select a data source tool beside the Data source box and select a
machine or file data source. For more information, see Connecting to a
Database section in the Models chapter of the Core Features Guide .
5. Type the login and password corresponding to your data source.
6. Type the name of the table and column to query in the data source.
The variables in the default query are replaced by the table and column
values.
483
Using Test Data
You can also type a user-defined query in the Query box. The
user-defined button indicates when the default query has been modified.
You can click this button to recover the default query.
7. Click OK.
You return to the List of Test Data Profiles.
8. Click OK.
484
Chapter 9. Generating a Database from a PDM
485
Using Test Data
Value Description
Average Length
The Average Length box is only used for the Estimate data base size
function. The value that is displayed by default, is the maximum length for
the data type defined for a selected column.
Indicated column The following column properties are indicated on the Columns sheet:
properties
Indicator Property When selected, indicates that. . .
486
Chapter 9. Generating a Database from a PDM
487
Using Test Data
9. Click OK.
488
Chapter 9. Generating a Database from a PDM
Select a data profile for a domain, so that all columns attached to that
domain are automatically assigned the data profile.
+ For more information on how to select a data profile for a domain, see
chapter Building Physical Diagrams.
489
Using Test Data
490
Chapter 9. Generating a Database from a PDM
491
Using Test Data
492
Chapter 9. Generating a Database from a PDM
5. Click Save.
2. Select Database Generate Test Data to open the Test Data Generation
dialog box.
493
Using Test Data
3. Specify a directory and filename for your test data file, and then choose
between Script and Direct generation. For more information, see Test
Data Generation General tab on page 494.
4. [optional] To change the number of rows to be generated for specific
tables, click the Number of Rows tab. For more information, see Test
Data Generation Number of Rows tab on page 496.
5. [optional] To modify script formatting options, click the Format tab. For
more information, see Test Data Generation Format tab on page 497.
6. [optional] To control which tables will have test data generated, click the
Selection tab. For more information, see Test Data Generation Selection
tab on page 499.
7. Click OK to start the generation.
If you are generating a test data script : then a Result dialog box asks
you if you want to Edit or Close the newly generated file.
If you are generating test data to a live database connection , then a
Connect to a Data Source dialog box opens.
Select a data source, and then click Connect.
A message in the Output window indicates that the test data generation is
completed.
494
Chapter 9. Generating a Database from a PDM
Generation type Specifies how the test data will be generated. The
following settings are available:
Script generation - in DBMS-specific syntax
Direct generation to a live database connec-
tion
Data file as a set of values in a file
495
Using Test Data
Data file format For use with the data file option. The following
settings are available:
CSV comma-separated values
Custom delimiter specify a custom delimiter
Delete old data Deletes existing data before generating new data..
Default number of rows Specifies the default number of rows for table
Default number profile Specifies the default number profile for table
Default character profile Specifies the default character profile for table
Default date profile Specifies the default date profile for table
496
Chapter 9. Generating a Database from a PDM
497
Using Test Data
Encoding Specifies the encoding format to use for test data genera-
tion. You should select the encoding format that supports
the language used in your model and the database encod-
ing format.
Character case Specifies the character case to use. The following settings
are available:
Upper - all uppercase characters
Lower - all lowercase characters
Mixed - both uppercase and lowercase characters
498
Chapter 9. Generating a Database from a PDM
499
Estimating Database Size
Records in tables
You indicate a number of records in each table in your model.
Columns The estimated database size for a column is based on the following:
Size of fixed length data types
Average size of variable length data types
Indexes The estimate of the database size includes all indexes including primary key
indexes, foreign key indexes, alternate key indexes and database-specific
indexes such as IQ join indexes.
500
Chapter 9. Generating a Database from a PDM
Storage options Data storage options are DBMS specific. You define data storage options
supported by the target database. These are included in the estimate of
database size.
501
Estimating Database Size
4. Click OK.
502
Chapter 9. Generating a Database from a PDM
503
Estimating Database Size
4. Click OK.
The output list displays the estimated database size.
504
Chapter 9. Generating a Database from a PDM
4. If required, repeat steps 2 and 3 until all the tables of interest have been
selected throughout the model.
5. Click OK.
A confirmation box is displayed asking if you want to keep all previously
selected objects in the database size estimate.
6. Click OK.
The output list displays the estimated database size.
505
Modifying a Database
Modifying a Database
You can modify an existing database schema by synchronizing it with your
model. The existing schema can be in the form of:
an archive model
a live database connection
a script file
a model from the repository
The PDM (source model) and the existing database schema (target model)
are merged using a database synchronization window, which allows you to
choose which objects are added, deleted, or updated in the target.
v To modify a database
1. Select Database Apply Model Changes to Database to open the Apply
Model Changes to Database dialog box.
2. Type a destination directory and filename for the script file in the
Directory and File Name boxes.
3. Specify the type of generation to perform. You can choose between a
script and a live database connection.
4. Specify how PowerDesigner will obtain the database schema to modify.
You can choose between:
Using an archive model Click the button to the right to browse to the
archived model.
Using a data source Click the button to the right to connect to your
data source.
Using a script file Select a script from the list or click the button to
the right to browse to the script.
Using a model from repository Click the Change Model Version tool
to the right to browse to a version of the currently selected model.
5. If you want to retain your existing data, select the Backup Tables option.
If this option is not selected, then all existing data will be erased. For
details of this and other options on this tab, see Apply Model Changes to
Database dialog General tab on page 508.
6. [optional] If you want to change the default generation options, then click
the Options tab. For more information about these options, see Apply
Model Changes to Database dialog Options tab on page 510.
506
Chapter 9. Generating a Database from a PDM
7. [optional] If you want to change the format of your script, then click the
Format tab. This tab has the same functionality as in the Database
Generation window (see Database Generation dialog Format tab on
page 456).
8. [optional] If you want to control which database objects will be modified,
then click the Selection tab. This tab has the same functionality as in the
Database Generation window (see Database Generation dialog Selection
tab on page 458)
9. Click OK. If you are using a live database connection, then the Reverse
Engineering window will open, allowing you to select or clear check
boxes in the target model for objects that you want to include or remove
from the source model. Make your selections and then click OK to
continue.
10. The Database Synchronization window will open. Select or clear check
boxes in the target model for objects that you want to include or remove
from the model.
507
Modifying a Database
Option Description
508
Chapter 9. Generating a Database from a PDM
Option Description
One file only Specifies that the generation script is created as a single
file. By default, a separate script file is created for each
table.
Generation Type Specifies the type of generation to perform. You can
choose between:
Script generation - generate a script to be executed
on a DBMS at a later time
Direct generation generate a script and execute it
on a live database connection
Obtains database Select the kind of schema that the model will modify.
schema You can choose between:
Using an archive model - Modified PDM is merged
with an archived PDM.
Using a data source - Modified PDM is merged
with a reverse engineered database schema for a live
database connection.
Using a script file - Modified PDM script file is
merged with an existing database script file.
Using a model from repository - Modified PDM is
merged with a selected version of a PDM consoli-
dated in the repository.
Always use create Select a radio button to specify whether create state-
statements/ ments should always be used to modify database tables,
Use alter state- or whether alter statements should be used where pos-
ments when possi- sible
ble
509
Modifying a Database
Option Description
You can load option settings previously used for database generation via the
Settings set bar at the bottom of the tab. For more information, see Quick
launch selection and settings sets on page 441.
510
Chapter 9. Generating a Database from a PDM
These options are dependent on the selected DBMS and certain of them may
be unavailable.
This tab controls the format of your modification script. It has the same
511
Modifying a Database
The Selection tab allows you to specify individual objects to generate. It has
the same functionality as the equivalent tab in Database Generation (see
Database Generation dialog Selection tab on page 458).
512
Chapter 9. Generating a Database from a PDM
Accessing a Database
PowerDesigner allows you to display data from the database that
corresponds to your model, and to send SQL queries to a connected data
source.
513
Accessing a Database
2. Type one or more SQL statements in the window, and click Run to apply
them to the database.
514
CHAPTER 10
About this chapter This chapter describes how to reverse engineer database objects into a PDM.
Contents Topic: page
515
Getting Started with Reverse Engineering
Generate Description
using
Script file The script will normally be the script used to generate the
database but can also include other scripts.
If you use more than one script files, make sure that the order
of the files respects dependencies among objects (for example,
trigger creation scripts must come after table creation scripts;
and grant permission scripts must come after both table and
user creation scripts.
For more information, see the Reverse Engineering from
Scripts on page 517 section.
516
Chapter 10. Reverse Engineering a Database into a PDM
517
Reverse Engineering from Scripts
3. Click the Options tab to specify any reverse engineering options. For
more details, see Reverse engineering Options tab on page 524.
4. Click the Target Models tab to specify any external shortcuts. For more
details, see Reverse engineering Target Models tab on page 527.
518
Chapter 10. Reverse Engineering a Database into a PDM
Tool Description
Add Files Opens a dialog box to allow you to browse for scripts
files. You can add as many files as necessary.
Move Down - Moves the selected file(s) down one row. This tool is
grayed if the selected file(s) are at the bottom of the list.
519
Reverse Engineering from a Live Database
520
Chapter 10. Reverse Engineering a Database into a PDM
Data source
A data source might be predefined, or you can type the name of an
existing data source. In both cases, when you click OK, a database
connection dialog box opens, if you need to specify additional connec-
tion parameters. Click Connect and the Database Reverse Engineering
dialog box is displayed. (Go to step 9)
4. Select the appropriate source, type a user ID and a password, and then
click Connect to return to the Database Reverse Engineering Options
dialog box.
521
Reverse Engineering from a Live Database
7. Click the Target Models tab to specify any external shortcuts. For more
details, see Reverse engineering Target Models tab on page 527.
8. Click OK to open the ODBC Reverse Engineering dialog box. This box
allows you to specify a selection of objects to reverse engineer. Only
tables and triggers are selected by default.
522
Chapter 10. Reverse Engineering a Database into a PDM
523
Reverse Engineering Options
524
Chapter 10. Reverse Engineering a Database into a PDM
Block terminator Specifies the end of block character for the reversed
script. By default, displays the value defined in the
DBMS, under Script\SQL\Syntax. You can modify
this value, in which case it will be saved in the
Registry for reuse in other models. You can restore
the DBMS value using the Restore from DBMS tool.
If the code you want to reverse engineer is written with Unicode or MBCS
(Multibyte character set), you should use the encoding parameters provided
to you in the File Encoding box.
525
Reverse Engineering Options
If you want to change these parameters because you know which encoding is
used within the sources, you can select the appropriate encoding parameter
by clicking the Ellipsis button beside the File Encoding box. This opens the
Text Input Encoding Format dialog box in which you can select the
encoding format of your choice.
The Text Input Encoding Format dialog box includes the following options:
Option Description
526
Chapter 10. Reverse Engineering a Database into a PDM
Option Description
527
Reverse Engineering Options
Reverse engineering All the create statements in the script create objects, provided the script
from script contains a full definition of the object.
When the script only uses an object and does not define it, this object is
sought among the target objects in the target models and an external shortcut
is created in the reversed model.
Reverse engineering When you reverse engineer from a live database connection, external
from data source shortcuts are created for all selected objects already existing in another target
model. These existing objects are deselected by default in the Selection tab
of the Reverse Engineering dialog box, except the target objects
corresponding to shortcuts already existing in the reversed model.
528
Chapter 10. Reverse Engineering a Database into a PDM
The object types that you can reverse engineer are DBMS-dependent.
Unavailable object types do not appear for selection.
Filters You can restrict database objects to reverse engineer by selecting an owner
or a database qualifier in the top area of the window:
Filter Description
529
Reverse Engineering Options
Note that only users that have creation rights are reverse engineered.
530
Chapter 10. Reverse Engineering a Database into a PDM
You can define the database reverse parameters from the access.mdb
database window.
531
Reverse Engineering Database Statistics
2. On the General tab, select or clear the checkboxes to specify whether you
want to update statistics for tables and/or columns.
3. [optional] Click the Selection tab and select or clear checkboxes to
specify for which tables you want to update statistics:
532
Chapter 10. Reverse Engineering a Database into a PDM
533
CHAPTER 11
DBMS-Specific Features
About this chapter PowerDesigner can be used with a number of DBMS with specific features
often requiring special procedures for certain tasks. This chapter describes
these DBMS-specific features and associated tasks.
+ For more information on DBMS definition file contents, see the DBMS
Resource File Reference chapter in the Customizing and Extending
PowerDesigner manual.
Contents Topic: page
Interbase 551
MySQL 617
Oracle 620
PostgreSQL 643
Sybase AS IQ 659
Teradata 678
535
Working with PowerDesigners DBMS-Specific Features
536
Chapter 11. DBMS-Specific Features
Deprecated versions
The DBMSs for IBM DB2 v5.x are deprecated.
The following table lists DB2 objects and their equivalents in
PowerDesigner:
DB2 PowerDesigner
Bufferpool Storage
Trusted contexts
Using a trusted context in an application can improve security by placing
accountability at the middle-tier, reducing over granting of privileges, and
auditing of end-users activities.
Trusted contexts are supported for DB2 v9.x and higher for z/OS.
PowerDesigner models trusted contexts as extended objects with a
stereotype of <<TrustedContext>>.
Creating a trusted You can create a trusted context in any of the following ways:
context
Select Model Trusted Contexts to access the List of Trusted Contexts,
and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Trusted Context.
Trusted context You can modify an objects properties from its property sheet. To open a
properties
537
IBM DB2 for z/OS (formerly OS/390)
trusted context property sheet, double-click its Browser entry in the Trusted
Contexts folder.
The following extended attributes are available on the DB2 tab:
Name Description
As object Specifies that the role is treated as the owner of the objects
owner that are created using a trusted connection based on the
trusted context.
Scripting name: WithRoleAsObjectOwner
Default secu- Specifies the default security label for a trusted connection
rity label based on the trusted context.
Scripting name: DefaultSecurityLabel
Auxiliary tables
Auxiliary tables are used to store large object (LOB) data, such as graphics,
video, etc, or to store rarely-accessed data in order to improve the
performance of the base table.
Auxiliary tables are supported for IBM DB2 v9.x and higher for z/OS.
538
Chapter 11. DBMS-Specific Features
Name Description
Database Specifies the database in which the LOB data will be stored.
Scripting name: Database
Column Specifies the name of the LOB column in the auxiliary table.
Scripting name: Column
Partition Specifies the partition of the base table for which the auxiliary
table is to store the specified column.
Scripting name: Partition
Tablespace prefix
In IBM databases for OS/390, the physical options for a table can specify the
tablespace in which a table resides, as well as the database name.
You declare a tablespace in a database and assign a table to a tablespace on
the Physical Options (Common) tabs of their property sheets.
If the tablespace is not declared in any database, then the tablespace is not
prefixed by any database name.
539
IBM DB2 for z/OS (formerly OS/390)
When you preview your table creation code, you can verify that the
tablespace is prefixed by the name of the database.
Name Description
540
Chapter 11. DBMS-Specific Features
Name Description
Generated [v7.x and higher] Indicates that DB2 generates values for the
value column using the computed column function. If you select
Always, the server will send an error message if you try to type
a value in the column. If you select By Default, the server uses
the computed column value or the value typed for the column.
Scripting name: ExtGeneratedAs
Character [v7.x and higher] Specifies a subtype for a character string
subtype column.
Scripting name: ExtSubtypeData
Domain The following extended attributes are available on the DB2 tab:
Name Description
541
IBM DB2 for Common Server
Deprecated versions
The DBMSs for IBM DB2 v5.x are deprecated.
To see the comparison table between DB2 objects and their equivalents in
PowerDesigner, see IBM DB2 for z/OS (formerly OS/390) on page 537.
Property Description
Database Specifies the database partitions that are in the partition group.
partitions When empty, the group includes all database partitions defined
in the database at the time of its creation.
Scripting name: DBPartitionNumList
Index extensions
Index extensions are supported for DB2 v9.x and higher, and are used with
indexes on tables that have columns of a structured or distinct type.
The following options are available on the DB2 tab:
542
Chapter 11. DBMS-Specific Features
Property Description
Key gener- Specifies how the index key is generated using a user-defined
ation func- table function. Multiple index entries may be generated for a
tion single source key data value.
Scripting name: KeyGenerationFunction
Search Specifies the list of method details of the index search. Each
methods detail consists of a method name, the search arguments, a range
producing function, and an optional index filter function.
Scripting name: SearchMethods
Source key Specifies the parameter (and its data type) that is associated
parameters with the source key column.
Scripting name: SourceKeyParameters
Target key Specifies the target key parameters that are the output of the
parameters key generation function specified on the GENERATE KEY
USING clause.
Scripting name: TargetKeyParameters
543
IBM DB2 for Common Server
Name Description
544
Chapter 11. DBMS-Specific Features
Name Description
Ref using Defines the built-in data type used as the representation (un-
derlying data type) for the reference type of this structured
type and all its subtypes. This clause can only be specified for
the root type of a structured type hierarchy (UNDER clause
is not specified) (SQLSTATE 42613). The type cannot be a
LONG VARCHAR, LONG VARGRAPHIC, BLOB, CLOB,
DBCLOB, DATALINK, or structured type, and must have a
length less than or equal to 32 672 bytes (SQLSTATE 42613).
If this clause is not specified for the root type of a structured
type hierarchy, then REF USING VARCHAR(16) FOR BIT
DATA is assumed.
Scripting name: RepType
Abstract Data Type The following extended attributes are available on the DB2 tab (v9.x and
Attributes higher) with the LOB data type:
Name Description
Name Description
Inherit iso- Specifies whether or not a lock request can be associated with
lation level the isolation-clause of the statement when the method inherits
the isolation level of the statement that invokes the method. The
default is INHERIT ISOLATION LEVEL WITHOUT LOCK
REQUEST.
Scripting name: IsolationLevel
545
IBM DB2 for Common Server
Name Description
Columns The following extended attributes are available on the DB2 tab:
Name Description
Lob option [up to v8.x] Specifies options for LOB data type columns.
Scripting name: ExtLobOption
For bit data Specifies that the content of the column is to be treated as
bit (binary) data. This is only applicable on columns with a
character datatype.
Scripting name: ExtForBitData
Expression [v7.x and higher] Specifies that the definition of the column is
based on an expression.
Scripting name: ExtGenExpr
Always [v7.x and higher] When set to True (generated always), indi-
Generate cates that DB2 will always generate a value for the column
value when a row is inserted into the table or whenever the result
value of the generation expression may change.
When set to False (generated by default), indicates that DB2
will generate a value for the column when a row is inserted into
the table, unless a value is specified.
Scripting name: ExtGenAlways
Tables The following extended attributes are available on the DB2 tab:
546
Chapter 11. DBMS-Specific Features
Name Description
Name Description
Name Description
View is Specifies that the columns of the view are based on the attributes
based on a of the structured type identified by type-name.
type Scripting name: ADTView
Structured Specifies the abstract data type that the view is based on.
type Scripting name: ViewType
Super view Specifies the view that the current view is a subview of. The
superview must be an existing view and must be defined using
a structured type that is the immediate supertype of the current
view type.
Scripting name: SuperView
Identifier Defines the object identifier column for the typed view.
column Scripting name: OIDColumn
Unchecked Defines the object identifier column of the typed view definition
to assume uniqueness even though the system cannot prove this
uniqueness.
Scripting name: Unchecked
547
IBM DB2 for Common Server
Name Description
Check op- Specifies the constraint that every row that is inserted or
tion updated through the view must conform to the definition of the
view.
Scripting name: CheckOption
548
Chapter 11. DBMS-Specific Features
Informix SQL
This section describes features specific to the Informix SQL family of
databases.
Name Description
Serial Start Defines the initial value of the column with a SERIAL
datatype.
Scripting name: ExtSerialStart
549
Ingres
Ingres
This section describes features specific to the Ingres family of databases.
Name Description
NotDefault Indicates the column needs a value. This generates the not
default clause in the sql statement.
Scripting name: NotDefault
Users The following extended attributes are available on the Ingres tab:
Name Description
550
Chapter 11. DBMS-Specific Features
Interbase
This section describes features specific to the Interbase family of databases.
Name Description
Row sort Defines that the default value of the index (ascending
or descending) is defined on the index and not on the
column.
Scripting name: ExtAscDesc
Sequences The following extended attributes are available on the Interbase tab:
Name Description
First value Specifies the sequence first value for Interbase generator.
Scripting name: ExtStartWith
551
Microsoft Access
Microsoft Access
This section describes features specific to the MS Access family of
databases.
Deprecated versions
The DBMS for Microsoft Access 95 & 97 is deprecated.
Name Description
552
Chapter 11. DBMS-Specific Features
Horizontal partitioning
Horizontal positioning in MS SQL Server 2005 is a method for making large
tables and indexes more manageable by dividing them horizontally and
spreading them across more than one filegroup in a database.
PowerDesigner supports horizontal partitioning through the partition
function and partition scheme objects.
Partition functions
A partition function specifies how a table or index can be partitioned.
PowerDesigner models partition functions as extended objects with a
stereotype of <<PartitionFunction>>.
Creating a partition You can create a partition function in any of the following ways:
function
Select Model Partition Functions to access the List of Partition
Functions, and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Partition Function.
Partition function You can modify an objects properties from its property sheet. To open a
properties partition function property sheet, double-click its diagram symbol or its
Browser entry in the Partition Functions folder.
The following extended attributes are available on the Microsoft tab:
Name Description
Input Parameter Specifies the data type of the column used for parti-
Type tioning. All data types are valid, except text, ntext,
image, xml, timestamp, varchar(max), nvarchar(max),
varbinary(max), alias data types, or CLR user-defined
data types.
Scripting name: InputParameterType
553
Microsoft SQL Server
Name Description
Partition schemes
A partition scheme maps the partitions produced by a partition function to a
set of user-defined filegroups. PowerDesigner models partition schemes as
extended objects with a stereotype of <<PartitionScheme>>.
Creating a partition You can create a partition scheme in any of the following ways:
scheme
Select Model Partition Schemes to access the List of Partition
Schemes, and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Partition Scheme.
Partition scheme You can modify an objects properties from its property sheet. To open a
properties partition scheme property sheet, double-click its diagram symbol or its
Browser entry in the Partition Schemes folder.
The following extended attributes are available on the Microsoft tab:
554
Chapter 11. DBMS-Specific Features
Name Description
Partition Func- Specifies the partition function using the scheme. Parti-
tion tions created by the partition function are mapped to the
filegroups specified in the partition scheme.
Scripting name: PartitionFunction
All Partitions Specifies that all partitions map to the filegroup specified
by the File Groups property.
Scripting name: AllPartitions
File Groups Specifies the names of the filegroups to hold the parti-
tions specified by the partition function. If [PRIMARY]
is specified, the partition is stored on the primary file-
group. If ALL is specified, only one filegroup name can
be specified.
Scripting name: Filegroups
CLR assemblies
An assembly is a DLL file used to deploy functions, stored procedures,
triggers, user-defined aggregates, and user-defined types that are written in
one of the managed code languages hosted by the Microsoft .NET
Framework common language runtime (CLR), instead of in Transact-SQL.
PowerDesigner models assemblies as extended objects with a stereotype of
<<Assembly>>.
Creating an assembly You can create an assembly in any of the following ways:
Select Model Assemblies to access the List of Assemblies, and click
the Add a Row tool.
Right-click the model or package in the Browser, and select New
555
Microsoft SQL Server
Assembly.
Assembly properties You can modify an objects properties from its property sheet. To open an
assembly property sheet, double-click its diagram symbol or its Browser
entry in the Assemblies folder.
The following extended attributes are available on the Microsoft tab:
Name Description
File name Specifies the local path or network location where the
assembly that is being uploaded is located, and also the
manifest file name that corresponds to the assembly. Can
be entered as a fixed string or an expression evaluating
to a fixed string.
Scripting name: FileName
556
Chapter 11. DBMS-Specific Features
Name Description
Class name Specifies the name of the class in the assembly that
implements the aggregate function.
If the class name is not specified, SQL Server assumes
it is the same as the aggregate name.
Scripting name: Class
557
Microsoft SQL Server
Name Description
Type Specifies the type of the input parameter. All scalar data
types or CLR user-defined types can be used, except
text, ntext, and image.
Scripting name: InputParameterType
Return type Specifies the return type of the aggregate function. All
scalar data types or CLR user-defined types can be used
as return type, except text, ntext, and image.
Scripting name: ReturnType
558
Chapter 11. DBMS-Specific Features
3. Click the Select Object tool to the right of the Class field, in order to
specify a supertype.
4. Click the Microsoft tab and select an assembly from the list to bind to the
type.
5. Click OK to close the property sheet.
User-defined type You can modify an objects properties from its property sheet. To open a
properties user-defined type property sheet, double-click its diagram symbol or its
Browser entry in the Abstract Data Types folder.
In addition to the standard abstract data type properties, a user-defined type
has the following additional properties available on the Microsoft tab:
Name Description
In Microsoft SQL Server 2005, you can write user-defined functions in any
Microsoft .NET Framework programming language, such as Microsoft
Visual Basic .NET or Microsoft Visual C#. PowerDesigner models CLR
procedures and functions as standard procedures that use a CLR template,
and are linked to a method from an associated OOM.
Creating a CLR To create a CLR procedure or function, you must have already created an
procedure or function assembly (see CLR assemblies on page 555) and you must have an OOM
open in the workspace, in order to specify an associated class method.
559
Microsoft SQL Server
Name Description
CLR triggers
The Microsoft SQL Server integration with the .NET Framework common
language runtime (CLR), allows you to use any .NET Framework language
to create CLR triggers. PowerDesigner CLR triggers as standard triggers that
use a CLR template, and are linked to a method from an associated OOM.
Creating a CLR trigger To create a CLR trigger, you must have already created an assembly (see
CLR assemblies on page 555) and you must have an OOM open in the
workspace, in order to specify an associated class method.
4. Click the Microsoft tab and select an assembly from the list to bind to the
trigger.
5. Click OK to close the property sheet.
CLR trigger properties You can modify an objects properties from its property sheet. To open a
CLR trigger property sheet, double-click its Browser entry.
The following extended attributes are available on the SQL Server tab:
560
Chapter 11. DBMS-Specific Features
Name Description
Encryption
SQL Server 2005 uses a new security infrastructure that supports
hierarchical encryption and key management.
PowerDesigner supports encryption with certificates and asymmetric and
symmetric keys.
Certificates
A public key certificate, usually just called a certificate, is a digitally-signed
statement that binds the value of a public key to the identity of the person,
device, or service that holds the corresponding private key. Certificates are
issued and signed by a certification authority (CA). The entity that receives a
certificate from a CA is the subject of that certificate. PowerDesigner models
certificates as extended objects with a stereotype of <<Certificate>>.
Creating a certificate You can create a certificate in any of the following ways:
Select Model Certificates to access the List of Certificates, and click
the Add a Row tool.
Right-click the model or package in the Browser, and select New
Certificate.
Certificate properties You can modify an objects properties from its property sheet. To open a
certificate property sheet, double-click its diagram symbol or its Browser
entry in the Certificates folder.
The following extended attributes are available on the Microsoft tab:
Name Description
561
Microsoft SQL Server
Name Description
Encryption pass- Specifies the password that will be used to encrypt the
word (private key) private key.
Scripting name: PrivateKeyEncryptionPassword
Decryption pass- Specifies the password required to decrypt a private key
word that is retrieved from a file.
Scripting name: PrivateKeyDecryptionPassword
Encryption pass- Use this option only if you want to encrypt the certificate
word with a password.
Scripting name: EncryptionPassword
562
Chapter 11. DBMS-Specific Features
Name Description
Active for begin Specifies that the certificate is available to the initiator
dialog of a Service Broker dialog conversation.
Scripting name: ActiveForBeginDialog
Asymmetric keys
Name Description
Assembly file Specifies the path of a file from which to load the key.
Scripting name: AssemblyFile
563
Microsoft SQL Server
Name Description
Encryption Specifies the password with which to encrypt the private key.
password If this clause is not present, the private key will be encrypted
with the database master key.
Scripting name: EncryptionPassword
Symmetric keys
A symmetric key is one key that is used for both encryption and decryption.
Encryption and decryption by using a symmetric key is fast, and suitable for
routine use with sensitive data in the database. PowerDesigner models
symmetric keys as extended objects with a stereotype of
<<SymmetricKey>>.
Creating a symmetric key You can create a symmetric key in any of the following ways:
Select Model Symmetric Keys to access the List of Symmetric Keys,
and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Symmetric Key.
Symmetric key You can modify an objects properties from its property sheet. To open a
properties symmetric key property sheet, double-click its diagram symbol or its
Browser entry in the Symmetric Keys folder.
The following extended attributes are available on the Microsoft tab:
Name Description
564
Chapter 11. DBMS-Specific Features
Name Description
Key source Specifies a pass phrase from which to derive the key.
Scripting name: KeySource
Full-text catalogs
565
Microsoft SQL Server
Full-text catalog You can modify an objects properties from its property sheet. To open a
properties full-text catalog property sheet, double-click its diagram symbol or its
Browser entry in the Full Text Catalogs folder.
The following extended attributes are available on the Microsoft tab:
Name Description
Authorization Specifies the name of a user or role as the owner of the full
text catalog.
Scripting name: Authorization
File group Specifies the name of the SQL Server filegroup (or storage)
of which the new catalog will be part.
Scripting name: FileGroup
Accent sensi- Specifies whether the catalog is accent sensitive for full text
tivity indexing.
Scripting name: AccentSensitivity
Full-text indexes
A full-text index stores information about significant words and their
location within a given column. This information is used to quickly compute
full-text queries that search for rows with particular words or combinations
of words. PowerDesigner models full-text indexes as table indexes with an
index type set to Full Text.
Creating a full-text index
566
Chapter 11. DBMS-Specific Features
4. Click the Microsoft tab and select a catalog from the list and then specify
the type of change tracking required.
Name Description
Catalog Specifies the full text catalog where the full text index is
defined.
Scripting name: FullTextCatalog
XML indexing
SQL Server 2005 provides improvements in indexing XML data.
PowerDesigner supports these new features through the XML index object.
XML indexes
PowerDesigner models XML indexes as table indexes with an index type set
to XML.
Creating an XML index
567
Microsoft SQL Server
Name Description
Fill factor Specifies a percentage that indicates how full the Database
Engine should make the leaf level of each index page
during index creation or rebuild.
Scripting name: FillFactor
568
Chapter 11. DBMS-Specific Features
Name Description
569
Microsoft SQL Server
Name Description
3. Click the Microsoft tab and specify an XLM schema collection and
content type.
4. Click OK to confirm your changes and close the property sheet.
XML table column You can modify an objects properties from its property sheet. To open an
properties XML table column property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
570
Chapter 11. DBMS-Specific Features
Name Description
Database mirroring
SQL Server 2005 supports database mirroring, in which the principal server
sends, in real-time, blocks of its database log records to the mirror instance
which, in the event of failover, can be made available within a few seconds.
PowerDesigner supports database mirroring with the following model
objects:
Databases (Mirroring tab)
Endpoints
Databases
For information about creating a database object, see Creating a database
section in the Getting Started with Data Modeling chapter.
The following extended attributes are available on the Mirroring tab:
Name Description
Partner/ Witness Specifies the role that the database will play in the
mirroring relationship. You can choose between:
Partner the database is either a principal or mirror
database.
Witness the database acts as a witness to a mirroring
relationship. A SET WITNESS clause affects both
copies of the database, but can only be specified on
the principal server. If a witness is set for a session,
a quorum is required to serve the database, regardless
of the SAFETY setting.
Scripting names: Partner, Witness
571
Microsoft SQL Server
Name Description
End points
572
Chapter 11. DBMS-Specific Features
Point.
End point properties You can modify an objects properties from its property sheet. To open an
end point property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
Protocol: Argu- Allows you to enter arguments for the chosen protocol.
ment Scripting name: ProtocolArgument
Language: Name Specifies the type of content to be sent. You can choose
between:
soap
tsql
service_broker
database_mirroring
Scripting name: Language
Language: Argu- Allows you to enter arguments for the chosen language.
ment Scripting name: LanguageArgument
Service Broker
The service broker manages a queue of services. Applications that use
Service Broker communicate by sending messages to one another as part of
a conversation. The participants in a conversation must agree on the name
573
Microsoft SQL Server
Message types
Message types define the type of data that a message can contain. You create
identical message types in each database that participates in a conversation.
Message types specify the type of XML validation that SQL Server performs
for messages of that type. For arbitrary or binary data, the message type can
specify that SQL Server performs no validation. PowerDesigner models
message types as extended objects with a stereotype of
<<MessageType>>.
Creating a message type You can create a message type in any of the following ways:
Select Model Message Types to access the List of Message Types, and
click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Message Type.
Message type properties You can modify an objects properties from its property sheet. To open a
message type property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
574
Chapter 11. DBMS-Specific Features
Name Description
Contracts
Contracts define the message types used in a Service Broker conversation
and also determine which side of the conversation can send messages of that
type. Each conversation follows a contract. The initiating service specifies
the contract for the conversation when the conversation begins. The target
service specifies the contracts that the target service accepts conversations
for. PowerDesigner models contracts as extended objects with a stereotype
of <<Contract>>.
You create an identical contract in each database that participates in a
conversation.
Creating a contract You can create a contract in any of the following ways:
Select Model Contracts to access the List of Contracts, and click the
Add a Row tool.
575
Microsoft SQL Server
Contract properties You can modify an objects properties from its property sheet. To open a
contract property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
Message contracts
Message contracts are intermediary objects that are used to include a single
message in multiple contracts. Message contracts are modeled as extended
objects with a stereotype of <<MessageContract>>.
Creating a message You can create a message contract in any of the following ways:
contract
Use the tools on the MessageTypes tab of a contract property sheet (see
Contracts on page 575).
Select Model Message Contracts to access the List of Message
Contracts, and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Message Contract.
Message contract You can modify an objects properties from its property sheet. To open a
properties message contract property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
576
Chapter 11. DBMS-Specific Features
Name Description
Queues
When a message arrives for a service, Service Broker places the message on
the queue associated with the service. PowerDesigner models queues as
extended objects with a stereotype of <<Queue>>.
Creating a queue You can create a queue in any of the following ways:
Select Model Queues to access the List of Queues, and click the Add a
Row tool.
Right-click the model or package in the Browser, and select New
Queue.
Queue properties You can modify an objects properties from its property sheet. To open a
queue property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
577
Microsoft SQL Server
Name Description
578
Chapter 11. DBMS-Specific Features
Event Notifications
An event notification sends information about a database or server event to a
service broker service. Event notifications are created only by using
Transact-SQL statements. PowerDesigner models event notifications as
extended objects with a stereotype of <<EventNotification>>.
Creating an event You can create an event notification in any of the following ways:
notification
Select Model Event Notifications to access the List of Event
Notifications, and click the Add a Row tool.
Right-click the model or package in the Browser, and select New Event
Notification.
Event notification You can modify an objects properties from its property sheet. To open an
properties event notification property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
579
Microsoft SQL Server
Name Description
With fan in Instructs SQL Server to send only one message per event
to any specified service for all event notifications that:
are created on the same event.
are created by the same principal (as identified by
SID).
specify the same service and broker_instance_-
specifier.
specify WITH FAN_IN.
Scripting name: WithFanIn
Events Specifies the name of the event type that causes the event
notification to execute. Can be a Transact-SQL DDL,
SQL Trace, or Service Broker event type.
Scripting name: Events
Service Specifies the target service that receives the event in-
stance data. SQL Server opens one or more conversa-
tions to the target service for the event notification. This
service must honor the same SQL Server Events message
type and contract that is used to send the message. See
Services on page 580.
Scripting name: Service
Instance Specifies a service broker instance against which
broker_service is resolved. Use current database
to specify the service broker instance in the current
database.
Scripting name: Instance
Services
Services are specific tasks or set of tasks. Service Broker uses the name of
the service to route messages, deliver messages to the correct queue within a
database, and enforce the contract for a conversation. PowerDesigner
models services as extended objects with a stereotype of <<Service>>.
Creating a service You can create a service in any of the following ways:
Select Model Services to access the List of Services, and click the Add
a Row tool.
580
Chapter 11. DBMS-Specific Features
Service properties You can modify an objects properties from its property sheet. To open a
service property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
Queue Specifies the queue that receives messages for the ser-
vice. The queue must exist in the same database as the
service.
Scripting name: Queue
The Contracts tab lists the contracts with which the service is associated.
Routes
Routes appear in the routing table for the database. For outgoing messages,
Service Broker determines routing by checking the routing table in the local
database. For messages on conversations that originate in another instance,
including messages to be forwarded, Service Broker checks the routes in
msdb. PowerDesigner models routes as extended objects with a stereotype
of <<Route>>.
Creating a route You can create a route in any of the following ways:
Select Model Routes to access the List of Routes, and click the Add a
Row tool.
Right-click the model or package in the Browser, and select New
Route.
Route properties You can modify an objects properties from its property sheet. To open a
route property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
Remote service Specifies the name of the remote service to which the
route points.
Scripting name: Service
581
Microsoft SQL Server
Name Description
Broker instance Specifies the database that hosts the target service.
Scripting name: BrokerInstance
Remote service binding You can modify an objects properties from its property sheet. To open a
properties remote service binding property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
582
Chapter 11. DBMS-Specific Features
Name Description
Remote service Specifies the remote service to bind to the user identified
in the WITH USER clause.
Scripting name: RemoteService
User Specifies the database principal that owns the certificate
associated with the remote service identified by the TO
SERVICE clause.
Scripting name: User
Anonymous Specifies that anonymous authentication is used when
communicating with the remote service.
Scripting name: Anonymous
Resource Governor
Resource Governor, available in SQL Server 2008, lets you limit resource
requests by workloads for CPU time and memory to optimize their
allocation. PowerDesigner supports Resource Governor through the
following objects:
Workload groups are containers for sets of similar session requests.
Resource pools represent the physical resources of the server.
Workload groups
A workload group serves as a container for session requests that are similar,
to allow the aggregate monitoring of resource consumption and the
application of a uniform policy to all the requests in the group. A group
defines the policies for its members. PowerDesigner models workload group
sas extended objects with a stereotype of <<WorkloadGroup>>.
Creating a workload You can create a workload group binding in any of the following ways:
group
Select Model Workload groups to access the List of Workload Groups,
and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Workload Group.
Workload group You can modify an objects properties from its property sheet. To open a
properties workload group property sheet, double-click its Browser entry.
583
Microsoft SQL Server
Name Description
Resource pool Associates the workload group with the specified re-
source pool.
Scripting name: ResourcePool
Resource pools
584
Chapter 11. DBMS-Specific Features
Resource pool properties You can modify an objects properties from its property sheet. To open a
resource pool property sheet, double-click its Browser entry.
The following extended attributes are available on the Microsoft tab:
Name Description
CPU percent Min Specifies the guaranteed average CPU bandwidth for
all requests in the resource pool when there is CPU
contention. The value is an integer, with a default setting
of 0.
Scripting name: MinCpuPercent
CPU percent Max Specifies the maximum average CPU bandwidth that all
requests in resource pool will receive when there is CPU
contention. The value is an integer, with a default setting
of 100.
Scripting name: MaxCpuPercent
Memory percent Specifies the total server memory that can be used by
Max requests in this resource pool. The value is an integer,
with a default setting of 100.
Scripting name: MaxMemoryPercent
Synonyms
PowerDesigner supports SQL Server 2005 synonyms through the standard
synonym object.
Synonyms can be created for the following types of objects:
Assembly (CLR) Stored Procedure
Assembly (CLR) Table-valued Function
Assembly (CLR) Scalar Function
Assembly Aggregate (CLR) Aggregate Functions
Replication-filter-procedure
Extended Stored Procedure
585
Microsoft SQL Server
Table
For more information about synonyms, see the Building Physical
Diagrams chapter.
586
Chapter 11. DBMS-Specific Features
587
Microsoft SQL Server
The following table lists the mappings between the objects contained within
the DSO and PowerDesigner PDM metamodels:
clsDatabase Model
(Each model corresponds to a DSO Database.)
ClsDatabaseDimen- Dimension
sion (As in the DSO model, PowerDesigner dimensions
are shared among cubes.)
clsCube Cube
(Cubes managed by PowerDesigner are only local
cubes.)
588
Chapter 11. DBMS-Specific Features
clsCube Fact
(A Fact corresponds to a DSO cube in order to store
measures.)
clsCubeMeasure Measure
Generating cubes
v To generate cubes
1. Select Tools Microsoft Analysis Services Generate Cubes to open
the connection dialog box.
2. Enter a name for the server and database, and then click OK to open the
Cube Selection dialog box, which lists all the available cubes. The state
column indicates if the cube has already been generated. Cubes already
generated are deselected by default.
589
Microsoft SQL Server
3. Select the cubes you want to generate, and then click OK.
The selected cubes are generated. If a cube already exists in the database,
it is dropped before being recreated. If a dimension already exists, the
selected cube reuses it. To be fully generated, a cube must have a
complete mapping to a table before being generated.
The Microsoft Analysis Services add-in lets you reverse engineer cubes.
2. Enter a name for the server and database, and then click OK to open the
Source Model Selection dialog box, which lists the models linked to the
selected data source.
590
Chapter 11. DBMS-Specific Features
3. Select the appropriate source models and then click OK to open the Cube
Selection dialog box, which lists all the available cubes. The state column
indicates if the cube already exists in the current model. Cubes already
existing are deselected by default.
4. Select the cubes you want to reverse engineer, and then click OK.
591
Microsoft SQL Server
Generating cubes
The Microsoft SQL Server 2005 Analysis Services add-in enables the
generation of cubes.
Before generating cubes, you must define a data source with an OLE DB
connection that will specify from where the cubes will be populated.
592
Chapter 11. DBMS-Specific Features
2. Select the OLE DB tab and specify the kind of data provider.
3. Click the ellipsis tool to the right of the connection string field to open
the provider-specific configuration dialog.
593
Microsoft SQL Server
When you have created the appropriate data sources, you can proceed with
generating your cubes.
594
Chapter 11. DBMS-Specific Features
v To generate cubes
595
Microsoft SQL Server
596
Chapter 11. DBMS-Specific Features
The Microsoft SQL Server 2005 Analysis Services add-in enables the
reverse engineering of cubes.
Before reverse-engineering cubes, you should create one or more PDMs to
model the tables which provide its data. As part of the reverse-engineering
process, PowerDesigner will create links from the reversed cubes to these
tables.
597
Microsoft SQL Server
598
Chapter 11. DBMS-Specific Features
3. The Select Cubes page lists the available cubes. Select the cubes you
want to reverse engineer and then click Next to continue:
599
Microsoft SQL Server
4. The Configure Data Sources page lists the data sources that are required
to populate the selected cubes. For each source, select the Physical Data
Model in which the tables are modeled, and then click Next to continue:
600
Chapter 11. DBMS-Specific Features
Name Description
Default con- Contains the name of the constraint that is used to apply
straint name a default value to the column. If empty, the constraint
keyword is not generated.
Scripting name: ExtDeftConstName
Identity value Indicates that the IDENTITY property should not be en-
not replicated forced when a replication login inserts data into the table.
Scripting name: ExtIdtNotForReplication
601
Microsoft SQL Server
Name Description
Not null con- Contains the name of the constraint that is used to apply a
straint name mandatory property of the column. If empty, the constraint
keyword is not generated.
Scripting name: ExtNullConstName
Row global [v2000 and higher] Indicates that the new column is a row
unique iden- global unique identifier column. Only one unique identifier
tifier column per table can be designated as the ROWGUIDCOL
column.
Scripting name: ExtRowGuidCol
Collation [v2005 and higher] A single string that specifies the collation
name name for a SQL collation.
Scripting name: ExtCollation
XML schema [v2000 and higher] Applies only to the XML data type for
collection associating an XML schema collection with the type.
Scripting name: XMLSchemaCollection
Content type [v2005 and higher] - CONTENT:
Specifies that each instance of the XML data type in
column_name can contain multiple top-level elements.
CONTENT applies only to the XML data type and can be
specified only if xml_schema_collection is also specified. If
not specified, CONTENT is the default behavior.
- DOCUMENT:
Specifies that each instance of the XML data type in
column_name can contain only one top-level element. DOC-
UMENT applies only to the XML data type and can be
specified only if xml_schema_collection is also specified.
Scripting name: ContentType
Cubes The following extended attributes are available on the Microsoft tab:
602
Chapter 11. DBMS-Specific Features
Name Description
Storage [v2005 and higher] Specifies the storage mode for the cube.
mode Scripting name: StorageMode
Dimensions The following extended attributes are available on the Microsoft tab:
Name Description
603
Microsoft SQL Server
Name Description
604
Chapter 11. DBMS-Specific Features
Name Description
Storage [v2005 and higher] Determines the storage mode for the parent
mode element.
Scripting name: StorageMode
At- [v2005 and higher] Contains the caption, in the default language,
for the All member of the dimension.
tributeAllMem-
berName Scripting name: AttributeAllMemberName
605
Microsoft SQL Server
Name Description
Dimension Attributes The following extended attributes are available on the Microsoft tab:
Name Description
Hide val- [v2000] Options to hide level members. You can choose between:
ues BLANK_NAME: Hides a level member with an empty name.
PARENT_NAME: Hides a level member when the member
name is identical to the name of its parent.
ONLY_CHILD_AND_BLANK_NAME: Hides a level mem-
ber when it is the only child of its parent and its name is null
or an empty string.
ONLY_CHILD_AND_PARENT_NAME: Hides a level
member when it is the only child of its parent and is identical
to the name of its parent.
Scripting name: HideValues
Hidden [v2000] Indicates whether the level is hidden from client appli-
cations.
Scripting name: IsHidden
606
Chapter 11. DBMS-Specific Features
Name Description
607
Microsoft SQL Server
Name Description
Type [v2000 and higher] Identifies the specific type of level. You can
choose between:
ALL: Indicates the top (All) level of a dimension (the one that
precalculates all the members of all lower levels).
YEAR: a level that refers to years (Time dimension only).
QUARTER: a level that refers to (calendar) quarters (Time
dimension only).
MONTH: a level that refers to months (Time dimension only).
WEEK: a level that refers to weeks (Time dimension only).
DAY: a level that refers to days (Time dimension only).
DAYOFWEEK: a level that refers to days of the week (Time
dimension only).
DATE: a level that refers to dates (Time dimension only).
HOUR: a level that refers to hours (Time dimension only).
MINUTE: a level that refers to minutes (Time dimension
only).
SECOND: Indicates that a level refers to seconds (Time di-
mension only).
Scripting name: Type
OrderBy [v2005 and higher] Describes how to order the members con-
tained in the attribute.
Scripting name: OrderBy
608
Chapter 11. DBMS-Specific Features
Name Description
Databases The following extended attributes are available on the Microsoft tab:
Name Description
Primary Specifies that the associated file specification list defines the
primary file.
Scripting name: Primary
File Gets or sets the file specification.
Scripting name: FileListFileSpec
Collation [v2000 and higher] Specifies the default collation for the
name database. Collation name can be either a Windows collation
name or a SQL collation name.
Scripting name: Collate
609
Microsoft SQL Server
Name Description
Attach re- [v2005 and higher] Specifies that the database is created by
build log attaching an existing set of operating system files.
Scripting name: ForAttachRebuildLog
Snapshot of [v2005 and higher] Specifies the name of the new database
snapshot.
Scripting name: AsSnapshotOf
610
Chapter 11. DBMS-Specific Features
Name Description
Load [up to v2000] Indicates that the database is created with the
dbo use only database option turned on, and the status is set
to loading.
Scripting name: ForLoad
For information about the extended attributes available on the Mirroring tab,
see Database mirroring on page 571.
Data Sources The following extended attributes are available on the OLE DB tab:
Name Description
Name Description
Initial cata- [only for SQL Server and OLE DB] Specifies the Initial
log catalog.
Scripting name: InitialCatalog
611
Microsoft SQL Server
Name Description
Logical [only for SQL Server] Specifies the logical name of the
name selected database file.
Scripting name: LogicalName
Location [only for OLE DB] Specifies the location for OLEDB.
Scripting name: Location
Persist secu- [only for OLE DB] Specifies that security information be
rity info persistent.
Scripting name: PersistSecurityInfo
Use Win- [only for OLE DB] Specifies whether to use windows NT
dows NT Integrated Security or not.
Integrated Scripting name: UseNTIntegratedSecurity
Security
Dimension Hierarchies The following extended attributes are available on the Microsoft tab:
Name Description
AllMember- [v2005 and higher] Contains the caption in the default lan-
Name guage for the All member of a Hierarchy element.
Scripting name: AllMemberName
Member- [v2005 and higher] Determines whether member names under
Name- the parent element must be unique.
sUnique Scripting name: MemberNamesUnique
612
Chapter 11. DBMS-Specific Features
Fact Measures The following extended attributes are available on the Microsoft tab:
Name Description
BindingType [v2005 and higher] Defines the binding type for the mea-
sure.
Scripting name: BindingType
Indexes The following extended attributes are available on the Microsoft tab:
613
Microsoft SQL Server
Name Description
Fill factor Specifies a percentage that indicates how full the Database
Engine should make the leaf level of each index page
during index creation or rebuild.
Scripting name: FillFactor
Max degree of [v2005 and higher] Overrides the max degree of parallelism
parallelism configuration option for the duration of the index operation.
Use MAXDOP to limit the number of processors used in a
parallel plan execution. The maximum is 64 processors.
Scripting name: MaxDop
Allow row [v2005 and higher] Specifies whether row locks are al-
locks lowed.
Scripting name: AllowRowLocks
614
Chapter 11. DBMS-Specific Features
Name Description
Allow page [v2005 and higher] Specifies whether page locks are
locks allowed.
Scripting name: AllowPageLocks
Ignore dup key Specifies the error response to duplicate key values in a
multiple row insert operation on a unique clustered or
unique nonclustered index.
Scripting name: IgnoreDupKey
If the index is not a cluster index, then the Include tab is displayed, allowing
you to specify the columns with which it is associated.
Keys The following extended attributes are available on the Microsoft tab:
Name Description
Fill Factor Specifies how full SQL Server should make each index
page used to store the index data.
Scripting name: FillFactor
References The following extended attributes are available on the Microsoft tab:
Name Description
Name Description
615
Microsoft SQL Server
Name Description
Text/Image on Specifies the name of the filegroup where text and image
are stored.
Scripting name: TextImageOn
Users The following extended attributes are available on the Microsoft tab with the
stereotype <<schema>> (v2005 and higher):
Name Description
Name Description
616
Chapter 11. DBMS-Specific Features
MySQL
This section describes features specific to the MySQL family of databases.
Deprecated versions
The DBMSs for MySQL v3.22 and 3.23 are deprecated.
Note that when developing for MySQL and using double quotes as a
delimiter, it is necessary to set the sql_mode to ANSI_QUOTES:
SET sql_mode=ANSI_QUOTES
Name Description
Unsigned Indicates negative values are not allowed for the column.
Scripting name: Unsigned
Indexes The following extended attributes are available on the MySQL tab:
617
MySQL
Name Description
Full text in- Indicates that the index is a full text index.
dex Scripting name: FullText
Keys The following extended attributes are available on the MySQL tab:
Name Description
Unique key When set to True, indicates that the key is unique. False
implies that the key allows duplicate values.
Scripting name: ExtUnique
Models The following extended attributes are available on the MySQL tab:
Name Description
Name Description
618
Chapter 11. DBMS-Specific Features
NonStop SQL
This section describes features specific to the NonStop SQL family of
databases.
Name Description
619
Oracle
Oracle
This section describes features specific to the Oracle family of databases:
Deprecated versions
The DBMSs for Oracle v8 and v8i (8.1.5) are deprecated.
620
Chapter 11. DBMS-Specific Features
You can automatically generate a bitmap join index for each fact table and
the dimension tables that it references. Each generated bitmap join index
consists of the references that link a fact table to all the dimension tables
located on a single axis proceeding from the fact table.
A reference between two fact tables does not generate any bitmap join index.
A bitmap join index is constrained and can only be defined for tables that are
organized in a connected tree.
3. Click Yes to generate a bitmap join index for each fact table.
You can manually create bitmap join indexes from the list of join indexes or
via the base table property sheet.
621
Oracle
7. Click OK to complete the creation of the bitmap join index and return to
the model.
You can create a join index or a bitmap join index from the Join Index tab of
a table property sheet. The bitmap join index will be based on the table.
2. Click the Insert a Row or the Add a Row tool to create a new bitmap join
index associated with the table.
3. Click the Properties tool to display the new bitmap join index property
sheet. The Base table box is initialized with the selected table.
622
Chapter 11. DBMS-Specific Features
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Comment Additional information about the bitmap join index.
Owner Name of the user who created the bitmap join index.
Base table Name of the table that stores the bitmap join index.
The following tabs are also available:
Columns tab - The bitmap join index stores information about the
columns used for the index. These columns are displayed in the Columns
tab of the bitmap join index property sheet.
Options tab - You can define physical options for bitmap join indexes
generation. These options override the default physical options defined in
the model. You can choose to generate these options by selecting the
Physical Options check box in the Join Index groupbox in the Keys and
Indexes tab of the Generation dialog box.
You can define the list of columns involved in the bitmap join index. These
columns proceed from the different dimension tables linked to the base table.
When you create a bitmap join index manually, you have to select columns
using the list of columns in the bitmap index property sheet.
When you create a bitmap join index using the rebuild join index feature, the
list of columns is initialized with all columns of the tables involved in the
join except foreign keys.
623
Oracle
You can add a reference to any bitmap join index. You do this, for example,
when you create a new reference that you want to include in an existing
bitmap join index.
Database packages
In Oracle, packages encapsulate related procedures, functions, and
associated cursors and variables together as a unit in the database. Packages
usually have two parts, a specification and a body. The specification is the
interface with your applications; it declares the types, variables, constants,
exceptions, cursors, and subprograms available for use. The body fully
defines cursors and subprograms, and so implements the specification.
Packages provide advantages in the following areas:
Encapsulation of related procedures and variables in a single named,
stored unit in the database. This provides for better organization during
the development process and makes privilege management easier.
Separation of public and private procedures, variables, constants, and
cursors.
Better performance since entire package is loaded into memory when an
object from the package is called for the first time.
624
Chapter 11. DBMS-Specific Features
2. Click the Add a Row tool to add a database package to the list, and then
click the Properties tool to display its property sheet.
3. Type a name and a code for the database package.
4. [optional] Select an Owner and/or Privilege for the database package.
5. Click OK to complete the creation of the database package.
A database package has the following properties:
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
625
Oracle
Cursors tab - Lists the cursors associated with the database package (see
Database package cursors on page 629).
3. Select a procedure in the list and click the Properties button to open its
property sheet.
4. Specify any appropriate properties.
5. Click OK to close the property sheet and return to your model.
626
Chapter 11. DBMS-Specific Features
Property Description
Name The name of the item which should be clear and meaning-
ful, and should convey the items purpose to non-technical
users.
Code The technical name of the item used for generating code
or scripts, which may be abbreviated, and should not
generally include spaces.
Return data Allows you to define the return data type of a function.
type
627
Oracle
use operators and functions to insert script items into the cursor
definition.
Property Description
Name The name of the item which should be clear and meaning-
ful, and should convey the items purpose to non-technical
users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Data Type Data type of the variable. You can use the Question Mark
button to display the list of Standard Data Types.
Mandatory If selected, indicates that the not null clause is set on the
variable, thus making it mandatory.
Length Allows you to define the variable length.
Precision Number of places after the decimal point, for data values
that can take a decimal point.
628
Chapter 11. DBMS-Specific Features
Property Description
A cursor is a multi-row query, which lets you name a work area and access
its stored information.
Cursors have the following properties:
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Return Data Allows you to define the data type of a cursor result value.
Type
629
Oracle
employee number:
Select empno, empname, job FROM emp WHERE deptno=20 and empno =
num ;
Properties Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Comment Additional information about the exceptions.
Pragma Allows you to type a compiler directive, that is, a string for
specifying compilation parameters for the exception.
630
Chapter 11. DBMS-Specific Features
structure along with the functions and procedures needed to manipulate the
data. You can also define subtypes of object types: a subtype contains all the
attributes and methods of the parent type, it can contain additional attributes
and can override methods from the type.
Types have the following properties:
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
631
Oracle
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Comment Additional information about the parameter.
You can rebuild database package procedure dependencies (along with other
procedure dependencies) by selecting Tools Rebuild Objects Rebuild
Procedures Dependencies. For more information, see Rebuilding procedure
dependencies in the Building Triggers and Procedures chapter.
You can define generation parameters for database packages in the Database
Package tab of the Triggers and Procedures Generation dialog box.
The following parameters are available:
632
Chapter 11. DBMS-Specific Features
+ For more information on the create and drop statements for database
packages, see the DBMS Resource File Reference chapter in the
Customizing and Extending PowerDesigner manual.
You can select database packages to reverse engineer from the Database
Package tab of the Database Reverse Engineering dialog box.
When you reverse engineer a database package, the sub-objects (variable,
procedure, cursor, exception, and type) are created from the specification
and the body of the database package.
633
Oracle
Oracle dimensions
In Oracle, the columns of the dimension table are called levels of the
dimension hierarchy. These levels can have dependent columns. For
example, in the dimension Time, the level Quarter has a dependent column
called Number of business days.
The following mapping is established between dimensions in Oracle and
PowerDesigner:
Dimension Dimension
In order to access the master key used to encrypt the table keys, you must
634
Chapter 11. DBMS-Specific Features
You can create one or more encrypted column in one or more tables. You
can specify the encryption algorithm to be used, but all columns in a
particular table must use the same algorithm. If you create a second
encrypted column in a table, and specify a different algorithm, the last
specified algorithm will be used for all columns in the table.
Clusters
A cluster is a schema object that contains data from one or more tables,
which have one or more columns in common. Oracle Database stores
together all the rows from all the tables that share the same cluster key.
635
Oracle
Cluster properties You can modify an objects properties from its property sheet. To open a
cluster property sheet, double-click its Browser in the Clusters folder.
The following extended attributes are available on the General tab:
Name Description
Database Links
A database link is a schema object in one database that enables you to access
objects on another database.
Database links are supported for Oracle 11g and higher. PowerDesigner
models database links as extended objects with a stereotype of <<Database
Link>>.
Creating a database link You can create a database link in any of the following ways:
Select Model Database links to access the List of Database links, and
click the Add a Row tool.
636
Chapter 11. DBMS-Specific Features
Database link properties You can modify an objects properties from its property sheet. To open a
database link property sheet, double-click its Browser in the Database links
folder.
The following extended attributes are available on the Oracle tab:
Name Description
Connect to Specifies the user name and password used to connect to the
remote database using a fixed user database link.You need to
specify CURRENT_USER to create a current user database
link. The current user must be a global user with a valid
account on the remote database. If you do not specify a value,
then the database link uses the user name and password of
each user who is connected to the database.
Scripting names: Username, Password
637
Oracle
Name Description
Type Specifies the method for paritioning the table. You can choose
between:
Range/Composite - Partitions the table on ranges of values
from the column list.
Hash - Partitions the table using the hash method.
List - Partitions the table on lists of literal values from col-
umn.
Reference - Equipartitions the table being created (the
child table) by a referential constraint to an existing par-
titioned table (the parent table).
System - Partitions the table by the partitions specified.
When you select a type, additional options are displayed, to
allow you to specify the appropriate parameters.
Name Description
638
Chapter 11. DBMS-Specific Features
Name Description
Name of not [v8i and higher] Defines the name of the not null constraint
null con- for a column.
straint Scripting name: ExtNotNullConstraintName
Deferred op- [v8i and higher] Defines the deferred option of a column not
tion of not null constraint. It is used in create and add statement
null con- items definition.
straint An empty value means Not deferrable.
Scripting name: ExtNotNullDeferOption
Encrypted [v10gR2 and higher] Specifies if column is encrypted.
Scripting name: Encrypted
Algorithm [v10gR2 and higher] Specifies the algorithm used for en-
cryption.
Scripting name: Algorithm
Database Packages The following extended attributes are available on the Oracle tab:
Name Description
Add serially_- [v9i and higher] When set to True, defines that the
reusable pragma pragma serially_reusable clause must be applied on
on package specifi- the database package specification.
cation Scripting name: IsSpecPragma
Add serially_- [v9i and higher] When set to True, defines that the
reusable pragma pragma serially_reusable clause must be applied on
on package body the database package body declaration.
Scripting name: IsPragma
References The following extended attributes are available on the Oracle tab:
639
Oracle
Name Description
Validate Checks that all old data also obeys the constraint.
Scripting name: Validate
Tables The following extended attributes are available on the Oracle tab:
Name Description
Name Description
Object prop- Specifies that the properties of object tables are essentially
erties the same as those of relational tables.
However, instead of specifying columns, you specify at-
tributes of the object.
Scripting name: XmlTypeObjProperty
640
Chapter 11. DBMS-Specific Features
Name Description
Basic file Use this clause to specify the traditional LOB storage.
Scripting name: BasicFile
LOB segment Specify the name of the LOB data segment. You cannot use
name LOB_segname if you specify more than one LOB_item.
Scripting name: LOBSegname
LOB parame- Use this clause to specify various elements of LOB parame-
ters ters.
Scripting name: LOBParameters
Tablespaces The following extended attributes are available on the Oracle tab:
Name Description
Undo ta- Use this option to create an undo tablespace. When you run
blespace the database in automatic undo management mode, Oracle
Database manages undo space using the undo tablespace
instead of rollback segments. This clause is useful if you are
now running in automatic undo management mode but your
database was not created in automatic undo management
mode.
Scripting name: Undo
641
Oracle
Views The following extended attributes are available on the Oracle tab:
Name Description
Super view [v9i and higher] Used in the UNDER clause to specify the
object superview the current object view is based on.
Scripting name: ExtObjSuperView
Object view [v8i and higher] Specifies the attributes of the object type
key that will be used as a key to identify each row in the object
view.
Scripting name: ExtObjOIDList
Object view [v8i and higher] Defines the type of the object view.
type Scripting name: ExtObjViewType
Force When set to TRUE, allows you to create the view regardless
of the existence of the base tables or the owner privileges on
these tables.
Scripting name: ExtViewForce
642
Chapter 11. DBMS-Specific Features
PostgreSQL
This section describes features specific to the PostgreSQL family of
databases.
Name Description
Template The name of the template from which to create the new
database, or DEFAULT to use the default template.
Scripting name: Template
643
PostgreSQL
Name Description
Length Literal value which specifies the internal length of the new
type.
Scripting name: ExtTypeLength
By Value Indicates that operators and functions which use this data
type should be passed an argument by value rather than by
reference.
Scripting name: ExtTypePassedByValue
Domain (Composite The following extended attributes are available on the PostgreSQL tab:
Type)
644
Chapter 11. DBMS-Specific Features
Name Description
Name Description
Group iden- The SYSID clause can be used to choose the PostgreSQL
tifier (id) group ID of the new group. This is normally not necessary,
but may be useful if you need to recreate a group referenced
in the permissions of some object.
Scripting name: SysId
Procedures The following extended attributes are available on the PostgreSQL tab:
Name Description
645
PostgreSQL
Name Description
Name Description
Name Description
Location Specifies the directory that will be used for the tablespace.
The directory must be specified by an absolute path name.
Scripting name: TbspLocation
Owner Specifies the name of the user who will own the tablespace.
If omitted, defaults to the user executing the command.
Only superusers may create tablespaces, but they can assign
ownership of tablespaces to non-superusers.
Scripting name: TbspOwner
Users The following extended attributes are available on the PostgreSQL tab (v8
and higher):
646
Chapter 11. DBMS-Specific Features
Name Description
User identi- The SYSID clause can be used to choose the PostgreSQL user
fier (id) ID of the new user. This is normally not necessary, but may
be useful if you need to recreate the owner of an orphaned
object.
Scripting name: SysId
Validity This clause sets an absolute time after which the users
password is no longer valid. If this clause is omitted the
password will be valid for all time.
Scripting name: Validity
647
Red Brick Warehouse
Name Description
Unique Declares that duplicate values are not allowed in the column.
Declaring a column UNIQUE does not enforce uniqueness
on the column; to enforce uniqueness, you must also build a
BTREE index on the column.
Scripting name: IsUnique
Procedures The following extended attributes are available on the Red Brick tab:
Name Description
648
Chapter 11. DBMS-Specific Features
Sybase AS Anywhere
This section describes features specific to the Sybase AS Anywhere family
of databases
Deprecated versions
The DBMSs for Sybase AS Anywhere v7 and v8 are deprecated.
Note that from version 10, AS Anywhere is known as Sybase SQL
Anywhere (see Sybase SQL Anywhere on page 674).
Auto-increment columns
Auto-increment columns are equivalent to identity columns in those DBMS
that support identity columns.
If you switch from Sybase ASA to a DBMS that supports identity columns,
the Identity checkbox will be selected for each auto-increment column. On
the other hand, if you switch to Sybase ASA, identity columns will be
assigned the autoincrement default value.
When you reverse engineer a script containing identity columns (using
Sybase ASE-compatible syntax), these are automatically converted into
auto-increment columns in Sybase ASA.
649
Sybase AS Anywhere
BasePackage:
Generation template - for generating proxy tables.
DataSource:
Connection information custom check - verifies that the connection
information is sufficient to connect to the database. You must specify
the data source name, user login and password in the Database
Connection tab of the data source property sheet.
GenerateAsProxyServer extended attribute - when set to true, defines
the data source model as the proxy remote server.
[various templates] - used for proxy table generation.
Model:
Proxy Servers and Tables generated files - to generate proxy server and
table script files.
650
Chapter 11. DBMS-Specific Features
Shortcut:
Data source existence custom check - verifies that data sources are
defined for the shortcuts.
Table:
Proxy table is child of reference custom check - verifies that the model
replica is not the child of another table via a reference link.
[various templates] - required for proxy table, remote server and access
definition creation syntax.
You use external shortcuts and/or replica to design proxy tables in your
model.
An external shortcut is a non-modifiable reference to an object in another
model. For more information on shortcuts, see Shortcutsin the Shortcuts
and Object Replications chapter of the Core Features Guide .
A replica is an exact copy of an object that can be updated when the original
object is modified. For more information on replications, see
Replicationsin the Shortcuts and Object Replications chapter of the Core
Features Guide .
One interesting aspect of using replica, is that you can modify the replica
code in order to make it different from the target table. A custom check
verifies that replica are not used as child tables of a reference.
651
Sybase AS Anywhere
The remote server is the model containing the target tables of the external
shortcut or replica. The remote server is defined using a data source in the
proxy tables model; this data source provides access to the remote data on
the server.
Note: the same data source can contain information for several models that
share the same remote servers.
When you attach the ProxyTables extended model definition to the model
containing proxy tables, a specific contextual menu is displayed on the
physical data model item, this menu command is used for building the data
source of the proxy tables.
Note: This command does not build data sources for target models that are
closed in the workspace.
2. Add the target models in the Models tab of the data source property sheet.
You can also right-click the model that contains replica and/or shortcuts
in the Browser and select the Build Proxy Tables Data Sources command.
A data source is automatically created for each target model.
3. Double-click a data source in the Browser to display its property sheet.
4. Click the Database Connection tab, and define the data source name,
login and password.
5. Click OK.
6. Repeat steps 2 to 5 for each data source.
You can generate the remote server and proxy tables creation scripts in order
to run them in the database. Generation must be started from the model
containing proxy tables.
The ProxyTables extended model definition contains the creation script
syntax for ASA or ASE.
652
Chapter 11. DBMS-Specific Features
Name Description
Name Description
Name prefix Specifies the web service name prefix (dish services only).
(dish services Scripting name: Prefix
only)
653
Sybase AS Anywhere
Web Operations The following extended attributes are available on the Sybase tab (v9 and
higher) when the service type is not dish:
Name Description
URL Determines whether URI paths are accepted and, if so, how
they are processed.
Scripting name: Url
654
Chapter 11. DBMS-Specific Features
Sybase AS Enterprise
This section describes features specific to the Sybase AS Enterprise family
of databases.
Deprecated versions
The DBMSs for Sybase AS Enterprise v11.0 and v11.5-11.9 are deprecated.
Proxy tables
For information about using proxy tables, see Working with proxy tables in
Sybase ASA and ASE on page 649.
Encryption Keys
Encryption keys are supported for ASE v12.5.3a and higher. PowerDesigner
models encryption keys as extended objects with a stereotype of
<<EncryptionKey>>.
Adaptive Server authentication and access control mechanisms ensure that
only properly identified and authorized users can access data. You can
encrypt data at the column level, thus restricting your security measures to
only sensitive data, and minimizing processing overhead.
Encrypting columns in Adaptive Server is more straightforward than using
encryption in the middle tier, or in the client application. You use SQL
statements to create the encryption keys and specify columns for encryption.
Adaptive Server handles key generation and storage. Encryption and
decryption of data occurs automatically and transparently as you write and
read the data in encrypted columns. No application changes are required,
and there is no need to purchase third-party software.
Creating an encryption You can create an encryption key in any of the following ways:
key
Select Model Encryption Keys to access the List of Encryption Keys,
and click the Add a Row tool.
Right-click the model or package in the Browser, and select New
Encryption Key.
Encryption key You can modify an objects properties from its property sheet. To open an
properties encryption key property sheet, double-click its Browser entry in the
Encryption Keys folder.
The following extended attributes are available on the Sybase tab:
655
Sybase AS Enterprise
Name Description
Key length [v12.5.3a and higher] Specifies the size in bits of the key to
be created. Valid key lengths for AES are 128, 192 and 256
bits.
Scripting name: KeyLength
656
Chapter 11. DBMS-Specific Features
Name Description
Default en- [v12.5.3a and higher] Allows the System Security Officer to
cryption key create a default key for use on all encrypted columns which
do not have a keyname specified in create table or alter table.
This is a database specific default key for use with tables in
the same database. The default key is stored in the database
sysencryptkeys table, the same as non-default keys.
Scripting name: Default
Name Description
Keys The following extended attributes are available on the Sybase tab:
Name Description
657
Sybase AS Enterprise
Name Description
Name Description
Database Specifies the database name used in the URL to access the
name web service.
Scripting name: DatabaseName
Web Operations The following extended attributes are available on the Sybase tab (v15.0 and
higher):
Name Description
658
Chapter 11. DBMS-Specific Features
Sybase AS IQ
This section describes features specific to the Sybase AS IQ family of
databases.
Deprecated versions
The DBMSs for Sybase AS IQ v12.0 and v12.4.3 are deprecated.
Sybase Adaptive Server IQ (AS IQ) is a high-performance decision support
server designed specifically for data warehousing.
Sybase AS IQ provides benefits that allow an interactive approach to
decision support including:
Intelligent query processing using index-only access plans to process
only the data needed to satisfy any type of query
Truly interactive, ad hoc query performance on a uniprocessor as well as
on parallel systems. An ad hoc query is a query about which the system
has no prior knowledge and for which no explicit tuning is required. Ad
hoc queries are distinguished from standard or production reports, where
only pre-defined variables, such as dates, are used to generate pre-defined
reports on a regular basis.
IQ indexes
Before creating IQ indexes, you should consider the implications of various
types of indexes on the database server memory and disk space.
659
Sybase AS IQ
The set of indexes you define for any given column can have dramatic
impact on the speed of query processing. There are four main criteria for
choosing indexes:
Number of unique values
Types of queries
Disk space usage
Data types
It is best to consider all criteria in combination, rather than individually. To
decide on indexes, look closely at the data in each column.
Try to anticipate the number of unique and total values, the query results
users will want from it, and whether the data will be used in ad hoc joins or
join indexes.
+ For more information about choosing index types, see chapter Adaptive
Server IQ Indexes in the Adaptive Server IQ Administration and
Performance Guide.
Rebuilding IQ indexes
As you develop a PDM or modify an existing one, you may change data
types, alter the percentage of distinct values or change the number of values
in tables. You must then rebuild the IQ indexes to reflect these changes.
660
Chapter 11. DBMS-Specific Features
v To rebuild IQ indexes
1. Select Tools Rebuild Objects Rebuild Indexes to open the Rebuild
Indexes dialog box:
2. Select a default name to generates IQ indexes. You can use the following
variables:
%COLUMN% - Column name
%INDEXTYPE% - Type of index to be rebuilt
%TABLE% - Name or code of table (based on display preferences)
661
Sybase AS IQ
6. Click OK, and then Yes to confirm the rebuilding of your indexes.
Index types
When you rebuild indexes, PowerDesigner determines the index type based
on information contained from the table statistics. It uses the number field,
which indicates the estimated number of records per table, and the
percentage of distinct values to compute the number of unique values. If the
user has not specified a number of rows for the table, PD assumes that the
table will include at least 1 row of data.
Usually the rebuild process creates a FASTPROJECTION index for all
columns. Otherwise, the following rules are applied:
662
Chapter 11. DBMS-Specific Features
IQ join indexes
A join index is a special type of index used in Sybase AS IQ, which
represents a full outer join of two or more tables. The query engine may use
this full outer join as a starting point for queries that include left outer, right
outer, and inner joins. A full outer join is one where all rows from both the
left and right specified tables are included in the result, with NULL returned
for any column with no matching value in the corresponding column.
Join indexes are defined from references. You can create a join index for any
set of columns that your users commonly join to resolve queries.
While some references are based on keys, Sybase AS IQ allows you to
create user-defined references to include the exact join required by your
foreseen queries.
663
Sybase AS IQ
Facts and Dimensions A fact corresponds to the focus of a decision support investigation. For
example, Sales, Revenue, and Budget are facts. A table containing facts is
set as a fact table in the table property sheet.
A dimension defines the axis of the investigation of a fact. For example,
Product, Region, and Time are the axes of investigation of the Sales fact. A
table containing dimensions is linked to a fact table and is set as a dimension
table in the table property sheet.
+ For more information about setting table properties, see the Building
Physical Diagrams chapter.
You can create a join index or a bitmap join index from the Join Index tab of
the table property sheet. The join index is automatically based on the current
table.
If you need to create more join indexes than those automatically created by
the rebuild process, you can use the list of join indexes.
664
Chapter 11. DBMS-Specific Features
5. Click OK in each of the dialog boxes to complete the creation of the join
index.
665
Sybase AS IQ
Property Description
Name The name of the item which should be clear and meaningful,
and should convey the items purpose to non-technical users.
Code The technical name of the item used for generating code or
scripts, which may be abbreviated, and should not generally
include spaces.
Stereo- Sub-classification used to extend the semantics of an object
type without changing its structure; it can be predefined or user-
defined.
You can automatically generate a join index for each selected fact table and
the dimension tables that it references. The rebuild process only applies to
fact tables selected in the Selection tab of the Join Index Rebuild tab.
Each automatically generated join index consists of the references that link a
fact table to all the dimension tables located on a single axis proceeding
from the fact table.
666
Chapter 11. DBMS-Specific Features
A reference between two fact tables does not generate any join index.
A join index is constrained and can only be defined for tables that are
organized in a connected tree.
Delete and When selected all existing indexes are deleted before join
Rebuild index rebuild.
3. Click OK, and then Yes to confirm rebuilding of the join indexes.
A join index is automatically generated for each fact table.
667
Sybase AS IQ
You can add a reference to any join index. You do this, for example, when
you create a new reference that you want to include in an existing join index.
668
Chapter 11. DBMS-Specific Features
[optional] Specify mappings between the tables in your data source and
your AS IQ database
4. Click the Add Models tool, and select your source model.
5. Click the Database Connection tab, and complete the fields to enable a
connection to your source database.
6. Complete the fields on the Data Movement tab and click OK.
669
Sybase AS IQ
Data Source properties The following fields are available on the Data Source properties sheet Data
Data Movement tab Movement tab:
Property Description
Remote Specifies the name of the remote server used in the interface
Server Name file for IQ server.
Data Source Specifies the label given to the data source in the sql.ini file.
Name
Dump file Specifies the directory where the dump file (external flat
directory file), that contains the data to be imported, will be created.
Property Description
Field Delim- Specifies the delimiter to be used between fields in the dump
iter file.
Row Delim- Specifies the delimiter to be used between rows in the dump
iter file.
Load file Specifies the directory where the load file is located.
directory
670
Chapter 11. DBMS-Specific Features
Table properties Data If the Data Movement Method generation option is set to Insert Location, a
Movement tab Data Movement tab is available on each Table properties sheet, containing
the following fields:
Property Description
Dump file Specifies the name of the dump file (external flat file) that
name contains the data to be imported.
Field Delim- Specifies the delimiter to be used between fields in the dump
iter file.
Row Delim- Specifies the delimiter to be used between rows in the dump
iter file.
Maximum Specifies the maximum length of an image (or text) record, to
Image or which it will be truncated if necessary.
Text Size
671
Sybase AS IQ
Sybase AS IQ events
PowerDesigner supports Sybase AS IQ events for v12.7 and higher. For
details, see SQL Anywhere events on page 674.
Name Description
Name Description
672
Chapter 11. DBMS-Specific Features
Name Description
Name prefix [DISH service type] Specifies a name prefix. Only SOAP
services whose names begin with this prefix are handled.
Scripting name: Prefix
Web Operations The following extended attributes are available on the Sybase tab (v12.6 and
higher) when the service type is not dish:
Name Description
URL Determines whether URI paths are accepted and, if so, how
they are processed.
Scripting name: Url
673
Sybase SQL Anywhere
Name Description
Event is Specifies that the server carries out a set of actions according to
scheduled a schedule of times.
If selected, this option disables the Event is triggered option.
Scripting name: ScheduledEvent
Schedule Enter the schedule of event trigger times here. Click the New
definition button to launch a dedicated editor window.
Scripting name: SchedulesText
Event is Specifies that the server carries out a set of actions when a
triggered predefined type of system event occurs.
This option is the default and, if selected, disables the Event
is scheduled option.
Scripting name: TypedEvent
674
Chapter 11. DBMS-Specific Features
Name Description
Event type The event-type is one of the listed set of system-defined event
types. The event types are case insensitive. To specify the
conditions under which this event-type triggers the event, use
the WHERE clause.
Scripting name: EventType
675
Sybase SQL Anywhere
Name Description
Name Description
Name Description
Virtual index The VIRTUAL keyword is primarily for use by the Index
Consultant. A virtual index mimics the properties of a
real physical index during the evaluation of query plans
by the Index Consultant and when the PLAN function is
used. You can use virtual indexes together with the PLAN
function to explore the performance impact of an index,
without the often time consuming and resource consuming
effects of creating a real index.
Scripting name: Virtual
Web Services The following extended attributes are available on the Sybase tab:
676
Chapter 11. DBMS-Specific Features
Name Description
Name prefix [DISH service type] Specifies a name prefix. Only SOAP
services whose names begin with this prefix are handled.
Scripting name: Prefix
Web Operations The following extended attributes are available on the Sybase tab when the
service type is not dish:
Name Description
URL Determines whether URI paths are accepted and, if so, how
they are processed.
Scripting name: Url
677
Teradata
Teradata
This section describes features specific to the Teradata family of databases.
Transform groups
A transform is a mechanism for creating an external representation of the
UDT that is used when exporting and importing data between the client and
the Teradata server. This mechanism allows most Teradata client utilities and
open APIs to transparently move data to and from a UDT without the need
for special logic or metadata.
Transforms usually appear as a named pair of functions or methods (usually
referred to as To-SQL and From-SQL to indicate the direction of data flow
to and from the database) called a transform group. A transform group is
required if the type is to be used in a table.
Transform groups are supported for Teradata v2r6 and higher.
PowerDesigner models transform groups as extended objects with a
stereotype of <<TransformGroup>>.
Creating a transform You can create a transform group in any of the following ways:
group
Select Model Transform Groups to access the List of Transform
Groups, and click the Add a Row tool.
Transform group You can modify an objects properties from its property sheet. To open a
properties transform group property sheet, double-click its Browser entry in the
Transform Groups folder.
The following extended attributes are available on the Teradata tab (vV2R6
and higher):
678
Chapter 11. DBMS-Specific Features
Name Description
To sql with Specifies the function name and parameters to be used as the
tosql routine for this transform group, and whether or not it is
specific.
Scripting names: ToName, ToParms, ToSpecific
2. Click the Teradata tab and select the Primary Index checkbox.
3. Click OK to close the index property sheet.
When a primary index is based on a key, it is automatically unique. You
can make this primary index non-unique by detaching the index from the
key. To do so, select <None> in the Columns Definition list in the
Columns tab of the index property sheet, and set the PrimaryIndex
extended attribute of the index to True.
Once defined, you can decide to generate indexes or keys in the SQL
script, and you can also decide to generate them inside or outside the
table creation script.
679
Teradata
Name Description
Name Description
Return data Specifies the name of the data type returned by the method,
type which can be either a predefined data type or a UDT.
Scripting name: ReturnDataType
Self as result Specifies that the method is type-preserving. If so, then the
data type specified in the RETURNS clause for the method
must have the same name as UDT_name.
Scripting name: SelfAsResult
Character set Specifies the CHARACTER SET clause for character data
type.
Scripting name: ReturnCharSet
Cast data Specifies a computed attribute that show the datatype and its
type length and precision.
Scripting name: CastDataTypeDisplay
680
Chapter 11. DBMS-Specific Features
Name Description
Parameter Specifies the parameter style for the method defined by this
style signature.
Scripting name: ParameterStyle
Returns null Specifies that the method defined by this signature is not
on null input called if any of the arguments passed to it is null. Instead, it
returns a null.
Scripting name: ReturnsNullOnNullInput
Columns The following extended attributes are available on the Teradata tab (vV2R6
and higher):
Name Description
System gen- Specifies that identity column values are always system-
erated only generated. You cannot insert values into, nor update, an
identity column defined as GENERATED ALWAYS.
If not selected, identity column values are system-generated
unless the user does not enter a non-null value.
Scripting name: ExtGenAlways
681
Teradata
Name Description
Databases The following extended attributes are available on the Teradata tab (vV2R6
and higher):
Name Description
Default journal Specifies the default table that is to receive the journal
table images of data tables created in the new database.
Scripting name: DefaultJournalTable
682
Chapter 11. DBMS-Specific Features
Name Description
Spool space Specifies the number of bytes (n) to be allocated for spool
files. The default is the largest value that is not greater then
the owner spool space, and that is a multiple of the number
of AMPs on the system.
Scripting name: SpoolSpace
Indexes The following extended attributes are available on the Teradata tab:
Name Description
Index has Specifies that the index will be generated with its name (as
name Teradata allows index with no name).
Scripting name: NamedIndex
Tables The following extended attributes are available on the Teradata tab (vV2R6
and higher):
Name Description
683
Teradata
Name Description
Users The following extended attributes are available on the Teradata tab :
Name Description
Owner Specifies the database (or user) that owns the current user.
Scripting name: DBOwner
684
Chapter 11. DBMS-Specific Features
Name Description
Default table Specifies the default table that is to receive the journal
images of data tables created in the new database.
Scripting name: DefaultJournalTable
Time zone Specifies the default time zone displacement for the user.
Scripting name: TimeZone
Date format Specifies the default format for importing and exporting
DATE values for the user.
Scripting name: DateForm
685
Teradata
Views The following extended attributes are available on the Teradata tab (vV2R6
and higher):
Name Description
686
CHAPTER 12
About this appendix This appendix provides a short introduction to writing SQL scripts in
PowerDesigner and lists the variables and macros available for use in such
scripts.
Contents Topic: page
Introduction 688
687
Introduction
Introduction
PowerDesigner allows you to associate your own custom SQL statements
with many database objects.
You can write triggers and procedures, and also add begin and end scripts to
many database objects.
+ For more information, see:
The Building Triggers and Procedures chapter
688
Chapter 12. Writing SQL Statements in PowerDesigner
689
Writing SQL with the PowerDesigner GTL
690
Chapter 12. Writing SQL Statements in PowerDesigner
691
Writing SQL with the PDM Variables and Macros
+ For lists of the available variables and macros, see PDM Macros on
page 693, PDM Variables on page 704, and PowerDesigner Formatting
Variables on page 716.
692
Chapter 12. Writing SQL Statements in PowerDesigner
PDM Macros
You can use predefined macros in trigger templates, template items, triggers,
and procedures. Macros perform specific functions.
AKCOLN
Description Repeats a statement for each alternate key in a table
Syntax
.AKCOLN("statement","prefix","suffix","last_suffix", "condition")
Argument Description
condition Alternate key code (if condition argument is left empty the
macro returns a statement for each alternate key in the table)
Example In a trigger for the table TITLEAUTHOR, the following macro:
message .AKCOLN("%COLUMN% is an alternate key column","", "",
"", "AKEY1")
ALLCOL
Description Repeats a statement for each column in a table
Syntax
.ALLCOL("statement","prefix","suffix","last_suffix")
693
PDM Macros
Argument Description
DEFINE
Description Defines a variable and initializes its value.
Syntax
.DEFINE "variable" "value"
Argument Description
694
Chapter 12. Writing SQL Statements in PowerDesigner
DEFINEIF
Description Defines a variable and initializes its value if the test value is not null
Syntax
.DEFINEIF "test_value" "variable" "value"
Argument Description
ERROR
Description Handles errors
Syntax
Argument Description
FKCOLN
Description Repeats a statement for each foreign key column in a table
Syntax
.FKCOLN("statement","prefix","suffix","last_suffix")
695
PDM Macros
Argument Description
FOREACH_CHILD
Description Repeats a statement for each parent-to-child reference in the current table
fulfilling a condition
Syntax
.FOREACH_CHILD ("condition")
"statement"
.ENDFOR
Argument Description
Condition Selects
696
Chapter 12. Writing SQL Statements in PowerDesigner
Condition Selects
FOREACH_COLUMN
Description Repeats a statement for each column in the current table fulfilling a condition
Syntax
.FOREACH_COLUMN ("condition")
"statement"
.ENDFOR
Argument Description
697
PDM Macros
Condition Selects
FOREACH_PARENT
Description Repeats a statement for each child-to-parent reference in the current table
fulfilling a condition
Syntax
.FOREACH_PARENT ("condition")
"statement"
.ENDFOR
Argument Description
698
Chapter 12. Writing SQL Statements in PowerDesigner
INCOLN
Description Repeats a statement for each primary key column, foreign key column,
alternate key column, or non-modifiable column in a table.
Syntax
.INCOLN("statement","prefix","suffix","last_suffix")
Argument Description
JOIN
Description Repeats a statement for column couple in a join.
699
PDM Macros
Syntax
.JOIN("statement","prefix","suffix","last_suffix")
Argument Description
NMFCOL
Description Repeats a statement for each non-modifiable column in a table.
Non-modifiable columns have Cannot Modify selected as a check parameter.
Syntax
.NMFCOL("statement","prefix","suffix","last_suffix")
Argument Description
700
Chapter 12. Writing SQL Statements in PowerDesigner
PKCOLN
Description Repeats a statement for each primary key column in a table
Syntax
.PKCOLN("statement","prefix","suffix","last_suffix")
Argument Description
701
PDM Macros
SQLXML
Description Avoids typing a SQL/XML query in the definition of a trigger, a procedure
or a function. Use one of the following tools:
The Insert SQL/XML Macro tool opens a selection dialog box where
you choose a global element from an XML model open in the workspace,
mapped to a PDM, and linked with the SQL/XML extended model
definition. Click OK in the dialog box and the SQLXML macro is
displayed in the definition code, with the code of the XML model
(optional) and the code of the global element
The Macros tool, where you select .SQLXML( ) in the list. The
SQLXML macro is displayed empty in the definition code. You must fill
the parentheses with the code of an XML model (optional), followed by ::
and the code of a global element. The XML model, from which you
choose a global element, must be open in the workspace, mapped to a
PDM, and linked with the SQL/XML extended model definition
702
Chapter 12. Writing SQL Statements in PowerDesigner
703
PDM Variables
PDM Variables
Many objects have both a code variable and a generated code variable.
The code variable is the attribute code that is defined in the object property
sheet.
The generated code variable is computed from the attribute code according
to available generation options. The values for the code and generated code
variables can be different in the following situations:
When the Code is a reserved word or it contains invalid characters, the
generated code is quoted
When the code is longer than authorized by the database, the generated
code is truncated
Note:
To access variables of sub-objects (columns in a table for example) you have
to use loop macros or GTL macros to browse the list of sub-objects. For
example, in a trigger the following macro loops on table columns and for
each column with the CannotModify attribute outputs the code of the
column followed by cannot be modified:
.foreach_item(Table.Columns)
.if(%CannotModify%)
-- "%Code%" cannot be modified
.endif
.next
704
Chapter 12. Writing SQL Statements in PowerDesigner
Variables for domain and The following variables can be used in domain check parameter and column
column checks check parameter definitions:
705
PDM Variables
706
Chapter 12. Writing SQL Statements in PowerDesigner
Abstract data type The following variables can be used in an abstract data type definition:
variables
Variable name Comment
Abstract data type The following variable can be used in an abstract data type attribute
attribute variables definition:
707
PDM Variables
Index column variables The following variables can be used in index column definitions:
708
Chapter 12. Writing SQL Statements in PowerDesigner
FKEY- List of child foreign key columns. For example: C1, C2,
COLUMNS C3
709
PDM Variables
Reference column The following variables can be used in reference column definitions:
variables
Variable name Comment
710
Chapter 12. Writing SQL Statements in PowerDesigner
ISPKEY TRUE when a key is the primary key for the table
711
PDM Variables
Database, trigger, and The following variables can be used for database, procedure, and trigger
procedure generation generation:
variables
Variable name Comment
NAMESCRIPT Name of the file script where SQL orders will be written
Reverse engineering The following variables can be used when reverse engineering a database
variables into a PDM:
712
Chapter 12. Writing SQL Statements in PowerDesigner
Database The following variables can be used for database generation when
synchronization variables synchronizing a modified PDM with an existing database:
713
PDM Variables
714
Chapter 12. Writing SQL Statements in PowerDesigner
715
PowerDesigner Formatting Variables
.L Lower-case characters
For example:
%.L:TABLE%
The table below shows formatted variables and their results in a script for the
table EMPLOYEE.
716
CHAPTER 13
About this appendix This appendix explains how to migrate from ERwin to PowerDesigner. You
will learn about the differences between the two design environments and
how to import your models into PowerDesigner.
Contents Topic: page
717
Introducing the ERwin Import Process
File types
PowerDesigner supports the import of the following ERwin file types:
ERwin v3.x (.erx)
ERwin v4.x (.xml)
ERwin v7.x (.xml) the ERwin model must be saved as Standard XML
Format, and you must uncheck the Only save minimum amount of
information check box in the ERwin Save as XML File dialog box.
Versions 4.x or 7.x are recommended, as they contain more metadata.
ERwin and PowerDesigner implement database design in different ways.
An ERwin logical model can be imported into either:
a PowerDesigner conceptual data model (CDM), or
a PowerDesigner logical data model
An ERwin Physical Model is imported into a PowerDesigner physical
data model (PDM)
In the PowerDesigner Physical Data Model you can use two design levels:
the logical model allows you to design the database structure and perform
some database denormalization actions without taking into account any
DBMS physical requirement. The physical model allows you to design the
database taking into account the physical requirements of a given DBMS
718
Chapter 13. Migrating from ERwin to PowerDesigner
Limitations
You cannot import the following ERwin objects:
ERwin triggers and stored procedures (not directly possible, but see the
process in Post-import checklist on page 725)
ERwin reports
ER1 files
ERwin data sources
719
Preparing to Import your ERwin models
Review your ERwin model to see if any model object names are
duplicated. It is good practice to avoid using duplicate names, and
PowerDesigner will automatically attach a suffix to any duplicate objects
that it encounters during the import process.
720
Chapter 13. Migrating from ERwin to PowerDesigner
The options available depend on the type of ERwin model that you are
importing. The traditional approach to data modeling in PowerDesigner
is to create a Conceptual Data Model synchronized with a Physical Data
Model. The full set of options is as follows:
A Conceptual Data Model can be created when you are importing an
ERwin Logical Model. It provides a platform-independent
representation of a system, giving an abstract view of its static data
structures, and permitting real normalized data structures with
many-to-many and inheritance relationships.
A Logical Data Model can be created when you are importing an
ERwin Logical Model. It allows you to resolve many-to-many and
super/sub-type relationships, de-normalize your data structures, and
define indexes, without specifying a particular RDBMS. In
PowerDesigner, a Logical Data Model is an RDBMS-independent
version of a Physical Data Model.
721
The Import Process
5. If your ERwin model contains a physical model, then you can choose
whether to implement referential integrity using triggers.
6. Click OK to begin the import. When the process is complete, the
imported models will appear in the Browser.
722
Chapter 13. Migrating from ERwin to PowerDesigner
After Importing
This section describes what you should expect in your newly-imported
models.
ERwin PowerDesigner
Model Model
Stored display and subject Diagram
area
Business rule Business rule
Domain Domain
Description Description
Notes Annotation
723
After Importing
The import process converts ERwin logical model objects into conceptual
data model (CDM) objects as follows:
Entity Entity
Relationship Relationship
The import process translates ERwin physical model objects into physical
data model (PDM) objects as follows:
Column Column
Key Key
Table Table
Relationship Reference
Index Index
Tablespace Tablespace
Segment Storage
724
Chapter 13. Migrating from ERwin to PowerDesigner
Post-import checklist
This section lists a series of recommended post-import checks and processes.
Import triggers: Triggers cannot be directly imported from ERwin. There
are, however, two methods for transferring your constraint trigger
information to PowerDesigner:
Automatically generate triggers: To do this, select Tools Rebuild
Objects Rebuild Triggers. Creating triggers in this way ensures that
they will be synchronized automatically by PowerDesigner, but the actual
code may be different from that which you are used to in ERwin.
725
After Importing
You can control other object creation defaults by clicking on the object entry
in the Model Settings category:
726
Chapter 13. Migrating from ERwin to PowerDesigner
Differences to Expect
This section lists certain differences that you may encounter when working
with your imported ERwin model in PowerDesigner.
Why do I see errors in Check Model when my ERwin model was clean?
PowerDesigner performs stricter checks than ERwin. For example, duplicate
objects are not permitted in PowerDesigner, and the existence of orphaned
items will generate a warning.
Why do some of my object symbols appear with numeric suffixes? If an
object is required to appear more than once in a diagram (for, example, to
improve readability), PowerDesigner will create a graphical synonym to
represent it. Thus, if the table Purchase is displayed twice in a diagram,
the two symbols will be labeled as Purchase: 1 and Purchase: 2.
727
Getting Started Using PowerDesigner
To search for an object: Type CTRL+F to open the Find Objects dialog
box. Enter the text to search for (you can use the asterisk as a wild card)
and click Find Now. Right-click any of the results choose whether to find
it in the Browser or Diagram.
How do I edit objects? You can edit the name of an object by selecting its
symbol in the diagram and typing F2. To edit other object properties,
double-click the symbol or the object entry in the Browser and enter the
necessary information in its property sheet.
How do I share objects? You can share objects between packages and
models using shortcuts and replications. For more information, see the
Shortcuts and Object Replications chapter in the Core Features Guide .
Packages/Subject Areas How do I create subject areas? In PowerDesigner, you can create multiple
views of your model by adding additional diagrams. You can also divide
your model into smaller subdivisions using packages.
To add a diagram to your model: Right-click the diagram background
and select Diagram New Diagram [Diagram Type] from the
contextual menu.
728
Chapter 13. Migrating from ERwin to PowerDesigner
729
Getting Started Using PowerDesigner
730
Index
A apm 9
archive 9
abstract data type 64, 129
ASK column default 86
abstract object 381
association 44, 196, 220
attribute variable 707
cardinality 47
categories 129
change to entity 49
check model 381
check model 383, 385
create 130, 447
create 45, 220
drop 447
define 49
instantiable object 381
dependent 48
link to Java class 133
display preferences 349
properties 130
entity 49
use in PowerDesigner 129
entity attribute 49
variable 707
properties 46, 220
abstract data type procedure
reflexive 47
check model 382
association attribute 50
definition 382
association link
name conflict with attribute 382
cardinality 47
return type 382
define 45
Access 97 460, 530
display preferences 350
access.mdb 460
properties 46
add-in MS SQL Server 586
asymmetric key 563
administrator permission 516
attribute 27, 196, 211
AKCOLN 693
association 50
alias 302
create 27, 211
ALLCOL 693
delete 29
Alter (permission) 290
enforce coherence 332
alter (script) 506
identifier 29
alternate key 58
link to identifier 38
column 98
migrate 38
constraint 100, 101
properties 27, 211
define 95
reuse 29
designate 98
attribute (multidimensional diagram) 385
generate 448, 450
auto-increment column in Sybase ASA 649
generate index 107
auto-layout during reverse engineering 524
index 103, 106, 451
auto-migrate 139
name 99
check parameter 139
number 101
column 140
physical option 450
columns (model option) 342
variable 101
default join 37, 143
ambiguous detection in Java reverse engineering 525
domain 139
Analysis server (MS SQL Server) 586
validation rule 139
Analysis services (MS SQL Server) 586
731
Index
732
Index
733
Index
734
Index
735
Index
736
Index
737
Index
738
Index
739
Index
740
Index
741
Index
742
Index
743
Index
744
Index
object P
attach to user 284
owner 284 package
PDM 58 check model 409
object abstract data type 132 display preferences 354
inherit procedure 132 PAM opened into CDM 15
object data type in Oracle 620, 659 parameter
OLE data type 119 generate test data 474
OOM modify database 508
link 133 test data source 475, 478, 480
link Java class 129 parent table 101, 150, 524
operation procedure 263 partition
option add 77
CDM 22, 40 corresponding table 77
code 40 delete 77
configure for generated CDM 376 horizontal 70
data item 25 manage 77
745
Index
746
Index
747
Index
R number 101
number of children 146
rebuild
preference 150, 151, 355
bitmap join index 621
properties 142
cube 200
rebuild 148, 524
database package procedure dependencies 261
relational 151
defaults 113
reuse column 140
index 107
straighten 150
IQ index 659, 660
text 355
primary key 97, 524
variable 101, 709
procedure dependencies 261
view 157
reference 148, 524
References (permission) 290
trigger dependencies 261
referential integrity 146, 224
rebuild triggers
cardinality 146
create trigger automatically 224
cluster 146
delete and rebuild 232
delete 146
delete trigger 232
display 355
insert trigger 232
generate 146, 448
select trigger template 232
label 355
template item 232, 246
properties 146
trigger template 232, 246
update 146
update trigger 232
reflexive association 47
user-defined trigger 232
relational notation 151
reference 58, 138
relational to multidimensional mapping 205
add to bitmap join index 624
relational to relational mapping 202
add to join index 668
relationship 32
auto-migration 140
associative entity 40
bend 150
cardinality 34, 41
cardinality 146, 355
change to entity 40
change table 150
check model 413
check model 412
code 40
child table 146
create 32, 39
CODASYL 151
define 34, 40
column variable 710
dependent 34
conceptual 151
dominant 34
create 138
entity attribute 40
delete 148
error 40
display 150, 151
example 41
display preferences 355
mandatory 34
drag 150
option 40
generate 148
optional 34
join 355
properties 32
mode 150
reflexive 39
model options 356
unique code 40
modify 150
relationship display preferences 356
move to table 150
remote server 652
name 355
remote service binding 582
notation 151, 356
748
Index
749
Index
750
Index
751
Index
752
Index
753
Index
754
Index
X
XML
data type 569
index 567
indexing 567
table 65
table column 570
view 65
XML schema collection 569
XML Builder Wizard 376
XPF import 491
755