You are on page 1of 858

Sybase

PowerDesigner

Physical Data Model


User's Guide
Version 11.0
DC38058-01-1100-01
Last modified: November 2004
Copyright 1991-2004 Sybase, Inc. 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.
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, Afaria, AppModeler, APT Workbench, APTBuild, APT-Edit, APT-Execute, APT-Translator, APT-
Library, ASEP, AvantGo, AvantGo Application Alerts, AvantGo Mobile Document Viewer, AvantGo Mobile Delivery, AvantGo
Mobile Inspection, AvantGo Mobile Marketing Channel, AvantGo Mobile Pharma, AvantGo Mobile Sales, AvantGo Pylon, AvantGo
Pylon Application Server, AvantGo Pylon Conduit, AvantGo Pylon PIM Server, AvantGo Pylon Pro, Backup Server, BayCam, Bit-
Wise, BizTracker, Certified PowerBuilder Developer, Certified SYBASE Professional, Certified SYBASE Professional Logo,
ClearConnect, Client-Library, Client Services, CodeBank, Column Design, ComponentPack, Connection Manager, Convoy/DM,
Copernicus, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DB-
Library, dbQueue, Developers Workbench, Direct Connect Anywhere, DirectConnect, Distribution Director, Dynamic Mobility Model,
e-ADK, E-Anywhere, e-Biz Integrator, E-Whatever, EC Gateway, ECMAP, ECRTP, eFulfillment Accelerator, Electronic Case
Management, Embedded SQL, EMS, Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect, Enterprise Data
Studio, Enterprise Manager, Enterprise Portal (logo), Enterprise SQL Server Manager, Enterprise Work Architecture, Enterprise Work
Designer, Enterprise Work Modeler, eProcurement Accelerator, eremote, Everything Works Better When Everything Works Together,
EWA, Financial Fusion, Financial Fusion (and design), Financial Fusion Server, Formula One, Fusion Powered e-Finance, Fusion
Powered Financial Destinations, Fusion Powered STP, Gateway Manager, GeoPoint, GlobalFIX, iAnywhere, iAnywhere Solutions,
ImpactNow, Industry Warehouse Studio, InfoMaker, Information Anywhere, Information Everywhere, InformationConnect, InstaHelp,
Intelligent Self-Care, InternetBuilder, iremote, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager,
M-Business Channel, MBusiness Network, M-Business Server, Mail Anywhere Studio, MainframeConnect, Maintenance Express,
Manage Anywhere Studio, MAP, MDI Access Server, MDI Database Gateway, media.splash, Message Anywhere Server, MetaWorks,
MethodSet, ML Query, MobiCATS, My AvantGo, My AvantGo Media Channel, My AvantGo Mobile Marketing, MySupport, Net-
Gateway, Net-Library, New Era of Networks, Next Generation Learning, Next Generation Learning Studio, O DEVICE, OASiS,
OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL Access Module, OmniSQL Toolkit, Open Biz, Open Business
Interchange, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, Open
ServerConnect, Open Solutions, Optima++, Orchestration Studio, Partnerships that Work, PB-Gen, PC APT Execute, PC DB-Net, PC
Net Library, PhysicalArchitect, Pocket PowerBuilder, PocketBuilder, Power++, Power Through Knowledge, power.stop, PowerAMC,
PowerBuilder, PowerBuilder Foundation Class Library, PowerDesigner, PowerDimensions, PowerDynamo, Powering the New
Economy, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerStudio, PowerTips, Powersoft Portfolio, Powersoft
Professional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, QAnywhere, Rapport, Relational Beans, RemoteWare,
RepConnector, Report Workbench, Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication Server
Manager, Replication Toolkit, Resource Manager, RW-DisplayLib, RW-Library, SAFE, SAFE/PRO, SDF, Secure SQL Server, Secure
SQL Toolset, Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Anywhere, SQL Anywhere
Studio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQL Everywhere, SQL Modeler, SQL Remote, SQL Server, SQL
Server Manager, SQL SMART, SQL Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server SNMP SubAgent, SQL Station, SQLJ,
Stage III Engineering, Startup.Com, STEP, SupportNow, S.W.I.F.T. Message Format Libraries, Sybase Central, Sybase Client/Server
Interfaces, Sybase Development Framework, Sybase Financial Server, Sybase Gateways, Sybase IQ, Sybase Learning Connection,
Sybase MPP, 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, UltraLite.NET, UNIBOM,
Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode, Viewer, VisualWriter, VQL, WarehouseArchitect, Warehouse
Control Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL Server, Web Deployment Kit,
Web.PB, Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library, XA-Server, XcelleNet, and XP Server are
trademarks of Sybase, Inc. or its subsidiaries.
All other trademarks are property of their respective owners.
PDM User's Guide iii
Contents
About This Book .........................................................................................xvii
1 Physical Data Model Basics ..............................................1
What is a PDM?........................................................................ 2
Operational PDM................................................................ 3
Business Intelligence PDM................................................. 3
Logical model ..................................................................... 4
Objects in a PDM............................................................... 5
Defining the PDM environment ................................................. 7
PDM DBMS........................................................................ 7
PDM extended model definitions........................................ 8
PDM options..................................................................... 10
PDM extended dependencies .......................................... 17
PDM database properties................................................. 18
Defining a PDM....................................................................... 19
PDM properties ................................................................ 19
Creating a PDM................................................................ 20
Opening an existing PDM................................................. 24
Detaching a PDM from the workspace............................. 25
Saving and closing a PDM............................................... 25
Archiving a PDM............................................................... 25
Creating a database......................................................... 26
Defining Packages in a PDM.................................................. 28
PDM package properties.................................................. 29
Modifying package display preferences ........................... 29
Using SQL tools...................................................................... 30
Defining queries with the SQL Editor ............................... 30
Previewing SQL statements............................................. 32
2 Using Business Rules in a PDM......................................35
What is a business rule in a PDM?......................................... 36
Defining business rules in a PDM........................................... 37
Business rule properties in a PDM................................... 37
iv PowerDesigner
Types of business rules in a PDM.................................... 37
Creating a business rule in a PDM................................... 38
Attaching an expression to a business rule in a PDM...... 39
Using constraint business rules in a PDM........................ 40
Using business rules in a PDM............................................... 45
Applying a business rule to the current object in a PDM.. 45
Applying a constraint business rule to a table or a
column.............................................................................. 46
3 Building Physical Diagrams............................................ 49
Physical diagram basics ......................................................... 50
Defining a physical diagram............................................. 50
Why build a physical diagram?......................................... 50
Creating a physical diagram............................................. 50
Defining tables in a physical diagram..................................... 51
Table properties ............................................................... 51
Creating a table................................................................ 53
Modifying table properties ................................................ 55
Arranging items in a list attached to a table ..................... 55
Naming a table constraint ................................................ 56
Modifying the table display preferences ........................... 57
Defining domains in a PDM.................................................... 61
Domain properties in a PDM............................................ 61
Creating a domain in a PDM............................................ 62
Indicating data type, length, and precision....................... 63
Selecting a data type for a domain in a PDM................... 64
Selecting a data type from a list of standard data types
in a PDM........................................................................... 66
Modifying domain properties in a PDM............................ 69
Enforcing non-divergence from a domain in a PDM........ 70
Defining defaults in a PDM..................................................... 73
Default properties in a PDM............................................. 73
Creating a default in a PDM............................................. 73
Assigning a default to a column or a domain ................... 74
Rebuilding defaults........................................................... 75
Using abstract data types in a physical diagram..................... 77
Types of abstract data types used in PowerDesigner ...... 77
How are abstract data types used in PowerDesigner? .... 78
Abstract data type properties ........................................... 79
Creating an abstract data type ......................................... 80
Creating an object (or a SQLJ object) abstract data
type................................................................................... 82
Linking an abstract data type to a Java class................... 85
Automatic linking to a Java class after reverse
engineering....................................................................... 88
Accessing a linked Java class in an OOM....................... 88
PDM User's Guide v
Defining columns in a physical diagram ................................. 92
Column properties............................................................ 92
Column details.................................................................. 93
Creating columns ............................................................. 94
Creating a computed column ........................................... 95
Creating a sequence for a column ................................... 97
Selecting a data type for a column................................. 103
Attaching a column to a domain..................................... 106
Copying a column to another table................................. 107
Naming a column constraint........................................... 108
Configuring the display of the list of columns................. 109
Defining keys in a physical diagram...................................... 111
Designating a primary key.............................................. 111
Rebuilding primary keys ................................................. 112
Designating a foreign key............................................... 113
Adding parent table columns to a key ............................ 114
Auto-migrating foreign keys............................................ 114
Designating an alternate key.......................................... 117
Naming key constraints.................................................. 119
Defining references in a physical diagram............................ 122
Reference properties...................................................... 123
Defining model options for references ........................... 124
Automatic reuse and migration of columns.................... 127
Creating a reference....................................................... 129
Defining reference joins.................................................. 130
Changing a table at either end of a reference................ 135
Rebuilding references .................................................... 136
Using referential integrity................................................ 138
Referential integrity properties........................................ 139
Defining referential integrity............................................ 141
Modifying the reference display preferences.................. 143
Modifying a reference graphically................................... 145
Defining indexes in a physical diagram................................. 148
Index properties.............................................................. 148
Creating an index ........................................................... 150
Removing a column from an index................................. 156
Rebuilding indexes ......................................................... 157
Deleting an index............................................................ 160
Defining views in a physical diagram.................................... 161
View properties............................................................... 161
View columns ................................................................. 162
View triggers................................................................... 164
Creating a view............................................................... 164
Modifying view properties............................................... 168
Using extended dependencies for views........................ 168
Defining a query for a view............................................. 169
vi PowerDesigner
Assigning an alias to a table or a column....................... 174
Defining query properties ............................................... 175
Displaying query syntax.................................................. 179
Defining a generation order for views............................. 180
Modifying the view display preferences.......................... 183
Defining view references in a physical diagram.................... 184
View reference properties .............................................. 184
Creating a view reference .............................................. 185
Defining view reference joins ......................................... 186
Changing a table or view at either end of a view
reference........................................................................ 189
Modifying the view reference display preferences ......... 189
Modifying a view reference graphically........................... 190
Defining query tables in a physical diagram ......................... 191
Defining a view as a query table..................................... 191
Defining an index in a query table.................................. 192
Defining check parameters in a PDM................................... 195
Setting standard check parameters for objects in a
PDM............................................................................... 195
Defining additional check parameters for objects in a
PDM............................................................................... 198
Using a validation rule in check parameters in a PDM... 199
Managing quotation marks around values ..................... 201
Defining physical options for a PDM..................................... 202
Defining default physical options.................................... 203
Defining physical options................................................ 205
4 Building Multidimensional Diagrams ........................... 209
Multidimensional diagram basics.......................................... 210
Defining a multidimensional diagram............................. 210
Why build a multidimensional diagram?......................... 211
Creating a multidimensional diagram............................. 211
Defining dimensions in a multidimensional diagram............. 213
Dimension properties ..................................................... 213
Creating a dimension ..................................................... 214
Modifying dimension properties...................................... 215
Modifying the dimension display preferences ................ 216
Defining attributes in a multidimensional diagram................ 217
Attribute properties in a multidimensional diagram........ 217
Creating an attribute in a multidimensional diagram...... 218
Modifying attribute properties in a multidimensional
diagram.......................................................................... 219
Defining hierarchies in a multidimensional diagram............. 220
Hierarchy properties....................................................... 220
Creating a hierarchy....................................................... 221
Modifying hierarchy properties ....................................... 222
PDM User's Guide vii
Defining cubes in a multidimensional diagram ..................... 223
Cube properties.............................................................. 223
Creating a cube.............................................................. 224
Modifying cube properties .............................................. 225
Modifying the cube display preferences ......................... 226
Defining facts in a multidimensional diagram....................... 227
Fact properties ............................................................... 227
Creating a fact ................................................................ 228
Modifying fact properties from the list of facts................ 229
Defining measures in a multidimensional diagram............... 231
Measure properties ........................................................ 231
Creating a measure........................................................ 232
Modifying measure properties........................................ 232
Defining associations in a multidimensional diagram........... 235
Association properties in a multidimensional diagram... 235
Creating an association in a multidimensional diagram. 235
Modifying association properties in a multidimensional
diagram .......................................................................... 237
Modifying the association display preferences in a
multidimensional diagram .............................................. 237
5 Denormalizing a Physical Data Model ..........................239
Overview............................................................................... 240
Horizontal partitioning ........................................................... 241
Using the Horizontal Partitioning Wizard........................ 242
Using the horizontal partitioning object........................... 243
Managing horizontal partitions........................................ 245
Intermodel generation of horizontal partitions ................ 245
Revert a horizontal partitioning....................................... 247
Vertical partitioning ............................................................... 248
Using the Vertical Partitioning Wizard............................ 248
Using the vertical partitioning object............................... 250
Managing vertical partitions............................................ 252
Intermodel generation of vertical partitions .................... 252
Revert a vertical partitioning........................................... 254
Table collapsing.................................................................... 256
Using the Table Collapsing Wizard................................ 257
Using the table collapsing object .................................... 258
Intermodel generation of table collapsing....................... 259
Revert a table collapsing................................................ 259
Column denormalization ....................................................... 261
Using the Column Denormalization Wizard ................... 261
Intermodel generation of denormalized columns ........... 263
Revert a column denormalization................................... 263
viii PowerDesigner
6 Working with Physical Data Models............................. 265
Checking a PDM................................................................... 266
PDM check options ........................................................ 266
Object selection for Check Model .................................. 267
Checking a global PDM.................................................. 268
Displaying previously applied check options .................. 271
Making corrections based on PDM check results .......... 271
Object parameters verified during check model ................... 274
Horizontal partitioning check .......................................... 274
Table collapsing check................................................... 275
Vertical partitioning check .............................................. 276
Business Rule check in a PDM...................................... 277
Package check............................................................... 277
User check ..................................................................... 279
Group check................................................................... 280
Role check ..................................................................... 281
Domain check ................................................................ 282
Table check.................................................................... 283
Column check ................................................................ 286
Index check .................................................................... 289
View index check............................................................ 291
Key check....................................................................... 292
Trigger check ................................................................. 294
Reference check ............................................................ 294
View reference check..................................................... 296
View check ..................................................................... 297
Abstract data type check................................................ 297
Abstract data type procedure check............................... 298
Synonym check .............................................................. 300
Database package check............................................... 300
Database package procedure check ............................. 302
Database package cursor check.................................... 304
Database package variable check ................................. 305
Database package type check ....................................... 305
Database package exception check .............................. 306
Procedure check ............................................................ 306
Data source check ......................................................... 307
File object check ............................................................ 308
Cube check .................................................................... 309
Fact check...................................................................... 310
Fact measure check....................................................... 311
Dimension check............................................................ 311
Attribute check ............................................................... 313
Dimension hierarchy check ............................................ 313
Association check .......................................................... 314
Join index check............................................................. 314
PDM User's Guide ix
Replication check ........................................................... 316
Default check.................................................................. 316
Storage check ................................................................ 317
Tablespace check .......................................................... 318
Extended object check ................................................... 319
Extended link check ....................................................... 319
Web service check......................................................... 320
Web operation check ..................................................... 320
Mapping objects in a PDM.................................................... 322
Understanding object mapping....................................... 322
Defining data sources in a PDM..................................... 323
Defining a relational to relational mapping ..................... 326
Defining a relational to multidimensional mapping......... 332
Retrieving multidimensional objects ..................................... 341
Rebuilding cubes .................................................................. 343
Generating extraction scripts ................................................ 346
Generating Cube Data.......................................................... 348
Defining the query of a cube .......................................... 348
Generating a text file ...................................................... 349
Migrating from version 6 data warehouse............................. 351
Comparing version features ........................................... 351
Converting objects from version 6.................................. 351
Converting external sources........................................... 353
Using PowerBuilder extended attributes............................... 355
Importing the PowerBuilder extended model definition.. 355
Importing models with PowerBuilder extended
attributes from a previous version.................................. 357
Modifying the value of a PowerBuilder extended
attribute .......................................................................... 358
Generating PowerBuilder extended attributes................ 359
Reverse engineering PowerBuilder extended attributes 360
Importing an ERwin model into a PDM................................. 362
Migrating from ERwin..................................................... 363
7 Reverse Engineering in a PDM......................................365
Reverse engineering a database schema ............................ 366
Defining reverse engineering options............................. 366
Reverse engineering shortcuts....................................... 368
Generating a PDM from a database .............................. 369
Filters and options for reverse engineering.................... 370
Optimizing ODBC reverse engineering queries ............. 371
Reverse engineering into a new PDM............................ 372
Reverse engineering into an existing PDM.................... 379
Reverse engineering a Microsoft Access 97 database.. 387
x PowerDesigner
8 Triggers and Procedures............................................... 389
Trigger overview................................................................... 390
How to design triggers.................................................... 390
Using triggers........................................................................ 393
Trigger properties........................................................... 393
Defining triggers with multiple events............................. 394
Using variables in triggers.............................................. 395
Creating triggers automatically....................................... 395
Creating a trigger manually ............................................ 401
Modifying a trigger .......................................................... 403
Indicating trigger order ................................................... 406
Multiple triggers.............................................................. 406
Previewing a trigger........................................................ 408
Using trigger templates......................................................... 409
Identifying PowerDesigner pre-defined trigger template
types............................................................................... 410
Trigger template properties............................................ 412
Using variables in trigger templates ............................... 413
Creating a trigger template............................................. 414
Modifying a trigger template........................................... 421
Trigger naming conventions........................................... 426
Changing trigger naming conventions............................ 426
Calling a related procedure in a trigger template ........... 427
Using template items ............................................................ 428
Identifying template items............................................... 430
Template item properties ............................................... 432
Using variables in template items .................................. 432
Creating a template item................................................ 433
Modifying a template item .............................................. 439
Declaring a template item in a trigger definition............. 441
Defining stored procedures and functions ............................ 443
Defining templates for stored procedures and
functions......................................................................... 443
Creating stored procedures and functions ..................... 444
Attaching a stored procedure to a table ......................... 449
Using macros........................................................................ 451
AKCOLN......................................................................... 451
ALLCOL.......................................................................... 452
DEFINE.......................................................................... 452
DEFINEIF....................................................................... 453
ERROR .......................................................................... 453
FKCOLN......................................................................... 454
FOREACH_CHILD......................................................... 454
FOREACH_COLUMN.................................................... 455
FOREACH_PARENT..................................................... 456
INCOLN.......................................................................... 457
PDM User's Guide xi
JOIN............................................................................... 458
NMFCOL ........................................................................ 458
PKCOLN......................................................................... 459
CLIENTEXPRESSION and SERVEREXPRESSION..... 459
SQLXML......................................................................... 460
Using the SQL/XML Wizard.................................................. 462
Generating triggers and procedures ..................................... 469
Trigger and procedure creation parameters................... 470
Generation script options ............................................... 470
Object selection parameters .......................................... 472
Defining a generation order for stored procedures ........ 472
Generating a trigger or procedure creation script .......... 476
Creating triggers directly in a database.......................... 478
Creating and generating user-defined error messages.. 479
9 Web services in databases............................................483
Defining Web services.......................................................... 484
Web services in PowerDesigner .................................... 484
Defining Web services properties .................................. 487
Creating a Web service.................................................. 490
Defining Web operations properties............................... 492
Creating a Web operation .............................................. 497
Defining Web parameters general properties ................ 500
Defining result columns general properties.................... 501
Generating Web services ..................................................... 502
Generating Web services for Sybase ASA 9 ................. 502
Generating Web services for IBM DB2 v8.1 .................. 512
Reverse engineering Web services...................................... 516
Reverse engineering Web services from Sybase
ASA 9 ............................................................................. 517
10 Database Creation and Modification.............................527
Using the ODBC interface .................................................... 528
Defining an ODBC data source...................................... 529
Configuring an ODBC data source................................. 529
Connecting to an ODBC data source............................. 531
Displaying information about a connected database...... 532
Disconnecting from a data source.................................. 532
Accessing a database........................................................... 533
Changing target DBMS .................................................. 533
Displaying data from a database.................................... 537
Executing SQL queries................................................... 538
Configuring tablespace and storage..................................... 540
Defining tablespace and storage.................................... 540
Previewing tablespace and storage commands............. 543
xii PowerDesigner
Sample tablespace and storage commands.................. 545
Estimating database size...................................................... 546
Indicating the number of records in a table.................... 547
Indicating average data type length................................ 548
Estimating the database size of a model ....................... 549
Estimating the database size of selected tables ............ 550
Customizing scripts............................................................... 552
Script toolbar properties ................................................. 552
Inserting begin and end scripts for database creation ... 552
Inserting begin and end scripts for table creation .......... 556
Inserting begin and end script for tablespace creation... 557
Formatting variables in customized scripts .................... 558
Generating a database ......................................................... 559
Creation parameters for tables, columns, and views ..... 560
Creation parameters for keys, indexes, and join
indexes........................................................................... 562
Database creation parameters....................................... 564
Generation script options ............................................... 566
Object selection parameters .......................................... 567
Selecting objects for generation..................................... 569
Generating a database creation script ........................... 571
Creating a database directly........................................... 572
Generating a Microsoft Access 97 database ................. 574
Modifying a database............................................................ 575
Database generation synchronization parameters......... 575
Database modification script options ............................. 576
Generating a modified database.................................... 577
Using test data...................................................................... 586
Creating a test data profile ............................................. 587
Automatic test data generation source parameters ....... 589
Defining a list as a test data generation source ............. 596
Defining an ODBC data source as a test data
generation source........................................................... 597
Selecting an ODBC data source .................................... 599
Defining a file as a test data generation source............. 599
Defining column fill parameters...................................... 601
Assigning a data profile.................................................. 603
Importing a data profile .................................................. 607
Exporting a data profile .................................................. 607
Generating test data....................................................... 608
11 Managing Database Access.......................................... 619
Understanding database access management .................... 620
Managing database users .................................................... 621
Defining a user ............................................................... 621
Defining a role ................................................................ 624
PDM User's Guide xiii
Defining a group............................................................. 626
Managing system privileges.................................................. 629
Analyzing system privileges ........................................... 629
Defining system privileges.............................................. 629
Managing object permissions ............................................... 634
Analyzing object permissions ......................................... 634
Defining object permissions ........................................... 634
Defining column permissions ......................................... 641
Generating privileges............................................................ 644
Creation parameters for users, groups and roles........... 644
Generating privileges ..................................................... 646
Managing synonyms ............................................................. 648
Defining a synonym........................................................ 648
Creating a synonym........................................................ 649
Creating a view for a synonym....................................... 651
Generating synonyms..................................................... 652
Reverse engineering synonyms ..................................... 655
12 Generating from a Physical Data Model .......................657
Generation basics................................................................. 658
Target models parameters............................................. 658
Object selection parameters .......................................... 660
Generating a Physical Data Model from a Physical Data
Model .................................................................................... 661
Why generate a PDM into a PDM? ................................ 661
Generating and updating a PDM.................................... 662
Generating a Conceptual Data Model from a Physical
Data Model............................................................................ 671
Generating CDM objects................................................ 671
Translating PDM to CDM data types.............................. 671
Generating and updating a CDM.................................... 673
Migrating models from version 6.................................... 680
Generating an Object-Oriented Model from a Physical
Data Model............................................................................ 683
Generating OOM Objects............................................... 683
Translating PDM to OOM data types ............................. 684
Generating and updating an OOM................................. 684
Generating an XML Model from a Physical Data Model ....... 693
Generating XML Model objects...................................... 693
Generating and updating an XML Model........................ 693
Defining XML Model generation options ........................ 695
Generating a new XML model from a PDM ................... 697
Updating an existing XML model.................................... 698
Generating an XML model via the XML Builder Wizard. 701
xiv PowerDesigner
13 DBMS-specific Features................................................ 711
Logical................................................................................... 712
Why build a logical model? ............................................ 712
Inheritance in the logical PDM........................................ 712
IBM DB 2............................................................................... 716
IBM DB 2 indexes........................................................... 716
Tablespace prefix........................................................... 716
Multiple databases in a model........................................ 719
IBM DB 2 extended attributes ........................................ 722
Bind package.................................................................. 724
MS Access............................................................................ 725
Reverse Engineering a MS Access 97 Database .......... 725
MS Access extended attributes...................................... 726
Support for Oracle ................................................................ 727
Special variables for triggers.......................................... 727
Object (or SQLJ object) data types ................................ 727
Bitmap join indexes ........................................................ 730
Database package ......................................................... 737
Reverse engineering tablespace physical options ......... 748
Reverse engineering ASC/DESC indexes ..................... 749
Managing Oracle dimensions......................................... 749
Oracle extended attributes ............................................. 752
Support for Sybase Adaptive Server IQ................................ 754
Accessing Sybase AS IQ features ................................. 754
Creating a new PDM using Sybase AS IQ..................... 755
Reverse engineering an existing Sybase AS IQ
database......................................................................... 755
Checking a model built with IQ 12.4.3............................ 755
Changing the target DBMS of an existing PDM............. 755
Defining IQ indexes........................................................ 756
Rebuilding IQ indexes .................................................... 757
Defining IQ join indexes ................................................. 759
Join index properties ...................................................... 760
Rebuild join indexes for all references linked to a fact
table................................................................................ 760
Creating a join index from the table property sheet ....... 763
Creating a join index in the list of join indexes ............... 763
Adding references to a join index................................... 766
Generating a Sybase AS IQ database ........................... 768
Sybase AS IQ database parameters.............................. 768
Generating a Sybase AS IQ database creation script.... 768
Sybase IQ extended attributes....................................... 772
Sybase Adaptive Server Enterprise...................................... 773
Identity columns ............................................................. 773
Sybase Adaptive Server Enterprise extended
attributes......................................................................... 774
PDM User's Guide xv
Sybase Adaptive Server Anywhere....................................... 775
Auto-increment columns ................................................ 775
Sybase Adaptive Server Anywhere extended attributes 775
Interbase extended attributes ............................................... 776
MS SQL Server..................................................................... 777
SQL Server Analysis Services concepts ........................ 777
Comparing PowerDesigner and DSO metamodels........ 778
Enabling Microsoft Analysis Services in
PowerDesigner ............................................................... 779
Generating cubes........................................................... 780
Reverse Engineering cubes ........................................... 781
Customizing multi-dimensional objects .......................... 783
NonStop SQL extended attributes ........................................ 788
PostgreSQL extended attributes........................................... 789
Informix extended attributes ................................................. 790
MySQL extended attributes .................................................. 791
Appendix Variables in PowerDesigner ..........................................793
List of PowerDesigner variables ........................................... 794
List of PowerDesigner formatting variables .......................... 806
PDM Glossary .........................................................................................807
Index .........................................................................................811
xvi PowerDesigner
PDM User's Guide xvii
About This Book
This book describes the PowerDesigner Physical Data Model data modeling
environment. It shows you how to do the following:
Build a Physical Data Model (PDM) using Physical and
Multidimensional diagrams
Create and use business rules and other model objects
Generate triggers, procedures, scripts, and databases
Generate databases
Reverse engineer existing databases
Generate a Physical Data Model, a Conceptual Data Model and an
Object-Oriented data Model from a PDM
This book is for anyone who will be building data models with
PowerDesigner. Although it does not assume you have knowledge about any
particular topic, having some familiarity with relational databases, SQL, and
design methodology is helpful. For more information, see the Bibliography
section at the end of this chapter.
The PowerDesigner modeling environment supports several types of models:
Conceptual Data Model (CDM) to model the overall logical structure
of a database, independent from any software or data storage structure
considerations
Physical Data Model (PDM) to model the overall physical structure of
a database, taking into account DBMS software or data storage structure
considerations
Object Oriented Model (OOM) to model a software system using an
object-oriented approach for Java or other object languages
Business Process Model (BPM) to model the means by which one or
more processes are accomplished in operating business practices
Subject
Audience
Documentation
primer
About This Book
xviii PowerDesigner
XML Model (XSM) to model the structure of an XML file using a DTD
or an XML schema
Requirements Model (RQM) to list and document the customer needs
that must be satisfied during a development process
Information Liquidity Model (ILM) to model the replication of
information from a source database to one or several remote databases
using replication engines
Free Model (FEM) to create any kind of chart, diagram, in a context-
free environment
This book only explains the Physical Data Model. For information on other
models or aspects of PowerDesigner, consult the following books:
General Features Guide To get familiar with the PowerDesigner
interface before learning how to use any of the models.
Conceptual Data Model Getting Started To learn the basics of the
CDM.
Conceptual Data Model Users Guide To work with a CDM.
Physical Data Model Getting Started To learn the basics of the PDM.
Object Oriented Model Getting Started To learn the basics of the
OOM.
Object Oriented Model User's Guide To work with an OOM.
Business Process Model User's Guide To work with a BPM.
Business Process Model Getting Started To learn the basics of the
BPM.
XML Model User's Guide To work with an XSM.
Information Liquidity Model User's Guide To work with an ILM.
Requirements Model User's Guide To work with an RQM.
Reports Users Guide To create reports for any or all models.
Repository Users Guide To work in a multi-user environment using a
central repository.
Repository Getting Started To learn the basics of the Repository.
About This Book
PDM User's Guide xix
PowerDesigner documentation uses specific 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.
UPPER CASE
Object codes, reversed objects, file names + extension.
Example: The AUTHOR table appears in the Browser. Open the file
OOMAFTER.OOM.
bold text
Any new term.
Example: A shortcut has a target object.
SMALL CAPS
Any key name.
Example: Press the ENTER key.
Data Modeling Essentials
Graeme Simsion, Van Nostrand Reinhold, 1994, 310 pages; paperbound;
ISBN 1850328773
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 Celko's SQL for Smarties (Morgan Kaufmann Publishers,
Inc., 1995), 467 pages; paperbound; ISBN 1-55860-323-9.
Typographic
conventions
Bibliography
About This Book
xx PowerDesigner
PDM User's Guide 1
C H A P T E R 1
Physical Data Model Basics
This chapter presents the Physical Data Model (PDM) and explains the role
of physical and multidimensional modeling in the design process.
Topic Page
What is a PDM? 2
Defining the PDM environment 7
Defining a PDM 19
Defining Packages in a PDM 28
Using SQL tools 30
About this chapter
Contents
What is a PDM?
2 PowerDesigner
What is a PDM?
The PDM is a database design tool for defining the implementation of
physical structures and data queries.
Depending on the type of database you want to design, you will use different
types of diagrams in the PDM.
Database Diagram
Operational Physical diagram to define the physical implementation of the
database
Date warehouse
or Data mart
Physical diagram to store business data
OLAP Multidimensional diagram to define the possible queries to
perform on the operational data
Chapter 1 Physical Data Model Basics
PDM User's Guide 3
Operational PDM
The physical diagrams of the PDM are used to design the structure of a
database handling large amounts of operational data. Usually, the physical
analysis follows the conceptual analysis in data modeling. At the physical
stage, the designer considers the details of actual physical implementation of
data in a database.
Since operational data are highly volatile and likely to be modified regularly,
the database should be designed to accelerate data access and retrieval.
The physical diagrams of the PDM allow to take into account both software
or data storage structures to suit your performance and physical constraints.
For more information on how to build a physical diagram, see chapter
Building Physical Diagrams.
Business Intelligence PDM
You can use a PDM to design the structure of a data warehouse handling
business data. A data warehouse environment is made of:
A data warehouse or data mart database
An OLAP database and tools for sending queries to the database
Data warehouse and data mart databases store historical business data
from heterogeneous systems. The data warehouse database gathers all the
data manipulated in a company for example, whereas the data mart focuses
on smaller entities in the company.
Data warehouse and data mart databases are populated with data proceeding
from different operational sources. This data transfer is implemented via a
relational to relational mapping, the operational database being the data
source of the data warehouse or data mart database.
For more information on relational to relational mapping see section
Mapping objects in a PDM in chapter Working with Physical Data Models.
The purpose of maintaining such type of database is to gather in a central
area all the information that may be needed in an OLAP database where
queries for business analysis and decision making are performed.
You use physical diagrams to design a data warehouse or data mart database.
Since these databases usually contain very large amounts of data for storage,
you do not need to design them for performance. You may assign types (fact
and dimension) to the database tables to have a preview of the
multidimensional structure in an OLAP database.
Data warehouse
and data mart
database
What is a PDM?
4 PowerDesigner
An OLAP database shows a multidimensional view of business data.
Information in an OLAP database is organized to facilitate the queries
performed by different tools. Business analysts use OLAP databases to send
queries and retrieve business information from the different dimensions
existing in the database.
OLAP databases are populated with data usually proceeding from a data
warehouse or data mart database. This data transfer is implemented via a
relational to multidimensional mapping, the data warehouse or data mart
database being the data source of the OLAP database.
However, when there are no large amounts of data, it is possible to have a
data transfer directly from the operational database to the OLAP engine. For
clarity purpose, we will not develop the operational to OLAP transfer of
information in this book.
For more information on relational to multidimensional mapping see
section Mapping objects in a PDM in chapter Working with Physical Data
Models.
You have to use multidimensional diagrams to design the different
dimensions and cubes within the OLAP database.
Logical model
The logical model allows you to design the database structure and perform
some database denormalization actions. This model is independent from any
DBMS physical requirement.
In PowerDesigner, you can design a logical model using a PDM with the
<Logical Model> DBMS. This PDM is a physical model with standard
objects, and without DBMS specific physical options and generation
capabilities.
For more information on the logical model, see section Logical in
chapter DBMS-specific Features.
OLAP database
Chapter 1 Physical Data Model Basics
PDM User's Guide 5
Objects in a PDM
The PDM includes different types of diagrams, with their objects:
Object Tool Description
Table Collection of rows (records) that have associated
columns (fields)
Column Data structure that contains an individual data item
within a row (record), model equivalent of a database
field.
Key Column or columns whose values uniquely identify each
row in a table. A key can be designated as a primary or
alternate key
Primary key Column or columns whose values uniquely identify each
row in a table, and are designated as the primary
identifier of each row in the table
Alternate
key
Column or columns whose values uniquely identify each
row in a table, and which is not a primary key
Foreign key Column or columns whose values depend on and
migrate from a primary or alternate key in another table.
Index Data structure associated with one or more columns in a
table, in which the column values are ordered in such a
way as to speed up access to data
Reference Link between a primary or an alternate key in a parent
table, and a foreign key of a child table. Depending on
its selected properties, a reference can also link columns
that are independent of primary or alternate key columns
View Data structure that results from a SQL query and that is
built from data in one or more tables
Procedure Precompiled collection of SQL statements stored under
a name in the database and processed as a unit
Web service Collection of SQL statements stored in a database to
retrieve relational data in HTML, XML, WSDL or plain
text format, through HTTP or SOAP requests
Web
operation
Sub-object of a Web service containing a SQL statement
and displaying Web parameters and result columns
Physical objects
What is a PDM?
6 PowerDesigner
Object Tool Description
Cube Collection of measures related to aspects of the business
and used to carry out a decision support investigation
Fact Group of measures used among cubes
Dimension Axis of investigation of a cube (time, product,
geography)
Association Association that relates a cube to a dimension
Attribute Used to qualify a dimension. For example, attribute
Year qualifies the Date dimension
Fact
Measure
Variable linked to a fact, used as the focus of a decision
support investigation
Hierarchy Organizational structure that describes a traversal
pattern though a dimension
Multidimensional
objects
Chapter 1 Physical Data Model Basics
PDM User's Guide 7
Defining the PDM environment
The PDM environment includes a set of parameters and configuration
options that define various aspects of the model content and behavior. You
can set these parameters:
At model creation
After creating a model with default options and parameters
When creating a model template
PDM DBMS
PowerDesigner can be used with many different DBMS. For each of these
DBMS, a standard definition file is included and provides an interface
between PowerDesigner and the DBMS so as to establish the best
relationships between them.
Caution
You should never modify the DBMS files shipped with PowerDesigner.
For each original DBMS you want to modify, you should create a
corresponding new DBMS. To do so you have to create a new DBMS from
the List of DBMS, define a name and select the original file in the Copy
From dropdown listbox. This allows you to create a new DBMS that is
identical to the original file apart from the name.
A DBMS definition file is a list of values and settings that represent
specifications for a particular Database Management System (DBMS) in a
format understandable by PowerDesigner. As an interface between an actual
DBMS and PowerDesigner, it provides PowerDesigner with the syntax and
guidelines for generating databases, triggers, and stored procedures
appropriate for a target DBMS. The file itself is in .XML format.
The DBMS definition file is a required component of PowerDesigner when
working with Physical Data Models (PDM). Each actual DBMS supported by
PowerDesigner has its own DBMS definition.
For more information on the DBMS definition file, see chapter DBMS
Reference Guide in the Advanced User documentation.
All DBMS definition files have the same structure made up of a number of
categories. A category can contain sub-categories, and entries. These
entries are parameters recognizable by PowerDesigner.
What is a DBMS
definition file?
What is contained
in a DBMS
definition?
Defining the PDM environment
8 PowerDesigner
The values for DBMS definition categories and entries vary for each DBMS.
Some entries may not exist in the DBMS file if they are not applicable to the
particular DBMS.
For more information on the DBMS editor, see chapter The Resource
Editor in the General Feature Guide.
Not certified resource file
Some resource files are delivered with "Not Certified" in their names.
Sybase will perform all possible validation checks, however Sybase does
not maintain specific environments to fully certify these resource files.
Sybase will support the definition by accepting bug reports and will
provide fixes as per standard policy, with the exception that there will be
no final environmental validation of the fix. Users are invited to assist
Sybase by testing fixes of the definition provided by Sybase and report
any continuing inconsistencies.
PDM extended model definitions
Extended model definitions (.XEM files) provide means for customizing and
extending PowerDesigner metaclasses, parameters and generation. Extended
model definitions are typed like models in PowerDesigner. You create an
extended model definition for a specific type of model and you cannot share
these files between heterogeneous models.
Extended model definitions may contain:
Extended attributes for applicable objects in order to further define their
properties
Stereotypes to define extended dependencies established between model
objects
For more information on extended dependencies, see section PDM
extended dependencies.
Generation targets and commands to complement the generation of an
object model, or to perform an extended generation
Chapter 1 Physical Data Model Basics
PDM User's Guide 9
When you create a new PDM, or when you reverse engineer into a new
PDM, you can select one or several extended model definitions and attach
them to the model from the Extended Model Definitions page of the New
dialog box.
You can choose one of the following options:
Option Definition
Share Current extended model definition constantly refers to the extended
model definition stored in the Resource Files\Extended Model
Definitions directory. Any changes made to the extended model
definition are shared by all linked XEM
Copy Current extended model definition is a unique copy of the extended
model definition stored in the Resource Files\Extended Model
Definitions directory. The current extended model definition is
independent of the original one, so modifications made to the
extended model definition in the Resource Files\Extended Model
Definitions directory are not available to the copied XEM. This one is
saved with the PDM and cannot be used without it
For more information on extended model definitions, see chapter
Extended Model Definitions Reference Guide, in the Advanced User
Documentation.
Defining the PDM environment
10 PowerDesigner
PDM options
You can set options that apply to a PDM for the following objects:
All objects, see section All objects
Notation, see section Notation
Table and view, see section Table and view
Column and domain, see section Column and domain
Reference, see section Reference
To define PDM options:
1 Select ToolsModel Options.
or
Right-click the diagram background and select Model Options from the
contextual menu.
The Model Options dialog box opens to the Model Settings page.
2 Select model options in the different boxes.
3 Select different Model Settings sub-categories (Table and View, Column
and Domain, Reference) to define model options for different objects.
Chapter 1 Physical Data Model Basics
PDM User's Guide 11
4 Click OK.
All objects
You can define the case sensitivity of names and codes for all objects in the
current model. When this check box is selected, it implies that you can have
two objects with identical name or code but different case in the same
namespace.
Unlike other model options, you can modify the name and code case
sensitivity during the design process. However, if you do so, make sure you
run the check model feature to verify if the model does not contain any
duplicate object.
Requirements are descriptions of customer needs that must be satisfied
during development processes. Requirements are defined in requirements
models.
You can enable links to requirements for all objects in the current model.
When this check box is selected, it implies that the Requirements tab
appears in the objects property sheet. The Requirements page allows you to
attach requirements to objects; these requirements are defined in the
Requirements models open in the workspace. Attached requirements and
Requirements models are synchronized.
For more information on requirements, see the Requirements Model
Users Guide.
Name/Code case
sensitive
Enable links to
requirements
Defining the PDM environment
12 PowerDesigner
Notation
From the Notation groupbox, you can choose to use one of the following
notation types in the current model:
Mode Displays Symbols
Relational* Arrow pointing to
primary key
CODASYL Arrow pointing to
foreign key
Conceptual Cardinality displayed
in IE format (crow's
feet)
IDEF1X Cardinality and
mandatory status
displayed on
reference, primary
columns in separate
containers and
dependent tables with
rounded rectangles.
See below
* This notation is the default notation used in this manual.
When you change notation, all symbols in all diagrams are updated
accordingly. Furthermore, when you switch from Merise to IDEF1X, all
associations are converted to relationships.
Tables display rounded rectangles when they depend on another table
(foreign key columns are also primary keys), and primary identifiers appear
in separate containers:
IDEF1X notation
Chapter 1 Physical Data Model Basics
PDM User's Guide 13
References: Each set of symbols describes a combination of the optionality
and cardinality of the table next to it.
Mandatory Non mandatory
The reference display changes according to its cardinality:
Table and view
From the Table and View page in Model Options, you can choose to ignore
or consider the identifying owner of a table or view. When a table or view is
created, it can be assigned an owner by selecting one from a list of users. The
owner is usually the creator of the table or view.
If the Ignore identifying owner check box is not selected The name
and/or the code, and the owner are identifying properties of the table or view.
A uniqueness check for tables and views is implemented to take into account
the owner. For example, a model can contain Table_1 belonging to User_1
and Table_1 belonging to User_2: both tables have the same name but
different owners. You could also have Table_1 belonging to User_1 and
Table_2 belonging to User_1.
If the Ignore identifying owner check box is selected The name
and/or code become the only identifying properties of the table or view. The
owner is ignored. For example, a model can contain Table_1 belonging to
User_1 and Table_2 belonging to User_1, in this case, the owner is ignored,
and it is impossible to have two tables with the same name and/or code in the
same namespace.
From the Table and View page in Model Options, you can select the option
which automatically rebuilds triggers implementing referential integrity
constraints.
Ignore identifying
owner
Rebuild
automatically
triggers
Defining the PDM environment
14 PowerDesigner
Note: If this option is not selected, you must rebuild triggers by selecting
ToolsRebuild ObjectsRebuild Triggers.
The Rebuild automatically triggers option ensures that triggers are always up-
to-date.
When you change the implementation of a reference The trigger is
rebuilt on the child and parent tables of the reference.
When you change the referential integrity rules of a reference
implemented by a trigger The trigger is rebuilt on the child and parent
tables of the reference.
When you change the child or parent table of a reference
implemented by a trigger The trigger is rebuilt on the new and old child
or parent tables of the reference.
When you create or delete a reference implemented by a trigger
The trigger is rebuilt on the child and parent tables of the reference.
Column and domain
From the Column and Domain page in Model Options, you can choose to
enforce non-divergence between a domain definition and the columns using
the domain, for the following column properties:
Property Columns in the domain cannot have divergent
Data type Data type, length, and precision
Check Check parameters
Rules Business rules
Mandatory Mandatory property of the column
Profile Test data profile
In this mode, the selected column properties must be consistent with the
domain properties.
When you apply the Enforce non-divergence options You are asked
if you want to apply domain properties to columns attached to the domain in
the current model.
Enforce non-
divergence
selected
Chapter 1 Physical Data Model Basics
PDM User's Guide 15
If you accept to apply domain properties, the column properties are
modified in order to be consistent with domain properties. However, if
the check parameters, business rules and mandatory properties of a
column are more constrained than those of the domain, these properties
will not be modified. You may indeed need to define a shorter range of
values in the column check parameters, or set a column as mandatory
while the domain is not
If you refuse to apply domain properties, the column is detached from
the domain
When you modify the properties of a domain The properties of the
columns attached to the domain are updated provided these properties are
selected in the Model Options dialog box.
Columns cannot be modified When you select a column property under
Enforce non-divergence, each instance of that column property in the List of
Columns and the Columns property sheet appears grayed and can not be
modified.
If you want to modify a column property that is defined as non-divergent, you
must detach the column from its domain, or clear the Enforce non-divergence
check box in Model Options.
In this mode, it is still possible to select column properties under Enforce
non-divergence.
If you select one or more of the column properties When you modify
a column property so that it diverges from its current domain definition, you
are asked if you want to keep the modifications and diverge from the domain.
If you do not select column properties When you modify a column or
domain property resulting in a divergence, you are not warned, and you can
no longer cascade the change on the column properties.
From the Column and Domain panel in Model Options, you can set the
default data type.
The default data type is the data type that applies to columns and domains if
no data type is selected.
Enforce non-
divergence cleared
Default data type
Defining the PDM environment
16 PowerDesigner
Reference
From the Reference page in Model Options, you can select the following
model options for references in your PDM:
Option Result
Unique code Requires that references have unique codes
Auto-reuse
columns
An existing column in child table is used as the matching
foreign key column when both of the following conditions
apply:
Child column has same code as migrating primary key
column
Child column is not already a foreign key column
Auto-migrate
columns
Primary key columns are automatically migrated to a child
table as foreign key columns at reference creation. You can
also choose to migrate any of the following column
properties: Domain, Check (Check parameters), Rules
(Business rules)
Domain At reference creation, if Auto-migrate columns and Domain
are selected, the domain on the PK is migrated to the FK.
During intermodel generation, whatever the state of the Auto-
migrate columns check box, if Domain is selected, the
domain on the PK is migrated to the FK
Check At reference creation, if Auto -migrate columns and Check
are selected, the check parameters on the PK are migrated to
the FK. During intermodel generation, whatever the state of
the Auto-migrate columns check box, if Check is selected, the
check parameters on the PK are migrated to the FK
Rules At reference creation, if Auto-migrate columns and Rules are
selected, the business rules on the PK are migrated to the FK.
During intermodel generation, whatever the state of the Auto-
migrate columns check box, if Rules is selected, the business
rules on the PK are migrated to the FK
Propagate
column
properties
When you modify the name, the code or the data type of a
parent table column that belongs to a reference join, you can
use this option to propagate the change on the corresponding
foreign key column
Default link on
creation: Primary
key
Reference links Primary key columns to foreign key columns
at creation
Default link on
creation: User-
defined
Reference not linked. No joins are created
Chapter 1 Physical Data Model Basics
PDM User's Guide 17
Option Result
Default
implementation
Indicates how referential integrity is implemented in the
reference. You can choose Declarative if you wish to define
referential integrity for particular references, or you can
choose Trigger if you want referential integrity to be
implemented by triggers
For more information on referential integrity implementation, see
section Using referential integrity in chapter Building Physical Diagrams.
At reference creation and during intermodel generation, when the Enforce
non-divergence and the Domain check boxes are selected, the following
effects occur after intermodel generation:
Column/Domain Divergence Effect on intermodel generation
If the column and domain are
divergent in the source model
Divergence is preserved after intermodel
generation
If the column and domain are not
divergent in the source model
Domain properties are migrated
For more information on the Auto-reuse and Auto-migrate options, see
chapter Building Physical Diagrams.
PDM extended dependencies
Extended dependencies are links between PDM objects. These links help to
make object relationships clearer but are not interpreted and checked by
PowerDesigner as they are meant to be used for documentation purposes
only.
You can complement these links by applying stereotypes. Stereotypes are
used to define extended dependencies between objects in the PDM.
You can type stereotypes directly in the Stereotype column of the object
property sheet or select a value from the dropdown listbox if you have
previously defined stereotypes in an embedded or imported extended model
definition (.XEM).
For more information on extended model definitions, see chapter
Extended Model Definitions Reference Guide in the Advanced User
Documentation.
Enforce selected
Defining the PDM environment
18 PowerDesigner
PDM database properties
You can define a database for a PDM.
For more information on creating a database, see the section Creating a
database.
A database definition includes the following properties:
Property Description
Name Name for the database
Code Code for the database. This code is generated in database scripts
Comment Descriptive label for the database
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
DBMS DBMS for the database
Options Physical options available in the DBMS
Script Begin and end scripts that are inserted at the start and end of a
database creation script
Rules Business rules for the database
Chapter 1 Physical Data Model Basics
PDM User's Guide 19
Defining a PDM
You can create a new PDM, or open an existing PDM. You can also set
options to define how your model is created or modified, and the type of
information that it displays.
PDM properties
The Model property sheet displays the definition of the current model. From
this property sheet you can modify the model definition.
A PDM has the following model properties:
Property Description
Name Name for the model
Code Code for the model. This code is generated in database scripts
Comment Descriptive label for the model
File name Location of the model file. This box is empty if the model has never
been saved
Author Author of the model. You can insert a name, a space, or nothing.
If you insert a space, the Author field in the title box remains
empty.
If you intentionally leave the box empty, the Author field in the
title box displays the user name from the Version Info page of
the model property sheet
Version 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 display preferences (Title node)
DBMS Current DBMS for the model. You can open the property sheet for
the DBMS by clicking the Properties tool at the end of the box
Database Database name for the model. You can define and select databases
with new physical properties. If you click the Create tool beside the
Database box, a confirmation box asks you to commit object
creation, and the database property sheet appears. You can define
the properties of the new database and click OK
Default
diagram
Diagram displayed by default when you open the model
Defining a PDM
20 PowerDesigner
Models for DB2
The Database box does not appear in the models targeted for the DB2
family as these models support multiple databases in a single model. For
more information, see section Multiple databases in a model in chapter
DBMS-specific Features.
To modify PDM properties:
1 Select ModelModel Properties.
or
Right click the diagram background and select Properties from the
contextual menu.
The model property sheet appears.
2 Type changes to model properties.
3 Click OK.
Creating a PDM
There are several ways to create a PDM:
Create a new PDM
Create a new PDM using a template
Chapter 1 Physical Data Model Basics
PDM User's Guide 21
Create an PDM using existing elements (reverse engineering a database,
importing an ERwin model (.erx), generating from a CDM or OOM,
open a version 6 warehouse architect model, etc.
Creating a PDM using the New model option
When you create a new PDM using the New model option, you have to
define the following:
Select a DBMS
Select a diagram type
In PowerDesigner, the current DBMS is a text file in XML format that
contains all the SQL syntax and specifications for an actual Database
Management System.
PowerDesigner has a DBMS definition for each supported database. These
DBMS definition files are stored in the DBMS Library directory in the
PowerDesigner path. Each DBMS definition file has the extension .XDB
which signifies XML Database File. You can customize your DBMS
definition.
For more information on customizing your DBMS definition, see
chapter DBMS Reference Guide in the Advanced User Documentation.
When you create a PDM, you can connect to a DBMS in one of the following
ways:
DBMS Description
Share Current DBMS for the PDM constantly refers to the DBMS
definition file stored in the DBMS library. Any modifications made
to the DBMS are shared by the PDM
Copy Current DBMS for the PDM is a unique copy of the DBMS
definition file stored in the DBMS library. The current DBMS is
independent of the original DBMS definition file so modifications
made to the DBMS definition file in the DBMS library are not
available to the PDM. The copied DBMS definition is saved with the
PDM and can not be used without it
You also have to select the type of the first diagram in the new model. The
First Diagram dropdown listbox lets you select one of the following
diagrams:
Physical diagram to define the actual physical structure of the database
DBMS selection
Diagram selection
Defining a PDM
22 PowerDesigner
Multidimensional diagram to define the multidimensional structure of
the database
The first type of diagram selected remains in memory: the next time you
create a new model, the same type of diagram will appear in the First
Diagram dropdown listbox.
To create a new PDM using the New model option:
1 Select FileNew to display the New dialog box.
2 Select Physical Data Model in the list of model types.
3 Select the New model radio button in the upper right part of the dialog
box.
4 Select a DBMS from the DBMS dropdown listbox of the General page.
5 Select either Share or Copy.
6 Select the type of the first diagram in the First diagram dropdown
listbox.
7 <optional> If you want to attach one or more extended model definitions
to the model, click the Extended Model Definition tab, and select the
extended model definitions of your choice.
For more information on attaching extended model definitions to a
model, see section PDM extended model definitions.
8 Click OK.
A new PDM is created in the Workspace.
Chapter 1 Physical Data Model Basics
PDM User's Guide 23
9 Select ModelModel Properties.
or
Right-click any empty space in the diagram window and select
Properties from the contextual menu.
The model property sheet appears.
10 Type a model name and model code.
11 Click OK.
Demo example
Demo models are available in the Examples directory.
Creating a PDM using the New model from template option
To create a new PDM using the New model from template option:
1 Select FileNew to display the New dialog box.
2 Select Physical Data Model in the list of model types.
3 Select the New model from template radio button in the upper right part
of the dialog box to display the Template page.
4 Select a model template from the list.
Defining a PDM
24 PowerDesigner
List of templates
You can select user-defined model templates (use the Change User-
Defined Model Templates Folder tool to specify the user templates
folder) and copy some existing models as model templates using the
Copy Model to User-Defined Model Templates Folder tool.
For more information on model templates, see section Creating a
model in chapter Managing Models, in the General Features Guide.
5 Click OK.
A new PDM is created in the Workspace.
6 Select ModelModel Properties.
or
Right-click any empty space in the diagram window and select
Properties from the contextual menu.
The model property sheet appears.
7 Type a model name and model code.
8 Click OK.
Opening an existing PDM
A Physical Data Model has the file extension .PDM.
If PowerDesigner cannot find the DBMS attached to the Physical Data Model
you want to open, the Choose DBMS dialog box appears to let you select
another DBMS to attach to the model. You can select the DBMS from the
DBMS dropdown listbox.
To open an existing PDM:
1 Select FileOpen to display a standard open file dialog box.
2 Select a file with the .PDM extension.
3 Click Open.
The model appears in the Browser and diagram opens in the diagram
window.
Choose DBMS
Chapter 1 Physical Data Model Basics
PDM User's Guide 25
Detaching a PDM from the workspace
You can detach a PDM from a workspace. When a PDM is detached from a
Workspace its node is removed from the Browser and it is no longer defined
in the workspace, but the file is not deleted from your operating environment.
To detach a PDM from a workspace:
1 Right-click the PDM node in the Browser and select Detach From
Workspace from the contextual menu.
A confirmation box asks if you want to save the PDM.
2 Click Yes if you want to save modifications to the PDM.
Select or browse to a directory.
Type a name for the file and click the Save button.
or
Click No if you do not want to save modifications to the file.
The PDM is removed from the workspace.
Saving and closing a PDM
You save a PDM by selecting FileSave.
You close a PDM by selecting FileClose.
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
To archive a PDM:
Select FileSave As, select Archived PDM (bin) or Archived PDM
(xml) in the Save As Type dropdown listbox, and click Save.
or
Defining a PDM
26 PowerDesigner
Select DatabaseGenerate Database, click the Options tab, select the
Automatic Archive check box in the After Generation groupbox, and
click OK.
Creating a database
You can create a database for the model from the model property sheet.
To create a database:
1 Select ModelModel Properties to display the model property sheet
appears.
2 Click the Create tool beside the Database box.
A confirmation box appears asking you to commit the creation of the
object.
3 Click Yes.
The database property sheet appears.
4 Type a name and code for the database.
5 Type a description in the Comment box.
Chapter 1 Physical Data Model Basics
PDM User's Guide 27
6 Click the Options tab to display the Options page listing the physical
options available for the DBMS.
7 Select and enter values for database options.
For more information on defining physical options, see section
Defining physical options for a PDM in chapter Building Physical
Diagrams.
8 Select other property tabs and enter appropriate database properties.
9 Click OK in each of the dialog boxes.
Defining Packages in a PDM
28 PowerDesigner
Defining Packages in a PDM
A package is a piece of a model.
When working with a large model, you can split the model into smaller
subdivisions to avoid manipulating the entire set of model objects. Packages
can be useful to assign portions of a model, representing different tasks and
subject areas, to different development teams.
You can create several packages at the same hierarchical level within a model
or decompose a package into other packages and continue this process
without limitation in decomposition depth. Each package appears with a
default diagram window. At each level of decomposition you can create
several diagrams.
For more information on packages, see the section Defining a package
in the General Features Guide.
You can expand a package to have a global view of the whole diagram
content.
To do so, you have to right-click a package and select Composite View from
the contextual menu. You must resize the composite package symbol to
visualize its content:
Package hierarchy
Composite view
Chapter 1 Physical Data Model Basics
PDM User's Guide 29
To return to the package normal view, re-select the Composite View
command in the contextual menu of the expanded package.
Note that if you double-click the composite view, you automatically open the
sub-package diagram.
For more information on the composite view feature, see section
Expanding the symbol of a composite object in chapter Model Graphics in
the General Features Guide.
PDM package properties
Packages have properties displayed on property sheets. All packages share
the following common properties:
Property Description
Name Name that clearly identifies the package
Code Codes are references for packages
Comment Optional label that describes a package and provides additional
information
Stereotype Sub-classification used to extend the semantics of an object without
changing its structure; it can be predefined or user-defined
Default
diagram
Diagram displayed by default when you open the package
Use parent
namespace
Defines the package as being the area in which the name of an
object must be unique in order to be used
Modifying package display preferences
You can modify the following display preference for packages using the
ToolsDisplay Preferences command:
Preference Description
Show stereotype Displays the stereotype of the package
Using SQL tools
30 PowerDesigner
Using SQL tools
Generating a PDM produces SQL code for your target DBMS.
PowerDesigner provides tools to change and preview SQL code during PDM
development. These tools are:
The SQL editor
The SQL preview
The SQL editor allows you to define queries and the SQL preview allows you
to see a SQL query script before it is generated.
Defining queries with the SQL Editor
You can use the editing features of the SQL Editor to define a query. The
SQL Editor dialog box is divided into specific panes containing the
information shown below:
Information Pane location
Objects types Upper left part of the dialog box
Available objects Upper right part of the dialog box
Query script textbox Lower part of the dialog box
The list of available objects depends on the selected object type. You can
select individual objects from the list of available objects for insertion in the
query script textbox.
You can also define expressions by entering basic arithmetic operators such
as add, subtract, multiply, divide (+, -, *, /) and with the syntax tools shown
below:
Syntax tool Content
Functions Provides group, number, string, date, conversion and other
functions
Operators Provides logical operators
Variables Provides variables for use with operators and functions
Macros Provides macros to accelerate the creation of a template item
definition
These syntax tools allow greater flexibility in defining complex expressions.
Chapter 1 Physical Data Model Basics
PDM User's Guide 31
The SQL Editor can be used for the following tasks:
Defining a query for a view, a procedure, a trigger
Defining a computed column
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.
To define a query with the SQL Editor:
1 Click the query script textbox where you want to insert the SQL script.
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 appears 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 dropdown listboxes.
The item is added to the query script.
5 Click OK.
Using SQL tools
32 PowerDesigner
Previewing SQL statements
The Preview page shows an SQL query script before it is generated. The
displayed script reflects the options selected in the Database Generation
dialog box. This script cannot be modified.
For more information on database generation options, see chapter
Database Creation and Modification.
The text in the script preview is color coded as follows:
Text color Represents
Blue SQL reserved word
Black Statement body
Red Variable
Green Comment
You can use the following tools and accelerators from the Preview toolbar:
Tool Description Accelerator
Editor contextual menu SHIFT + F11
Refresh F5
This tool is available when at least one
extended model definition flagged for
generation is linked to the model and
when it contains GeneratedFiles entries
for the current object. When available, it
displays the list of targets for the current
object. If you add a generation target, the
corresponding tab is added to the Preview
page. If you deselect a generation target,
the corresponding tab disappears from the
Preview page
CTRL + F6
Show generation options CTRL + W
Ignore generation options CTRL + D
Chapter 1 Physical Data Model Basics
PDM User's Guide 33
For more information on extended model definitions used for
generation, see chapter Extended Model Definitions Reference Guide in the
Advanced User documentation.
If you click the Change Generation Options tool, the Generation Options
dialog box appears. You can change generation options and preview their
effect on the code.
If you click the Ignore Generation Options tool, the preview ignores
generation options selected by using the Change generation options tool but
uses a predefined set of options.
Selected tool
Effect on generation
options Effect on preview
Change generation options You can select
generation options
Visible in Preview if
options are applicable
Ignore generation options Generation options
currently selected are
overridden by
predefined set of
options
Only predefined
options are visible in
Preview
Change generation options +
Ignore generation options
You can select
generation options
Changes ignored in
Preview
The predefined set of generation options selects these items:
Generation Option Tab Selected items
Tables and Views All items except drop options
Keys and Indexes All items except options represented differently in
some DBMS. For example, if a database is auto
indexed, the index options corresponding to the
keys are not selected
Database All items except drop options
Options All user-defined options are used
Changing
generation options
Ignore generation
options
Using SQL tools
34 PowerDesigner
In the SQL Editor or SQL Preview page, you can add and remove bookmarks
at specific points in the SQL script and then navigate forwards or backwards
from bookmark to bookmark:
Accelerator Description
CTRL + F2 Adds a new bookmark. A blue bookmark box appears. If you
repeat this action from the same position, the bookmark is
deleted and the blue marker disappears
F2
Jumps to next bookmark
SHIFT + F2
Jumps to the previous bookmark
Note that bookmarks are not printable and are lost if you use the Refresh,
Change Generation or Ignore Generation options.
To preview the code of a table:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Preview tab to display the Preview page.
3 Click OK.
SQL script
bookmarks
PDM User's Guide 35
C H A P T E R 2
Using Business Rules in a PDM
This chapter describes how business rules help you model information.
Topic Page
What is a business rule in a PDM? 36
Defining business rules in a PDM 37
Using business rules in a PDM 45
About this chapter
Contents
What is a business rule in a PDM?
36 PowerDesigner
What is a business rule in a PDM?
A business rule is a rule that your business follows. This can be a
government-imposed law, a customer requirement, or an internal guideline.
Business rules often start as simple observations. For example, customers
call toll-free numbers to place orders. During the design process they
develop into more detailed expressions. For example, what information a
customer supplies when placing an order or how much a customer can spend
based on a credit limit.
Business rules guide and document the creation of a model. For example, the
rule "an employee belongs to only one division" can help you graphically
build the link between an employee and a division.
Business rules complement model graphics with information that is not easily
represented graphically. For example, some rules specify physical concerns
in the form of formulas and validation rules. These technical expressions do
not have a graphical representation.
During intermodel generation the business rules transfer directly into the
generated model where you can further specify them.
You can attach business rules to objects in a PDM. You can generate
business validation rules as check parameters if the validation rules are
attached to columns or domains.
For more information on defining and using check parameters, see
section Defining check parameters in a PDM in chapter Building Physical
Diagrams.
Starts as an
observation
Guides modeling
Complements
graphics
Intermodel
generation
Check parameters
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 37
Defining business rules in a PDM
You can define a business rule which can be attached to an object in the
PDM.
Business rule properties in a PDM
A business rule definition includes the following properties:
Property Description
Name Name for the rule
Code Reference name for the rule
Comment Descriptive label for the rule
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Type Indicates if the rule is a definition, a fact, a formula, a
requirement or a validation
A business rule definition also includes the following properties, each with
their respective page:
Property Description
Expression Presence of associated expression
Notes Presence of associated notes
Types of business rules in a PDM
In PowerDesigner, you can define several different types of business rules.
Only the validation rule type can be generated to a database.
The different business rule types that you can define in a PDM are described
below:
Rule type Describes Example
Definition Characteristics or properties
of an object in the
information system
A customer is a person identified
by a name and an address
Types of business
rules
Defining business rules in a PDM
38 PowerDesigner
Rule type Describes Example
Fact Certainty or existence in the
information system
A client places one or more
orders
Formula Calculation used by the
information system
The total order is the sum of all
the order line costs
Requirement Functional specification in
the information system
The model is designed so that
total losses do not exceed 10% of
total sales
Validation Constraint on a value in the
information system.
Validation business rules are
generated in the database
The sum of all order totals for a
client must not be greater than
the allowance for the client
Constraint Additional check constraint
on a value. You can assign
multiple constraint business
rules to a table or a column.
Constraint business rules are
generated in the database
The start date should be inferior
to the end date of a project
For more information on constraint business rules, see section Using
constraint business rules in a PDM.
Creating a business rule in a PDM
Before you create business rules, formulate your rules by asking yourself the
following questions:
What business problems do I want to address?
Are there any mandatory procedures for my system?
Do any specifications set the scope of my project?
Do any constraints limit my options?
How do I describe each of these procedures, specifications, and
constraints?
How do I classify these descriptions: as definitions, facts, formulas, or
validation rules?
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 39
To create a business rule in a PDM:
1 Select ModelBusiness Rules to display the List of Business Rules
showing any business rules currently defined for the model.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a name and a code for the business rule.
4 Click Apply to commit the creation of the new business rule.
5 Double-click the new business rule line to display the business rule
property sheet.
6 Select a business rule type from the Type dropdown list box.
7 Click OK.
Attaching an expression to a business rule in a PDM
A business rule typically starts out as a description. As you develop your
model and analyze your business problem, you can complete a rule by adding
a technical expression. The syntax of expressions depends on the target
database.
Defining business rules in a PDM
40 PowerDesigner
Each business rule can include two types of expression:
Server
Client
Only the server expression can be generated to a database. You can generate
server expressions as check parameters if they are attached to tables,
domains, or columns.
A client expression is used mainly for documentation purposes. However,
you can insert both types of expression into a trigger or a stored procedure.
To attach an expression to a business rule in a PDM:
1 Select ModelBusiness Rules to display the List of Business Rules.
2 Double-click the new business rule line to display the business rule
property sheet.
3 Click the Expression tab to display the Expression page.
4 Click the Server tab at the bottom of the page to define a server
expression.
or
Click the Client tab at the bottom of the page to define a client
expression.
5 Type an expression in the Expression textbox.
6 Click OK in each of the dialog boxes.
Using constraint business rules in a PDM
A constraint business rule is used to manage multiple constraints on tables
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 section
Naming a table constraint in chapter Building physical diagrams.
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 41
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 chapter DBMS Reference
Guide in the Advanced User Documentation.
Let's consider the table Project:
The following checks are defined for this table:
Check Description
Check parameter (in the
Check page of the table)
This check verifies that the customer number is
different from the employee number
Validation business rule PROJ_NUM to check that the column project number
is not null
EMP_NUM to check that the employee number is not
null
Constraint business rule DATE_CONSTY to check that the start date of the
project is inferior to the end date of the project
Example
Defining business rules in a PDM
42 PowerDesigner
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 appears as a different
constraint in the script.
Creating a constraint business rule
To create a constraint business rule in a PDM:
1 Select ModelBusiness Rules to display the List of Business Rules
showing any business rules currently defined for the model.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a name and a code for the business rule.
4 Click Apply to commit the creation of the new business rule.
5 Double-click the new business rule line to display the business rule
property sheet.
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 43
6 Select a business rule type from the Type dropdown list box.
7 Click the Expression tab to display the Expression page of the business
rule.
8 Type an expression in the Server page.
9 Click OK.
Defining business rules in a PDM
44 PowerDesigner
For more information on applying a constraint business rule to a table
or a column, see section Applying a constraint business rule to a table or a
column.
Generating a constraint business rule
Depending on the type of DBMS, the following is generated regarding check
constraints:
Database type Generation result
Database does not support
any check constraints
No constraint is generated
Database does not support
multiple check constraints
Constraint business rules, check parameters, and
validation business rules are concatenated into a
single constraint expression
Database supports
multiple check constraints
First, the check parameters and validation business
rules are generated into a single constraint, then the
constraint business rules are generated into different
constraints. Constraints are thus ordered
Reverse engineering a constraint business rule
During reverse engineering, the constraint order is taken into account:
The first constraint is retrieved as check parameters (in the Check page
of the table property sheet)
Each constraint following the initial constraint is retrieved as a constraint
business rule
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 45
Using business rules in a PDM
There are three ways to use business rules in a PDM:
You can apply a business rule to an object in the PDM
You can create a server expression for a business rule which can be
generated to a database
A business rule expression can also be inserted in a trigger or stored
procedure
For more information on triggers, see the chapter Triggers and
Procedures.
Applying a business rule to the current object in a PDM
You can apply a business rule to the current object from its property sheet.
To apply a business rule to the current object in a PDM:
1 Double-click an object in the diagram to display the object property
sheet.
2 Click the Rules tab to display the Rules page showing any business rules
attached to the object.
3 Click the Add Objects tool to display the list of business rules.
4 Select one or more business rules.
Using business rules in a PDM
46 PowerDesigner
5 Click OK.
The business rules are added to the object and appear in the list of
business rules for the object.
6 Click OK.
U Column in the List of business rules
When you apply a business rule to an object, the U (Used) column
beside this business rule is automatically checked in the List of
business rules to indicate that the business rule is used by at least one
object in the model. The U column allows you to visualize unused
business rules, you can then delete them if necessary.
Applying a constraint business rule to a table or a column
You can attach a constraint business rule to a table or a column, however you
cannot reuse a constraint business rule between different objects, so you must
create as many constraint business rules 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 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 chapter DBMS Reference
Guide in the Advanced User Documentation.
To attach a constraint business rule to an object:
1 Open the object property sheet.
2 Click the Rules tab to display the Rules page.
3 Click the Add Objects tool.
4 Select a constraint business rule from the selection list and click OK.
Chapter 2 Using Business Rules in a PDM
PDM User's Guide 47
The business rule appears in the list of business rules attached to the
current object.
5 Click Apply.
6 Click the Preview tab if you are working on a table to verify that
different constraints have been created in the script.
7 Click OK.
Using business rules in a PDM
48 PowerDesigner
PDM User's Guide 49
C H A P T E R 3
Building Physical Diagrams
This chapter describes how to build a physical diagram in a Physical Data
Model. It explains the role of each object in a physical diagram. It also shows
how to modify objects in a physical diagram.
Topic Page
Physical diagram basics 50
Defining tables in a physical diagram 51
Defining domains in a PDM 61
Defining defaults in a PDM 73
Using abstract data types in a physical diagram 77
Defining columns in a physical diagram 92
Defining keys in a physical diagram 111
Defining references in a physical diagram 122
Defining indexes in a physical diagram 148
Defining views in a physical diagram 161
Defining view references in a physical diagram 184
Defining query tables in a physical diagram 191
Defining check parameters in a PDM 195
Defining physical options for a PDM 202
About this chapter
Contents
Physical diagram basics
50 PowerDesigner
Physical diagram basics
You can create physical diagrams in a PDM.
Defining a physical diagram
A physical diagram allows you to define the database structure, from the
physical implementation point of view. It takes into account the physical
resources: DBMS, data storage structures and software, to describe the
structure of the database.
Why build a physical diagram?
You build a physical diagram at the end of the data analysis process, before
you start the software programming. The physical diagram allows you to
define how data from conceptual model are implemented in the database.
For more information on how to use diagrams in the PDM, see section
What is a PDM? in chapter Physical Data Model Basics.
Creating a physical diagram
You can create a physical diagram using different methods.
For more information on creating a physical diagram in a new PDM, see
section Creating a PDM, in chapter Physical Data Model Basics
For more information on creating a physical diagram in an existing
PDM, see section Creating a new diagram in the General Features Guide
Chapter 3 Building Physical Diagrams
PDM User's Guide 51
Defining tables in a physical diagram
A table represents a collection of data arranged in columns and rows. It is the
model equivalent of a database table.
From the property sheet of a table, you can access the following information
about the table:
Columns are named properties of a table that describe its characteristics.
See section Defining columns in a physical diagram.
Indexes are data structures associated with a table that are logically
ordered by key values. See section Defining indexes in a physical
diagram.
Keys are columns, or combinations of columns, that uniquely identify
rows in a table. Each key can generate a unique index or a unique
constraint in a target database. See section Defining keys in a physical
diagram.
Triggers are segments of SQL code associated with tables, and stored in
a database. They are invoked automatically whenever there is an attempt
to modify data in associated tables. See section Trigger overview in
chapter Triggers and Procedures.
Options are values used in some databases to specify physical
parameters for tables, indexes, tablespaces, storages, primary keys, and
alternate keys. See section Defining physical options.
Preview allows you to see the SQL code of a table that will be used for
its generation. See section Previewing SQL statements in chapter
Physical Data Model Basics.
Table properties
You can double-click any table symbol in a diagram to display its properties:
Property Description
Name Name for the table. This name improves the readability of the
model
Code Reference code for the table. This code is generated in database
scripts
Defining tables in a physical diagram
52 PowerDesigner
Property Description
Comment Descriptive label for the table
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of 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
Number Estimated number of occurrences in the physical database for
the table (the number of records). This number is used to
estimate database size. The Number box is automatically filled
with the actual number of records if you select the check box
Retrieve Number of Rows in Tables in the Options page of the
Database Reverse Engineering dialog box
Generate Indicates to generate the table in the database
Dimensional
type
Indicates the multidimensional type of the table, that is
Dimension or Fact
A table definition also includes the following properties:
Property Description
Check Table constraint that enforces data requirements of check
parameters.
Script Begin and end scripts for table creation
Preview SQL code for table
Options Physical options for the table. These are DBMS specific
Version Info Table owner, version number, modification and creation details
Notes Description associated with table
A table definition also includes the following properties, each with their own
respective property sheet that can be accessed independently of the table.
Columns
Indexes
Keys
Triggers
Business rules
Chapter 3 Building Physical Diagrams
PDM User's Guide 53
Some DBMS like Oracle or DB2 Common Server support tables based on
abstract data types (ADT). A table based on an ADT uses the properties of
the ADT and the ADT attributes become table columns.
To link a table to an ADT you have to use the Based On dropdown listbox to
select an abstract data type. Not all ADT can be used, only ADT of type
Object in Oracle, or Structured in DB2 Common Server appear in the Based
On list.
For more information on abstract data types, see section Using abstract
data types in a physical diagram.
Creating a table
There are several ways to create a table:
From a diagram
From the Browser
From the list of tables
At creation, a table has a default name including a number, this number is
assigned in the order of creation of objects.
Table based on
abstract data type
Defining tables in a physical diagram
54 PowerDesigner
For more information on the different ways to create a table, see section
Creating an object in chapter Managing objects in the General Features
Guide.
To create a table from a diagram:
1 Click the Table tool.
2 Click an empty space in the diagram to display the following symbol at
the click position:
3 Click the Pointer tool.
4 Double-click the new table symbol in the diagram to display the table
property sheet.
5 Type a table name and a table code.
6 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 55
Modifying table properties
You can modify the table properties using the following methods:
From the table property sheet
From the list of tables
For more information on the different ways to modify a table, see
section Modifying object properties in chapter Managing objects in the
General Features Guide.
Arranging items in a list attached to a table
Each table has its own list for each of the following table properties:
Columns
Indexes
Keys
Triggers & procedures
Business rules
Each list is specific to a particular table. You can arrange the list items in any
order. This order becomes the order of generation in a database.
The following buttons change the position of selected items in the list.
Button Moves selected items
To top of list
Up one page
Up one line
Down one line
Down one page
Bottom of list
Defining tables in a physical diagram
56 PowerDesigner
To arrange items in a list attached to a table:
1 Double-click a table symbol to display the table property sheet.
2 Click a tab for a table property to display the property page listing all
instances of the property for the table.
3 Select one or more items in the list.
4 Use the arrow buttons to move the items in the list.
5 Click OK.
Naming a table constraint
A table constraint is a named check that enforces data requirements of check
parameters.
Whenever you place a data restriction on a table, a constraint is created
automatically. You have the option of specifying a name for the constraint. If
you do not, the database creates a default constraint name automatically.
This name helps you to identify and customize a table constraint in scripts for
database creation and modification.
To name a table constraint:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Check tab to display the Check page listing all check
parameters defined for the table.
3 Click the User Defined button at the end of the Constraint Name box.
4 Type changes to the constraint name in the Constraint Name box.
Undo changes to a constraint name
You can always return to the default constraint name by re-clicking
the User-Defined button.
5 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 57
Modifying the table display preferences
You can modify the following display preferences for a table using the
ToolsDisplay Preferences command:
Text display
preference When selected, what it displays
Columns All columns, primary key columns, or a defined number (limit) of
columns depending on the selections listed below*
*All columns All table columns
*PK columns Primary key columns only
*Key columns All key columns
*Limit (x) Number of columns depending on defined value of x
Indexes All indexes defined for table columns
Keys All keys defined on table
Triggers All triggers defined for table
Owner Name of table owner
Stereotype Stereotype of the table. You can also display the stereotype of
columns, keys, indexes, and triggers
Table display
Defining tables in a physical diagram
58 PowerDesigner
You can display information about columns in each table.
Keys and indexes are represented by indicators in the table symbol. Each key
and index indicator is assigned a number. You can use these numbers to keep
track of the different groups of alternate keys, foreign keys, and indexes in
your model.
You can display the following column information in a table symbol:
Text display
preference When selected, it displays Example
Data types Data type for each column
Replace by
domains
Domain codes for each column
attached to a domain
Domains Domain of an attribute in the table.
This display option interacts with the
selection for Data types. As a result,
there are four display options
See Display domain and
data type for options and
examples
Key
Indicators
<pk>, <fk>, and <ak> indicators next
to primary key, foreign key, and
alternate key columns respectively.
When the Keys preference is also
selected, the key names are listed at
the bottom of the table symbol
Index
indicators
<i(number)> indicator next to
indexed columns. When the Indexes
preference is also selected, the index
names and corresponding numbers
are listed at the bottom of the table
symbol
Table Columns
display
Chapter 3 Building Physical Diagrams
PDM User's Guide 59
Text display
preference When selected, it displays Example
NULL/NOT
NULL
Column indicator: null, not null,
identity, or with default (DBMS-
dependent)
Displaying foreign key indicator numbers
You can display foreign key numbers next to their corresponding foreign
key names on the references links between the appropriate parent and
child tables.
For information on displaying text with a reference symbol, see section
Modifying the reference display preferences.
You can display the domain of an attribute in the symbol of a table. There are
four display options available:
Selected check
box Result Symbol
Data types Displays only the data
type, if it exists
Domains Displays only the
domain, if it exists
Data types
Domains
Displays both data
type and domain, if
they exist
Data types
Replace by domains
If domain exists and
data type does not
exist, then displays
domain.
If domain does not
exist and data type
exists, then displays
data type.
Display domain
and data type
Defining tables in a physical diagram
60 PowerDesigner
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.
You can select a notation for tables from the Notation dropdown listbox in
the Model Options dialog box. The available modes are: relational,
CODASYL, conceptual and IDEF1X.
For more information on notations, see section PDM options, in chapter
Physical Data Model Basics.
Table notation
Chapter 3 Building Physical Diagrams
PDM User's Guide 61
Defining domains in a PDM
Domains help you identify the types of information in your model. They
define the set of values for which a column is valid. Applying domains to
columns makes it easier to standardize data characteristics for columns in
different tables.
In a Physical diagram, you can associate the following information with a
domain:
Data type, length, and precision
Check parameters
Business rules
Mandatory property
Domain properties in a PDM
Each domain definition includes the following properties:
Property Description
Name Name for the domain
Code Reference name for the domain
Comment Descriptive label for the domain
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of domain owner. You choose an owner from a list of
users. A domain can only have one owner at a time. This is
normally the domain creator
Data type Form of the data corresponding to the domain, such as numeric,
alphanumeric, Boolean, or others
Length Maximum number of characters
Precision Number of places after the decimal point, for data values that can
take a decimal point
Mandatory Domain values are mandatory for all columns using that domain
Identity (For Adaptive Server Enterprise, MS SQL Server and those
DBMS that support it). When selected, indicates that the data is
auto-incremented for columns using that domain
Defining domains in a PDM
62 PowerDesigner
Property Description
With default (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 Test Data profile assigned to the domain
A domain definition can also include the following properties, which have
associated values or information used by columns attached to the domain:
Property Description
Standard checks Check parameters defined for the domain
Additional checks Domain constraints or validation rules not defined by
standard check parameters
Rules Business rules attached to the domain
Creating a domain in a PDM
You create a domain from the list of domains.
Accessing the List of Domains
You can access the List of Domains from the current model, or by right
clicking the appropriate model node in the Browser, and selecting
NewDomain from the contextual menu.
To create a domain in a PDM:
1 Select ModelDomains to display the list of available domains.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a domain name and a domain code.
4 Click Apply to commit the creation of the new domain.
5 Click the new domain line to display an arrow at the beginning of the
line.
Chapter 3 Building Physical Diagrams
PDM User's Guide 63
6 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new domain appears.
7 Select a data type.
Specify length and precision as required.
Select or clear the Mandatory, Identity, and With Default check boxes.
For information on data types and selecting a data type for a
domain, see sections Indicating data type, length, and precision, and
Selecting a data type for a domain in a PDM.
8 Click OK.
You return to the List of Domains.
9 Click OK.
Indicating data type, length, and precision
The data types that you can select in a Physical diagram depend on your
current DBMS.
The properties length and precision do not apply to all data types. Depending
on data type, length may indicate a maximum or a fixed number of
characters.
Length and
precision
Defining domains in a PDM
64 PowerDesigner
In the list of available data types, a variable indicates where you have to type
a length or precision, as follows:
Variable Replace with
%n Length
%s Length with precision
%p Decimal precision
For example, if you are using Sybase Adaptive Server Anywhere and you
choose the data type char(%n), you can choose a length of ten by typing
char(10).
All target DBMS allow you to select the <undefined> data type. The
<undefined> data type indicates which domains remain without data types. If
an <undefined> data type is present when you generate your database, it is
replaced by the default data type for your database.
Selecting a data type for a domain in a PDM
You can select a data type for a domain in two ways:
Directly from the List of Domains
From the property sheet for the domain
When you select a data type for a domain from its property sheet, you can
choose from a list of standard data types. This list presents the available data
types in full details instead of the abbreviated format used in the data type
dropdown listbox in the list of domains.
Selecting a data type for a domain from the list
To select a data type for a domain from the list:
1 Select ModelDomains to display the List of Domains.
2 Click the domain that you want to define to display an arrow at the
beginning of the line.
3 Click the Data Type column to display a dropdown listbox.
4 Select a data type from the data type dropdown listbox.
Undefined data
type
The list of standard
data types
Chapter 3 Building Physical Diagrams
PDM User's Guide 65
Defining a data type later
If you do not want to select a data type immediately, you can choose
the <Undefined> data type. When you generate the database, this data
type is replaced by the default data type for your target DBMS.
5 Click OK.
Selecting a data type for a domain from its property sheet
To select a data type for a domain from its property sheet:
1 Select ModelDomains to display the List of Domains.
2 Click the domain to define.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The domain property sheet opens to the General page.
4 Select a data type from the Data Type dropdown listbox.
Selecting a data type from a list of standard data types
To select a data type from a list of standard data types, click the
Question Mark button at the end of the Data Type dropdown listbox,
and select the radio button for a data type from the list that appears.
5 Type the maximum number of characters for the data item in the Length
box.
6 If the data type can include values that take a decimal point, type the
number of places after the decimal point in the Precision box.
7 Click OK.
The change of data type appears in the List of Domains.
Undefined data type
If you do not want to select a data type immediately, you can choose
the <Undefined> data type. When you generate the database, this data
type is replaced by the default data type for your target DBMS.
Defining domains in a PDM
66 PowerDesigner
Selecting a data type from a list of standard data types in a PDM
You can select a data type from a list of standard data types. This is the same
list that is available in the Conceptual Data Model. PowerDesigner
automatically maps the standard data type to a physical data type.
The length and precision are properties that do not apply to all data types.
Furthermore, depending on data type, length may indicate a maximum or a
fixed number of characters.
The tables below indicates the data types for which you can specify:
Fixed length
Maximum length
Decimal precision
Conceptual data type Content Length
Mandatory
Precision
Integer 32-bit integer
Short Integer 16-bit integer
Long Integer 32-bit integer
Byte 256 values
Number Numbers with a fixed
decimal point
Fixed

Decimal Numbers with a fixed
decimal point
Fixed

Float 32-bit floating point
numbers
Fixed
Short Float Less than 32-bit point
decimal number

Long Float 64-bit floating point
numbers

Money Numbers with a fixed
decimal point
Fixed

Serial Automatically
incremented numbers
Fixed
Boolean Two opposing values
(true/false; yes/no; 1/0)

Numeric data types
Chapter 3 Building Physical Diagrams
PDM User's Guide 67
Conceptual data type Content Length
Characters Character strings Fixed
Variable Characters Character strings Maximum
Long Characters Character strings Maximum
Long Var Characters Character strings Maximum
Text Character strings Maximum
Multibyte Multibyte character strings Fixed
Variable Multibyte Multibyte character strings Maximum
Conceptual data type Content
Date Day, month, year
Time Hour, minute, and second
Date & Time Date and time
Timestamp System date and time
Conceptual data type Content Length
Binary Binary strings Maximum
Long Binary Binary strings Maximum
Bitmap Images in bitmap format (BMP) Maximum
Image Images Maximum
OLE OLE links Maximum
Other User-defined data type
Undefined Not yet defined data type
To select a data type from a list of standard data types:
1 Select ModelDomains to display the List of Domains.
2 Click the domain to be defined and display an arrow at the beginning of
the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
Character data
types
Time data types
Other data types
Defining domains in a PDM
68 PowerDesigner
The domain property sheet opens to the General page.
4 Click the Question Mark button next to the Data Type dropdown listbox.
Selecting from the Data Type dropdown listbox
You can also select a data type directly from the Data Type dropdown
listbox.
A list of standard data types appears.
5 Click the radio button corresponding to the data type you want to apply.
The code for the data type appears in the Code box.
Undefined data type
If you do not want to select a data type immediately, you can choose
the Undefined data type.
6 Type the maximum number of characters for the data type in the Length
box.
7 If the data type includes values after a decimal point, type the number of
places after the decimal point in the Precision box.
8 Click OK.
The change of data type appears in the Data Type box.
Chapter 3 Building Physical Diagrams
PDM User's Guide 69
Modifying domain properties in a PDM
You can modify domain properties from its property sheet.
When you modify data types associated with a domain, an update
confirmation box appears asking if you want to modify the columns currently
using the domain.
The Data Type check box is selected or not according to the options set to
enforce non-divergence from a domain.
For information on domain divergence, see section Enforcing non-
divergence from a domain in a PDM.
You can also select other properties (Check, Rules, Mandatory, Profile) that
will be updated in their use of the data type.
You can now click one of the buttons with the following effects:
Button Effect
Yes The columns currently using the domain are modified according to
the update
No The columns currently using the domain are not modified
according to the update but the current modification is accepted if
domain divergence is allowed in the model options
Cancel The update is cancelled and nothing is changed
To modify domain properties in a PDM:
1 Select ModelDomains to display the List of Domains.
2 Click a domain from the list to display an arrow at the beginning of the
line.
Defining domains in a PDM
70 PowerDesigner
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The domain property sheet appears.
Accessing a property sheet from the Browser
To access a domain property sheet, double-click the appropriate
domain node in the Browser.
4 Type changes to domain properties.
or
Click on a page tab.
Type or select domain properties as required.
5 Click OK.
If the domain is used by one or more columns, an update confirmation
box appears asking if you want to modify domain properties for the
columns using the domain.
6 Select the properties that you want to update for all columns using the
domain.
7 Click Yes.
Enforcing non-divergence from a domain in a PDM
From the Model Options dialog box, you can choose to enforce non-
divergence between a domain and the columns that use the domain.
For more information on non-divergence enforcement, see section
Defining PDM Options in chapter Physical Data Model Basics.
To enforce domain non-divergence in a PDM:
1 Select ToolsModel Options.
or
Right click the diagram background.
Select Model Options from the contextual menu.
Chapter 3 Building Physical Diagrams
PDM User's Guide 71
The Model Options dialog box opens to the Model Settings page.
Defining domains in a PDM
72 PowerDesigner
2 Select the Column and Domain sub-category to display the Column and
Domain page.
3 Select the Enforce non-divergence check box in the Column and Domain
groupbox.
4 Select check boxes for the column properties that are not permitted to
diverge from the domain definition.
5 Clear check boxes for column properties that are allowed to diverge
from the domain definition.
6 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 73
Defining defaults in a 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 dropdown listbox in the Check
Parameters page of a column or domain property sheet.
The default object citydflt is used to assign the same default value to all
columns of type city.
Default properties in a PDM
A default includes the following properties:
Property Description
Name Name for default
Code Reference code for default
Comment Descriptive label
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-defined
Owner Name of default owner. You choose an owner from a list of users
Value Value of default object that will be generated
You can view the default creation order in the Preview page of the default
property sheet.
create default CITYDFLT
as 'Dublin'
Creating a default in a PDM
You create a default from the list of defaults.
When you create defaults, make sure you do not create several defaults with
the same value. This will raise a warning message during check model.
To create a default in a PDM:
1 Select ModelDefaults to display the list of defaults.
Example
Preview page
Defining defaults in a PDM
74 PowerDesigner
2 Click a blank line in the list.
or
Click the Add a Row Tool.
An arrow appears at the beginning of the line.
3 Type a default name and a default code.
4 Click Apply to commit the creation of the new default.
5 Click the new default line to display an arrow at the beginning of the
line.
6 Click the Properties tool.
The property sheet of the new default appears.
7 Type a value in the Value box.
You can view the default creation statement in the Preview page.
8 Click OK.
Assigning a default to a column or a domain
You can select a default from the list of defaults and assign it to a column or
a domain from the Standard Checks page of the column or domain property
sheet.
Chapter 3 Building Physical Diagrams
PDM User's Guide 75
For more information on check parameters, see Defining check
parameters in a PDM.
If you only type a value in the Default dropdown listbox of a domain
property sheet, it will not be generated as a default object in the database. It
is highly recommended to use the Rebuild Default feature to create the
default object corresponding to this value.
For more information on Rebuild Default, see section Rebuilding
defaults.
To assign a default to a column or a domain:
1 Open the property sheet of a column or a domain.
2 Click the Standard Checks tab to display the Standard Checks page.
3 Select a default in the Default dropdown listbox in the Value groupbox.
You can still type a default value in the listbox, this does not create a
default object in the model, it only assigns a default value for the current
column or domain. If you type a default name that exists in the list, the
default object is attached to the column or domain.
4 Click OK in each of the dialog boxes.
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.
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
Default name
template
Defining defaults in a PDM
76 PowerDesigner
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.
You can select the following rebuild options:
Rebuild option Details
Reuse defaults with
identical value
Allows you to reuse default objects with identical value
among columns and domains. If you do not select this
option, rebuild creates one default per object
Delete and rebuild 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
To rebuild defaults:
1 Select ToolsRebuild ObjectsRebuild Defaults.
The Default Rebuild dialog box appears.
2 Define a default name template in the Domain and Column boxes.
3 <optional> Select the Reuse default with identical value check box if you
want defaults to be reused in the model.
4 <optional> Select the Delete and rebuild check box if you want unused
defaults to be deleted before rebuild.
5 Click the Selection tab to display the Selection page and select domains
and tables for default generation.
6 Click OK.
The defaults are automatically created and attached to the domains
and/or columns.
Rebuild options
Chapter 3 Building Physical Diagrams
PDM User's Guide 77
Using abstract data types in a physical diagram
An abstract data type (ADT) is a user-defined data type which can
encapsulate a range of data values and functions. The functions can be both
defined on, and operate on the set of values.
An abstract data type for the Gregorian calendar which has functions defined
to do the following:
Read and write roman numerals
Convert dates from the Julian calendar to the Gregorian calendar
Convert dates from the Gregorian calendar to the Julian calendar
Types of abstract data types used in PowerDesigner
Depending on the current DBMS, the following groups of abstract data types
can be represented in PowerDesigner:
Type Description Example
Array Fixed length collection of
elements
VARRAY (Oracle 8 and
higher)
List Unfixed length collection of
objects
TABLE (Oracle 8 and
higher)
Java Java class JAVA (Adaptive Server
Anywhere, and Adaptive
Server Enterprise)
Object Contains a list of attributes and a
list of procedures
OBJECT (Oracle 8 and
higher)
SQLJ Object Contains a list of attributes and a
list of procedures
SQLJ OBJECT (Oracle 9i
and higher)
Structured Contains a list of attributes NAMED ROW TYPE
(Informix 9.x, and IBM
DB2 5.2)
Example
Using abstract data types in a physical diagram
78 PowerDesigner
How are abstract data types used in PowerDesigner?
Abstract data types can be used in the following ways in a Physical diagram:
Abstract data
type is Description
Created You can create an abstract data type for each category
supported by the current 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
Reverse
engineered
Declaration of an abstract data type is reverse engineered into
a PDM
You create abstract data types in the List of Abstract Data Types. When you
reverse engineer a database that contains abstract data types, the data type is
automatically added to the List of Abstract Data Types.
An abstract data type must be listed in the List of Abstract Data Types before
it is available as a data type for columns and domains in the physical
diagram.
For more information on reverse engineering a database into a PDM,
see chapter Reverse Engineering.
Linking Java classes
Java classes cannot be created in the PDM. You need to specify an
abstract data type as type JAVA, and then link it to an existing Java class
in the OOM. Once a Java class is linked, you can access its properties.
For information on linking Java classes, see section Linking an abstract
data type to a Java class.
You cannot create a Java class in a PDM. You need to specify the name and
code of a Java class in the List of Abstract Data Types, then link it to a Java
class in a PowerDesigner Object-Oriented Model. The OOM must be open in
the current Workspace. Once an abstract data type is linked to a Java class,
you can access the Java class property sheet.
You can reverse engineer a database that contains Java classes into a PDM.
To have access to the Java class properties, you must also reverse engineer
the Java classes into an OOM. The columns or domains that use the Java
classes as data types in the PDM are then automatically linked to the
corresponding Java classes in the OOM.
Linking to Java
classes in the
object-oriented
model
Automatic linking
of reversed Java
classes
Chapter 3 Building Physical Diagrams
PDM User's Guide 79
For more information on creating and reverse engineering Java classes
into a PowerDesigner Object-Oriented Model, see the Object-Oriented
Model User's Guide.
Abstract data type properties
An abstract data type includes the following properties:
Property Description
Name Name for abstract data type
Code Reference code for abstract data type
Comment Descriptive label
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-defined
Owner Name of abstract data type owner. You choose an owner from a
list of users
Type 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 dropdown
listbox to select a mapping interface (CustomDatum, OraData or
SQLData)
Using abstract data types in a physical diagram
80 PowerDesigner
Creating an abstract data type
You can create an abstract data type from the List of Abstract Data Types. If
the current DBMS does not support abstract data types, the menu item does
not appear.
When you create an abstract data type it then becomes available to be used as
a data type for columns and domains in the physical diagram.
Linking Java classes
Java classes cannot be created in the PDM. You need to specify an
abstract data type as type JAVA, and then link it to an existing Java class
in the OOM. Once a Java class is linked, you can access its properties.
To create an abstract data type:
1 Select ModelAbstract Data Types to display the List of Abstract Data
Types.
2 Click a new line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type an abstract data type name and code.
4 Click Apply to commit the creation of the new abstract data type.
Chapter 3 Building Physical Diagrams
PDM User's Guide 81
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet of the abstract data type opens to the General page.
6 Select a type of abstract data type from the Type dropdown listbox.
Depending on the type of abstract data type that you select, other
property boxes or page tabs may appear on the property sheet. For
example in Oracle 8, the property sheet for an VARRAY shows the
properties Data type, Size, Length, and Precision.
Using abstract data types in a physical diagram
82 PowerDesigner
Also in Oracle 8 and higher, the property sheet for an OBJECT shows
the properties Authorization, Supertype, Final, and Abstract.
7 Type or select data type properties.
8 Click OK.
For information on the OBJECT abstract data type, see section Creating
an object (or a SQLJ object) abstract data type.
Creating an object (or a SQLJ object) abstract data type
When you select the type OBJECT (or SQLJ OBJECT) for an abstract data
type, an Attributes tab and a Procedures tab are added to the property sheet
of the abstract data type:
The Attributes page allows you to specify an object (or SQLJ object)
with a number of attributes to which are assigned appropriate data types
The Procedures page allows you to specify an object (or SQLJ object)
with a number of procedures to which are assigned appropriate
parameters
Chapter 3 Building Physical Diagrams
PDM User's Guide 83
For example, you may want to create an Address object with Street, City, and
ZipCode attributes, and a Location procedure.
To create an object (or a SQLJ object) abstract data type:
1 Select ModelAbstract Data Types to display the List of Abstract Data
Types.
2 Click a new line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type an abstract data type name and code.
4 Click Apply to commit the creation of the new abstract data type.
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet of the abstract data type opens to the General page.
6 In the Type dropdown lisbox, select OBJECT (or SQLJ_OBJECT).
The Attributes and Procedures tabs appear in the property sheet of the
abstract data type.
7 Click the Attributes tab to display the Attributes page.
8 Click a blank line in the list.
9 Type an attribute Name and Code.
10 Select a data type class from the Data Type dropdown listbox.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool.
Object example
Using abstract data types in a physical diagram
84 PowerDesigner
11 Repeat steps 8 to 10 for every object attribute you want to define.
For each attribute, you can check the Mandatory (M) column.
12 Click the Procedures tab to display the Procedures page.
13 Click a blank line in the list.
14 Type a procedure Name and Code.
Chapter 3 Building Physical Diagrams
PDM User's Guide 85
For each procedure, you can check the Final (F), Static (S) and Abstract
(A) columns.
15 Click OK in each of the dialog boxes.
Linking an abstract data type to a Java class
You can specify a Java class in the PDM, then link it to a Java class in an
OOM. The OOM must be open in the current Workspace to be linked.
When you link an abstract data type to a Java class, a shortcut is created
which allows you to access the properties of the Java class.
To link an abstract data type to a Java class:
1 Select ModelAbstract Data Types to display the List of Abstract Data
Types.
2 Click a line in the list for an abstract data type of the type JAVA.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet of the abstract data type appears.
4 Click the Ellipsis button at the end of the Class box.
Using abstract data types in a physical diagram
86 PowerDesigner
A Java class selection box appears. It lists all the Java classes that are
available in the object-oriented models that are currently open in the
Workspace.
5 Select a Java class.
6 Click OK.
You return to the property sheet of the abstract data type. The Class
name appears in the Class box. The abstract data type is now linked to
this Java class.
7 Click the Properties button at the end of the Class box.
Chapter 3 Building Physical Diagrams
PDM User's Guide 87
A shortcut property sheet for the Java class appears.
8 Click the Properties button at the end of the Target Object box to display
the target class property sheet.
9 Click OK.
You return to the shortcut property sheet.
Using abstract data types in a physical diagram
88 PowerDesigner
10 Click Close.
11 Click OK in each of the dialog boxes.
Automatic linking to a Java class after reverse engineering
When you reverse engineer a database that contains Java classes into a PDM,
the Java classes are reverse engineered as abstract data types of the type
JAVA.
The abstract data types of the type JAVA in the PDM are automatically
linked to the Java classes in the OOM as follows:
You need to reverse engineer the Java classes in the database that are
used as data types for the columns and domains in an OOM
You 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 link
The Java classes that are reverse engineered into a PDM are listed
automatically as abstract data types of type JAVA in the List of Abstract Data
Types.
You can access the properties of a Java class from the property sheet of the
corresponding abstract data type of type JAVA.
For more information on accessing the property sheet of a linked Java
class, see section Accessing a linked Java class in an OOM.
Accessing a linked Java class in an OOM
You can access the property sheet of a Java class in an OOM that is linked to
an abstract data type of the type JAVA in the PDM. The OOM must be open
in the current Workspace.
To access a linked Java class in an OOM:
1 Select ModelAbstract Data Types to display the List of Abstract Data
Types.
2 Click a line in the list for an abstract data type of the type JAVA.
An arrow appears at the beginning of the line.
Chapter 3 Building Physical Diagrams
PDM User's Guide 89
3 Click the Properties tool
or
Double-click the arrow at the beginning of the line.
The property sheet of the abstract data type appears.
The linked class name appears in the Class box. The abstract data type is
linked to this Java class.
4 Click the Properties button at the end of the Class box.
Using abstract data types in a physical diagram
90 PowerDesigner
A shortcut property sheet for the Java class appears.
5 Click the Properties button at the end of the Target Object box to display
the target class property sheet.
6 Click OK.
You return to the Shortcut property sheet.
Chapter 3 Building Physical Diagrams
PDM User's Guide 91
7 Click Close.
8 Click OK in each of the dialog boxes.
Defining columns in a physical diagram
92 PowerDesigner
Defining columns in a physical diagram
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.
Column properties
You can access column properties from a table property sheet:
Property Description
Name Name for the column. This name improves the readability of the
model
Code Reference code for the column
Comment Descriptive label for the column
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Table Table which contains column
Data type Form of the data corresponding to the column, such as numeric,
alphanumeric, boolean, or others
Displayed When selected, allows the display of selected column in list of
columns, otherwise the column is grayed
Length Maximum length of the data type
Precision Maximum number of places after the decimal point
Identity When selected, indicates that the data is auto-incremented (not
available for all DBMS)
Domain Name of the associated domain
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)
Primary key When selected, designates a column whose values uniquely
identify a row in the table
Foreign key When selected, designates a column that depends on and migrates
from a primary key column in another table
Chapter 3 Building Physical Diagrams
PDM User's Guide 93
Property Description
Mandatory When selected, indicates a column that must be assigned a not
null value
With default When selected, indicates if a default value is assigned to the
column when a Null value is inserted (not available for all
DBMS)
A column also includes the following properties:
Property Description
Detail Column fill parameters. These determine the percentage of
column entries for which a null value is permitted, and
the percentage of column rows that contain unique values.
Test data parameters. You can select a test data profile from
the list available using the dropdown listbox
Computed Expression. You can enter a computed expression
for the column
Standard checks Standard check parameters
Additional checks SQL expression defining a check parameter
Options Physical options for columns. These are DBMS-specific
Column details
Column details indicate common data constraints. The following table lists
column detail parameters:
Parameter Description
Null Values Percentage of column entries for which a null value is
permitted
Distinct Values Percentage of column entries for which a distinct value
is permitted
Average Length Average length of a value
Test Data Parameters Test data profile selected from the dropdown listbox.
Profiles can use characters, numbers or date/time data
types
Computed Expression Computed expression typed directly in the Computed
Expression pane or defined with the SQL Editor
(accessed with the Edit tool) which helps you define
more complex expressions
Defining columns in a physical diagram
94 PowerDesigner
The percentage you type in this box defines the percentage of distinct values
allowed in a column of a given table. This property is used during test data
generation.
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 must 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 appears 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.
For more information on test data parameters, see Using test data in
chapter Database Creation and Modification.
For more information on defining computed columns, see Creating a
computed column.
Creating columns
You create a column from the table property sheet. To display the table
property sheet, you can:
Double-click the table symbol
Right-click the table node in the Browser and select Properties
At creation, a column has a default name including a number, this number is
assigned in the order of creation of objects.
To create a column:
1 Select the Columns tab in the table property sheet.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Understanding
distinct values
Chapter 3 Building Physical Diagrams
PDM User's Guide 95
3 Type a column name and a column code.
4 Click OK.
Creating a computed column
A computed column is a column whose content is computed from an
expression using values from other columns in the table. The computed
column is then filled with the results.
Simple computed expressions can be entered directly in the Computed
Expression pane on the Detail page of the column property sheet. For more
complex expressions, use the SQL Editor available through the Edit tool
found on the same page.
Computed columns are not available in all DBMS.
Assume that you want to automatically fill a column with the total sales of
widgets. To do this, you can create a computed column that will use the
number of widgets multiplied by the widget price:
Column name Contents Action on data
Number of widgets Number of widgets sold
Widget price Price of widgets when sold
Example
Defining columns in a physical diagram
96 PowerDesigner
Column name Contents Action on data
Widget sales Total widget sales Computed by multiplying
the first two columns
While our example is very simple, the SQL Editor allows you to define very
complex computed column expressions.
For more information on the SQL Editor, see Using SQL tools in
chapter Physical Data Model Basics.
To create a computed column:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Columns tab to display the list of columns.
3 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type a column name and a column code.
5 Click Apply.
6 Double-click the arrow at the beginning of the new column to display the
column property sheet.
7 Select the Computed check box.
8 Click the Detail tab.
9 Enter an expression in the Computed Expression pane.
or
Click the Edit tool on the right side of the Computed expression pane.
The SQL Editor dialog box appears.
Chapter 3 Building Physical Diagrams
PDM User's Guide 97
10 Create the expression that will define the computed column.
In our example, we use the asterisk (*) as an arithmetic operator to
multiply the number of widgets by their price.
11 Click OK to return to the column property sheet.
The expression appears in the Computed Expression pane.
12 Click OK in each of the dialog boxes.
Creating a sequence for a column
When your DBMS supports the feature, you can create a sequence for a
column.
To understand sequences, you must first understand auto-incremented
columns. An auto-incremented column is one whose values automatically
increment by 1 thereby producing a list of consecutive numbers. Sequences
are special auto-incremented columns with features that allow you to define a
more complex list of numbers. For example, sequences allow you to 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 section Selecting a data type
for a column.
Defining columns in a physical diagram
98 PowerDesigner
There are two steps to using sequences:
Create a sequence
Apply and enable a sequence to a column
When you create a sequence, you have to define options in sequence
properties. It is also possible to assign the options to other existing
sequences.
Once a sequence is created, you apply it to a table column in the model. You
then rebuild triggers to enable the sequence on this column.
For more information on model checks, see section Checking a PDM in
chapter Working with Physical Data Models.
If you create a sequence attached to a column in a DBMS supporting
sequences, such as Oracle 8 and higher, Interbase or PostgreSQL, or create
an auto-incremented column in a DBMS supporting this feature, and then
decide to change the target DBMS, the following effects occur:
DBMS change
Defined in
original DBMS
Effect on sequence objects and
auto-incremented columns
DBMS supporting
sequences to a
DBMS supporting
auto-incremented
columns
Sequence attached
to a column
The sequence disappears and the
column to which it was attached
becomes an auto-incremented column
in the DBMS
DBMS supporting
auto-incremented
columns to a
DBMS supporting
sequences
Auto-incremented
column
The auto-incremented column is
deleted and replaced by a sequence
object called S_TABLENAME which
is attached to the original column
When a CDM or an OOM is generated from a PDM, the data type of a table
column attached to a sequence is translated to a numeric data type in the new
model:
PDM generated to Sequence is converted to
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
Using sequences
Effect of DBMS
change on
sequences and
auto-incremented
columns
Sequences and
intermodel
generation
Chapter 3 Building Physical Diagrams
PDM User's Guide 99
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:
Parameter name Description Value
Start with March is the third month of the year 3
Increment by Look three months ahead to identify the
next month in the list
3
Maxvalue Stop when you have reached the last month
of the year
12
The sequence created with these parameter settings allows you to
automatically create the list of months in a year when quarterly reports are
published.
Sequence properties
A sequence includes the following properties:
Property Description
Name Name for the sequence. This name improves the readability of the
model
Code Reference code for the sequence
Comment Descriptive label for the sequence
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of sequence owner. You choose an owner from a list of
users. A column can only have one owner at a time. This is
normally the column creator
A sequence also includes the following property, with its own page:
Property Description
Options Physical options for sequences. These are DBMS-specific
Example
Defining columns in a physical diagram
100 PowerDesigner
Creating a sequence
To create a sequence:
1 Select ModelSequences to display the List of Sequences.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a sequence name and a sequence code.
4 Click Apply.
5 Double-click the arrow at the beginning of the line with the new
sequence name to display the sequence property sheet.
6 Select a sequence owner in the General page.
7 Click the Options tab to display the Options page.
The Syntax page in the left pane lists the sequence options available.
8 Select an option from the list on the Syntax page in the left pane.
9 Click the Add tool.
The name of the option appears on the Items page in the right pane.
10 Expand the option and select one of its parameters.
Chapter 3 Building Physical Diagrams
PDM User's Guide 101
The parameter name appears with an equals sign next to a text box at the
bottom of the dialog box.
11 Type a value for the parameter in the text box below the right pane.
The parameter on the Items page displays the value.
12 If required, select another parameter and similarly type a value for it.
Defining columns in a physical diagram
102 PowerDesigner
13 Repeat steps 7 to 11 to define the sequence options you want.
The above example shows the options and values to create a sequence of
months in a year when quarterly reports are published.
14 <optional> Click the Apply To button to open a selection list and select
the sequence to which the options will apply.
You may apply the options to more than one sequence if you have
previously created sequences.
15 Click OK in each of the dialog boxes.
Chapter 3 Building Physical Diagrams
PDM User's Guide 103
Applying and enabling a sequence on a column
To apply and enable a sequence on a column:
1 Select ModelColumns to display the List of Columns.
2 Click a column to which you want to apply a sequence.
An arrow appears at the beginning of the line.
3 Double-click the arrow at the beginning of the line.
or
Click the Properties tool.
The Column Property sheet opens to the General page.
4 Select a sequence from the Sequence dropdown listbox.
5 Click OK in each of the dialog boxes.
You have applied the sequence to the column.
6 Select ToolsRebuild ObjectsRebuild Triggers to display the Rebuild
Triggers dialog box.
7 Click the Selection tab to display the Selection page.
8 Select the table containing the column to which you want to attach a
sequence, and deselect the tables to which you do not want to attach a
sequence.
9 Click OK.
The triggers are rebuilt and the sequence is enabled on the column.
For more information on rebuilding triggers, see chapter Triggers and
Procedures.
Selecting a data type for a column
There are two ways to select a data type for a column:
Attach the column to a domain The domain dictates a data type, a
length, and a level of precision, as well as optional check parameters
Manually select a data type You select a data type along with a length,
a level of precision, and optional check parameters
Defining columns in a physical diagram
104 PowerDesigner
About check parameters
Check parameters indicate data ranges and validation rules. You can set
check parameters for domains, tables, and columns.
To select a data type for a column:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Columns tab.
The Columns page appears. It lists columns associated with the table.
3 Click the column that you want to define.
An arrow appears at the beginning of the line.
4 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
Chapter 3 Building Physical Diagrams
PDM User's Guide 105
The column property sheet appears.
Opening property sheets at last accessed page
Property sheets open to the General page by default. However, you
can choose to open property sheets at the last page accessed by
selecting ToolsOptionsDialog, and selecting the option Keep
Last Tab in the Property Sheets groupbox.
5 Select a data type from the Data Type dropdown listbox.
or
Click the Question mark button at the end of the Data Type listbox.
A list of standard data types appears.
Select the radio button corresponding to the data type you want to apply.
Click OK
6 Type the data type length in the Length box.
or
Type the level of data type precision in the Precision box.
Undefined data type
If you do not want to select a data type immediately, you can choose
the <undefined> data type. When you generate the database, this data
type is replaced by the default data type for your database, as defined
in the DBMS.
Defining columns in a physical diagram
106 PowerDesigner
7 Click OK.
You return to the Columns page. The new data type for the column
appears in the Data Type column.
8 Click OK.
or
Click another column in the list.
Attaching a column to a domain
If you attach a column to a domain, the domain supplies the data type and
related data characteristics. It may also indicate check parameters, and
business rules.
To attach a column to a domain:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Columns tab.
The Columns page appears listing columns associated with the table.
3 Click a column in the list to display an arrow at the beginning of the line.
4 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
Chapter 3 Building Physical Diagrams
PDM User's Guide 107
The column property sheet appears.
Opening property sheets at last accessed page
Property sheets open to the General page by default. However, you
can choose to open property sheets at the last page accessed by
selecting ToolsOptionsDialog, and selecting the option Keep
Last Tab in the Property Sheets groupbox.
5 Select a domain from the Domain dropdown listbox at the bottom of the
dialog box.
6 Click OK.
You return to the Columns page. In the Data Type column, the domain
data type replaces the data type previously defined for the column.
7 Click OK.
Copying a column to another table
You can copy a column from one table and add it to another table. If the table
already contains a column with the same name or code as the copied column,
the copied column is renamed. For example, the column PUB_ID is renamed
PUB_ID2 when it is copied to a table which already contains a column
PUB_ID.
Defining columns in a physical diagram
108 PowerDesigner
To copy a column to another table:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Columns page.
The Columns page appears.
3 Click the Add Columns tool.
A selection box appears. It lists columns attached to all other tables in
the model.
4 Select one or more columns in the list.
5 Click OK.
The copied columns appear in the list of columns for the current table.
6 Click OK.
Naming a column constraint
A column constraint is a named check that enforces data requirements of
check parameters.
Whenever you place a data restriction on a column, it generates a constraint
automatically. You have the option of specifying a name for the constraint. If
you do not specify a name for the constraint, PowerDesigner creates a default
constraint name automatically.
This name helps you to identify and customize a column constraint in scripts
for database creation and modification.
Chapter 3 Building Physical Diagrams
PDM User's Guide 109
To name a column constraint:
1 Select ModelColumns to display the List of Columns.
2 Click a column in the list.
An arrow appears at the beginning of the line.
3 Double-click the arrow at the beginning of the line.
or
Click the Properties tool.
The column property sheet appears.
4 Click the Additional Checks tab.
The Additional Checks page appears.
5 Type changes to the constraint name in the Constraint Name box.
The User-Defined button at the end of the box is pressed automatically.
Undo changes to a constraint name
You can always return to the default constraint name by clicking the
User-Defined button.
6 Click OK in each of the dialog boxes.
Configuring the display of the list of columns
You can sort the columns in the list in two ways:
By any property that appears in the title bar of the property lists
By alphabetical or reverse alphabetical order
The listed order is indicated by an arrow head that appears at the end of the
title bar of the property column. Each time you click a title bar, you change
the listed order for that column, according to the displayed arrow.
Each arrow type corresponds to the following list orders:
Arrow type Listed order
Down arrow Alphabetically
Up arrow Reverse alphabetically
Defining columns in a physical diagram
110 PowerDesigner
For example, when you click the title bar Name, the columns are listed by
column name alphabetically when the down arrow is indicated, and in reverse
order when the up arrow is indicated.
To configure the display of the list of columns:
1 Select ModelColumns.
The List of columns appears.
2 Click a property title bar.
The listed columns are ordered by the indicated property.
3 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 111
Defining keys in a physical diagram
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:
Key Description
Primary Column or combination of columns whose values uniquely identify
every row in a table. A table can have only one primary key
Alternate Column or combination of columns (not the same column or
combination of columns as for a primary key) whose values
uniquely identify every row in a table
Foreign Column or combination of columns whose values are required to
match a primary key, or alternate key, in some other table
The TITLE table shown below has a primary, alternate and foreign 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.
Designating a primary key
A primary key is the primary identifier for a table. A primary key is made up
of one or more columns whose values uniquely identify every row in the
table.
Example
Defining keys in a physical diagram
112 PowerDesigner
Every table must have a primary key, composed of one or more of its
columns.
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.
To designate a primary key:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Columns tab.
The Columns page appears. It lists the columns associated with the table.
3 Select one or more columns in the list.
4 Select the check box in the P column.
5 Click OK.
Rebuilding primary keys
Rebuilding primary keys in a physical diagram updates primary keys for
tables.
Rebuilding primary keys is useful following the reverse engineering of a
database in which all of the primary keys could not be reverse engineered, or
if you did not select the rebuild option for primary keys when you reverse
engineered the database. The rebuild option for primary keys creates primary
keys for tables that have no key and a single unique index.
You can choose to rebuild all primary keys in your model, or select the tables
for which you want to rebuild the primary keys.
To rebuild primary keys:
1 Select ToolsRebuild ObjectsRebuild Primary Keys to display the
Rebuild Primary Keys dialog box.
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 113
It lists all the tables in the current model.
Rebuilding primary keys in a package
To rebuild the primary keys in package, select the package from the
dropdown listbox at the top of the page.
To rebuild the primary keys in a sub-package, select the Include Sub-
Packages icon next to the dropdown listbox, and then select a sub-
package from the dropdown list.
2 Select the tables containing the primary keys that you want to rebuild.
Selecting or clearing all check boxes
You can select all check boxes, or clear all check boxes, by selecting
the Select All tool, or Clear All tool, from the toolbar at the top of the
page.
3 Click OK.
Designating a foreign key
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.
Defining keys in a physical diagram
114 PowerDesigner
The columns that are defined in a foreign key can also be user-specified at
creation and changed at any time from the Joins page of the reference
property sheet.
For more information on the auto-migration of a foreign key, see
section Auto-migrating foreign keys.
For more information on defining references, see section Defining
references in a physical diagram.
Adding parent table columns to a key
You can add existing columns in the parent table to a primary key or an
alternate key.
To add parent table columns to a key:
1 From the General page for a key, click the Columns tab.
The Columns page appears. It lists the columns defined for the key.
2 Click the Add Columns tool.
A selection box appears. It lists the columns available for selection in the
parent table.
3 Select one or more columns.
4 Click OK.
The new column names appear in the list of columns defined for the key.
5 Click OK on each of the dialog boxes.
Auto-migrating foreign keys
When you create a reference, the primary key in the parent table is
automatically migrated to the child table as a foreign key when the following
model options are selected:
Auto-migrate Columns
Default Link on Creation: Primary Key
Chapter 3 Building Physical Diagrams
PDM User's Guide 115
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 without
selecting the Enforce non-divergence option from model options, only the
actual properties of the column, and not of the domain, are migrated to the
foreign key. This also occurs during PDM generation.
When you select Auto-migrate columns, you can also choose to automatically
migrate the following column properties:
Domains
Check parameters
Validation rules
Column properties that are not selected are not migrated automatically at
reference creation.
The following table shows the results of different actions when you choose to
auto-migrate foreign key columns:
Action Result
Modify reference
attach point
Migrate primary key in parent table to foreign key in child
table
Delete unused foreign key columns
Modify reference join
Delete primary
key
Delete corresponding foreign key and reference join
To auto-migrate foreign keys:
1 Select ToolsModel Options.
Defining keys in a physical diagram
116 PowerDesigner
The Model Options dialog box opens to the Model Settings page.
2 Select the Reference sub-category to display the Reference page.
Chapter 3 Building Physical Diagrams
PDM User's Guide 117
3 Select the Auto-migrate columns check box, in the Reference
groupbox, to activate the Domain, Check, and Rules check boxes.
4 Select the Domain, Check, and/or Rules check boxes.
5 Click OK
Designating an alternate key
An alternate key is made up of one or more columns whose values uniquely
identify every row in the table, and 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.
To designate an alternate key:
1 Double-click a table in the diagram.
The property sheet for the table appears.
2 Click the Keys tab.
The Keys page appears. It lists keys defined for the table.
Defining keys in a physical diagram
118 PowerDesigner
3 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type a key name and a key code.
Alternate key naming convention
The naming convention for an alternate key is AK followed by the
number of the key column code; for example AK1_CUSNAME.
5 <optional> Type a constraint name in the Constraint Name column.
If you do not specify a constraint name, PowerDesigner creates a default
constraint name automatically.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. See the Defining a filter on a list section in
the General Features Guide.
6 Click Apply.
The constraint name and code are committed.
7 Click the new key name.
An arrow appears at the beginning of the line.
8 Click the Properties tool.
The property sheet for the new key appears.
9 Click the columns tab.
The columns page appears. It lists all columns defined for the key. At
key creation, the list is empty.
10 Click the Add Columns tool.
A list of columns, defined for the table appears. This list does not
include primary key columns.
11 Select check boxes for one or more columns that you want to designate
as alternate key columns.
12 Click OK in each of the dialog boxes.
Chapter 3 Building Physical Diagrams
PDM User's Guide 119
Naming key constraints
Naming key constraints helps you to identify and customize key constraints
in scripts for database creation and modification. The constraint name gives
you greater flexibility for modifying keys in subsequent database generations.
If you do not specify a constraint name, PowerDesigner creates a default
constraint name automatically.
Naming a primary key constraint
A primary key constraint is a named check that enforces the uniqueness and
the presence of values in a primary key column.
In the name of a primary key constraint, you can use the following variable:
Variable Description
%TABLE% Code of the table
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner.
To name a primary key constraint:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Keys tab.
The Keys page appears. It lists keys defined for the table.
3 Select the primary key.
4 Click the Properties tool.
The property sheet for the primary key appears.
5 Type changes to the name in the Constraint Name box.
The User-Defined button at the end of the Constraint box is pressed
automatically.
Undo changes to a constraint name
You can always return to the default constraint name by re-clicking
the User-Defined button.
6 Click OK in each of the dialog boxes.
Defining keys in a physical diagram
120 PowerDesigner
Naming a foreign key constraint
In the name of a foreign key constraint, you can use the following variables:
Variable Description
%REFRNAME% Name of the reference
%REFRCODE% Code of the reference
%PARENT% Code of the parent table
%CHILD% Code of the child table
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner.
To name a foreign key constraint:
1 Double-click a reference in the diagram.
The property sheet for the reference appears.
2 Click the Integrity tab.
The Integrity page appears. It displays referential integrity information
for the reference.
3 Type changes to the name in the Constraint Name box.
The User-Defined button at the end of the Constraint box is depressed
automatically.
Undo changes to a constraint name
You can always return to the default constraint name by re-clicking
the User-Defined button.
4 Click OK in each of the dialog boxes.
Naming an alternate key constraint
In the name of an alternate key constraint, you can use the following
variables:
Variable Description
%AK% Code of the alternate key
%AKNAME% Name of the alternate key
%TABLE% Code of the table
Chapter 3 Building Physical Diagrams
PDM User's Guide 121
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner.
To name an alternate key constraint:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Keys tab.
The Keys page appears. It lists keys defined for the table.
3 Select an alternate key.
4 Click the Properties tool.
The property sheet for the alternate key appears.
5 Type changes to the name in the Constraint Name box.
The User-Defined button at the end of the Constraint box is depressed
automatically.
Undo changes to a constraint name
You can always return to the default constraint name by re-clicking
the User-Defined button.
6 Click OK in each of the dialog boxes.
Defining references in a physical diagram
122 PowerDesigner
Defining references in a physical diagram
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.
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).
Depending on its properties, a reference can link a parent table and a child
table in two ways:
Reference links Description
Primary key, alternate key
and foreign keys
Primary or alternate key in the parent table is
linked to a foreign key in the child table
User specified columns One or more columns in the parent table are linked
to 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
Example
Linking keys and
user-specified
columns
Chapter 3 Building Physical Diagrams
PDM User's Guide 123
Reference properties
You can double-click any reference symbol in a diagram to display its
properties:
Property Description
Name Name for the reference. This name improves the readability of
the model
Code Code for the reference
Comment Descriptive label for the reference
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Parent table Parent table of the reference. This table contains the primary key,
or alternate key, linked by the reference
Parent role Role of the parent table in the reference. The text appears in the
diagram, near the parent table
Child table Child table of the reference. This table contains the foreign key
linked by the reference
Child role Role of the child table in the reference. The text appears in the
diagram, near the child table
Generate When selected, indicates to generate the reference in the database
A reference also includes the following properties:
Property Description
Joins Links between parent table columns and child table columns
Integrity Integrity constraints defined for reference
Defining references in a physical diagram
124 PowerDesigner
Defining model options for references
You can define the following model options for references:
Option Result when selected Result when cleared
Unique code Each reference has a unique code in
the namespace
Different references can
have the same code
(except when two
references share the
same child table)
Auto-reuse
columns
An existing column in child table is
used as foreign key column when
all of the following conditions
apply:
Child column has same code as
migrating primary key column
Child column is not already a
foreign key column
Data types are compatible
No child table columns
are reused as foreign key
columns
Auto-migrate
columns
Primary key columns are
automatically migrated to foreign
key columns at reference creation or
when definition of primary key
changes
Primary key columns
are not automatically
migrated
*Domain Domain automatically migrated
with primary key columns
Domain not
automatically migrated
with primary key
columns
*Check Check parameter automatically
migrated with primary key columns
Check parameters not
automatically migrated
with primary key
columns
*Rules Business rule automatically
migrated with primary key columns
Business rules not
automatically migrated
with primary key
columns
Chapter 3 Building Physical Diagrams
PDM User's Guide 125
Option Result when selected Result when cleared
Propagate
column
properties
When you modify the name, the
code or the data type of a parent
table column that belongs to a
reference join, you can use this
option to propagate the change on
the corresponding foreign key
column

Default link on
creation:
Primary key
Reference links Primary key
columns to foreign key columns at
creation

Default link on
creation: User-
defined
No columns are linked at creation.
No joins are created.

Default
implementation
Indicates how referential integrity is
implemented in the reference. You
can choose Declarative if you wish
to define referential integrity for
particular references, or you can
choose Trigger if you want
referential integrity to be
implemented by triggers

* Only available when Auto-migrate Columns is selected.


For more information on referential integrity implementation, see
section Using referential integrity.
To define model options for references:
1 Select ToolsModel Options.
or
Right-click the diagram background and select Model Options from the
contextual menu.
Defining references in a physical diagram
126 PowerDesigner
The Model Options dialog box opens to the Model Settings page.
2 Select the Reference sub-category to display the Reference page.
Chapter 3 Building Physical Diagrams
PDM User's Guide 127
3 Select or clear check boxes in the Reference groupbox.
4 Click OK.
Automatic reuse and migration of columns
You can select options from the Model Options page to automatically
migrate primary key columns to foreign key columns. You can also choose to
automatically reuse an existing child table column as a foreign key column.
From Model Options, you can choose to automatically migrate primary key
columns to foreign key columns at reference creation by selecting both the
following options:
Default Link on Creation: Primary key
Auto-migrate Columns
From Model Options, you can choose to automatically reuse an existing child
table column as a foreign key column by selecting the following model
options:
Default Link on Creation: Primary key
Auto-reuse Columns
The Child table column must have the same code as the migrating primary
key column, and cannot already be a foreign key column.
PowerDesigner does not automatically reuse existing foreign key columns.
This must be done manually from the Joins page of the reference property
sheet.
The following table shows the results of migrating primary key columns to a
child table that contains a matching column for one of the primary key
columns. The original two tables are also shown below:
Auto-
reuse
Auto-
migrate Result
Description of
child table
Selected Selected Col_1 is reused and
Col_2 is created
Auto-migrate
columns
Auto-reuse
columns
Matching child
table column exists
Defining references in a physical diagram
128 PowerDesigner
Auto-
reuse
Auto-
migrate Result
Description of
child table
Not
selected
Selected T1_Col_1 is created
and Col_2 is created
Selected Not selected Col_1 is reused and
Col_2 is not created
Not
selected
Not selected No column is reused
and no column is
created
The following table shows the results of migrating primary key columns to a
child table that contains a matching child table column that is already a
foreign key column for another table. The original two tables are also shown
below:
Auto-
reuse
Auto-
migrate Result
Description of
child table
Selected Selected T1_Col_1 is created
and Col_2 is created
Unselected Selected T1_Col_1 is created
and Col_2 is created
Selected Not
selected
No columns are
reused or created
Unselected Unselected No columns are
reused or created
Matching child
table column is
already a FK
column
Chapter 3 Building Physical Diagrams
PDM User's Guide 129
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.
When you create a reference, its properties depend on the current model
options, and the existence, or non-existence, of a foreign key column in the
child table with the same code as a migrating primary key column.
For more information on selecting model options for references see
section Defining model options for references.
For more information on column migration and reuse, see section Auto-
migrating foreign keys.
To create a reference:
1 Click the Reference tool in the tool palette.
2 Click inside the child table and while holding down the mouse button,
drag the cursor into the parent table containing the primary key, or
alternate key to migrate. Release the mouse button.
The link appears between the two tables.
Dragging a reference to a different table
You can change the table at either end of a reference by clicking the
reference and holding down CTRL as you drag one of its attach points
to a different table.
3 Click the Pointer tool.
or
Click the right mouse button.
You release the Reference tool.
4 Double-click the new link in the diagram to display the reference
property sheet.
5 Type a reference name and a reference code.
Defining references in a physical diagram
130 PowerDesigner
6 Select the Generate check box if you want to generate the reference.
You can open the property sheet of the child and parent tables by
clicking the Child Table and Parent Table buttons located in the upper
part of the reference property sheet.
7 Click OK.
Defining reference joins
A join is a link between a column in a parent table and a column in a child
table (column pair) that is defined within a reference.
A join can link primary key, or alternate key, and foreign key columns, or
user specified columns in the parent and child tables that are independent of
key columns.
Chapter 3 Building Physical Diagrams
PDM User's Guide 131
When you create a reference, the current selections for Model Options
determine the creation of the following types of default joins:
Joins that link primary and foreign key column pairs
Joins that are linked to primary key columns, but are not linked to child
table columns, so are incomplete
No joins created
Join creation is determined by the following selections for Model Options:
Default Link on
Creation
Auto-migrate
Columns Result
Primary Key Selected Joins created between primary and
foreign key columns
Not selected Joins are created that are linked to
primary key columns, but are
incomplete. Foreign key columns must
be specified manually
User-defined Selected No joins created. Parent and child table
column pairs must be specified
manually
Not selected No joins created. Parent and child table
column pairs must be specified
manually
For any reference you can choose to link a primary key, or alternate key, to a
corresponding foreign key. When you select a key from the Joins page of the
reference property sheet, all the key columns are linked to matching foreign
key columns in the child table.
Changing a foreign key column link
A foreign key column can also be changed to link to another parent table
column, either within the key relationship, or independent of it.
You can use the following buttons on the Joins page to reuse or migrate
columns linked by joins.
Button Name Description
Reuse Columns Reuse existing child columns with same code as
parent table columns
Default joins at
reference creation
Linking columns in
a primary or
alternate key
Reuse and
Migration option for
a selected
reference
Defining references in a physical diagram
132 PowerDesigner
Button Name Description
Migrate Columns Migrate key columns to foreign key columns. If
columns do not exist they are created
Cancel Migration Delete any migrated columns in child table
The join order can be established automatically or manually by using the
Auto Arrange Join Order check box. The Auto Arrange Join Order check box
is grayed if the reference is not joined to a key.
Selecting or clearing the Auto arrange join order check box has the following
effects:
Auto Arrange
Join Order Effect
Checked Sorts the list according to the key column order (the move
buttons are not available)
Cleared Allows you to manually sort the join order with the move
buttons (the move buttons are available)
To define joins in a reference:
1 Double-click a reference in the diagram to display the reference property
sheet.
2 Click the Joins tab to display the Joins page.
3 Select a key from the Parent Key dropdown listbox to create joins
between primary key, or alternate key, and foreign key columns.
or
Select <NONE> from the Parent Key dropdown listbox to create joins
between user-specified columns. If you select <NONE>, the column lists
are empty.
Auto arrange join
order
Chapter 3 Building Physical Diagrams
PDM User's Guide 133
The columns linked by the joins are listed in the Parent Table and Child
Table columns. A Joins page with a selected Parent Key is shown below:
Changing a foreign key column linked by a join
You can change the foreign key column linked by a join by clicking
the column in the Child Table list, and selecting another column from
the dropdown listbox.
4 <Optional> If you selected <NONE> from the Parent Key dropdown
listbox, click the Parent Table Column and select a column from the
dropdown listbox, then click the Child Table Column and select a child
column.
5 <Optional> Select or clear the Auto arrange join order check box.
Defining references in a physical diagram
134 PowerDesigner
A Joins page with a selected parent key and selected Auto arrange join
order check box is shown below:
Enabling the Auto arrange join order check box
To enable this check box, add an EnableChangeJoinOrder item
to the Reference category in the DBMS definition file and set the
value to YES.
6 Click OK.
For information on adding an item to the Reference category, see
chapter DBMS Reference Guide in the Advanced User Documentation.
Chapter 3 Building Physical Diagrams
PDM User's Guide 135
Changing a table at either end of a reference
After reference creation you can change one table, or both of the tables,
linked by a reference, using one of the following methods:
Dragging a reference end to another table in the diagram
Selecting a different table from the reference property sheet
Selecting a different table from the list of references
Changing a referenced table graphically
To change a referenced table graphically:
Click the reference and hold down CTRL as you drag one of its attach
points to a different table
Selecting a different table for a reference from a property sheet
To select a different table from the property sheet:
1 Double-click a reference in the diagram to display the reference property
sheet.
2 Select a parent table from the Parent Table dropdown list.
or
Select a child table from the Child Table dropdown list.
3 Click OK.
Selecting a different table for a reference from the list
To select a different table from the list:
1 Select ModelReferences
The List of References appears.
2 Click a reference in the list.
An arrow appears at the beginning of the line.
3 Click the reference line in the Parent column.
Select a parent table from the dropdown list that appears.
or
Click the reference line in the Child column.
Defining references in a physical diagram
136 PowerDesigner
Select a child table from the dropdown list that appears.
4 Click OK.
Rebuilding references
Rebuilding references in a Physical diagram creates default references
between PK columns in a table and columns with identical code and data type
in another table. Note that rebuild 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.
You can choose to rebuild references in one of two ways:
Rebuild option Description
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 built
based on new matching key columns
You can choose to rebuild all references in your model, or select the tables
that are linked by the references that you want to rebuild.
To rebuild references:
1 Select ToolsRebuild ObjectsRebuild References.
The Rebuild References dialog box appears.
2 Select the Delete and Rebuild radio button.
or
Select the Preserve radio button.
3 Click the Selection tab.
Chapter 3 Building Physical Diagrams
PDM User's Guide 137
A selection page appears. It lists all the tables in the current model.
Rebuilding references in a package
To rebuild references between tables in a package, select the package
from the dropdown listbox at the top of the page.
To rebuild references between tables in a sub-package, select the
Include Sub-Packages icon next to the dropdown listbox, and then
select a sub-package from the dropdown list.
4 Select or clear check boxes according to your needs.
Selecting or clearing all check boxes
You can select all check boxes, or clear all check boxes, by selecting
the Select All tool, or Clear All tool, from the toolbar at the top of the
page.
5 Click OK.
If you selected the Delete and Rebuild mode, a confirmation box asks
you to confirm your choice. If you selected the Preserve mode, you do
not receive a confirmation box.
6 Click Yes to confirm the deletion and rebuild of the selected references.
Defining references in a physical diagram
138 PowerDesigner
Using referential integrity
Referential integrity is a collection of rules that govern data consistency
between primary keys, alternate keys and foreign keys.
Referential integrity dictates what happens when you update or delete a value
in a referenced column in the parent table, and when you delete a row
containing a referenced column from the parent table.
You can implement referential integrity using one of two methods:
Referential integrity Description
Declarative Referential integrity constraints are defined for
particular references. When the reference is generated
the target DBMS evaluates the reference validity and
generates appropriate error messages
Using triggers Referential integrity constraints are implemented by
triggers based on the integrity constraints defined in
the reference property sheet. The trigger evaluates
reference validity and generates appropriate user-
defined error messages
Referential integrity as a generation option
For certain target databases you can define referential integrity as a
generation option. However many databases do not accept referential
integrity as a generation option (in a trigger or a declaration). In these
cases, when you generate a database generation script, it does not include
the definition of referential integrity.
Chapter 3 Building Physical Diagrams
PDM User's Guide 139
Referential integrity properties
The definition of referential integrity includes the following properties:
Property Description
Constraint name Name of the referential integrity constraint. Maximum
length is 254 characters
Implementation Indicates whether implementation of referential integrity is
declarative, or by the use of triggers
Cardinality Indicates the maximum and minimum number of instances
in a child table that can appear for each corresponding
instance in the parent table
User-defined Indicates a user-defined constraint name
Update constraint How updating a key value, in the parent table affects the
foreign key value in the child table
Delete constraint How deleting a row in the parent table affects the child table
Mandatory parent Each foreign key value in the child table must have a
corresponding key value, in the parent table
Change parent
allowed
A foreign key value can change to select another value in
the referenced key in the parent table
Check on commit* Verifies referential integrity only on the commit, instead of
verifying it after row insertion. You can use this feature to
control circular dependencies
* Only available for Sybase SQL Anywhere 5.0 and 5.5.
Defining references in a physical diagram
140 PowerDesigner
Defining cardinality allows you to control the minimum and maximum
number of children permitted for each parent. You can use the following
values to define cardinality:
Cardinality Minimum Maximum
0 A parent does not have a minimum
number of children. Child is
optional

1 At least one child must exist for


each parent
Only one child can exist
for each parent
any integer Minimum number is the number
indicated
Maximum number is the
number indicated
N or * Any number of children
can exist for a each parent
Cardinality can be expressed in the following formats:
Format Description Example
x..y Minimum and maximum
interval, where x is any
integer, and Y can be any
of the following:
Integer
n (infinite)
* (infinite)
(2..10) There must exist between two
and ten children for each parent
(0..n) Child is optional, and there can
be any number of children for any one
parent
10* There must exist at least ten
children for each parent
y Maximum value which is
equivalent to the form
(0..y)
(10) There can be up to ten children for
each parent. Child is optional
x..y, x..y Series of intervals, where
the cardinality can be any
one of the intervals
(1..2, 4..n) There can exist either one or
two children for each parent, or at least
four children for each parent
Cardinality
Cardinality format
Chapter 3 Building Physical Diagrams
PDM User's Guide 141
Update constraint and delete constraint take any of the following values:
Value Change to parent table Result in child table
None Update or delete parent value None
Restrict Cannot update or delete parent
value if one or more matching
child values exist
None
Cascade Update or delete parent value Update or delete matching child
values
Set null Update or delete parent value Set matching child values to
NULL
Set default Update or delete parent value Set matching child values to
default value
Defining referential integrity
You define referential integrity from the Integrity page of the reference
property sheet.
Implementing referential integrity
In PowerDesigner 6, the implementation of referential integrity was
defined as a generation option. However, in PowerDesigner 8, you
indicate the implementation of referential integrity using declarative
referential integrity, or by the use of triggers, from the Integrity page of
the reference property sheet.
To define referential integrity:
1 Double-click a reference in the diagram to display the reference property
sheet.
2 Click the Integrity tab.
Update and delete
constraints
Defining references in a physical diagram
142 PowerDesigner
The Integrity page appears. If no constraint name has been defined, the
default constraint name is shown in the Constraint name box.
3 <optional> Type a constraint name.
The User-Defined button at the end of the Constraint name box is
automatically shown pressed, to indicate the name is user-defined.
Undo changes to a constraint name
You can always return to the default constraint name by re-clicking
the User-Defined button.
4 Select Declarative from the Implementation dropdown listbox, if you
want to implement declarative referential integrity.
or
Select Trigger from the Implementation dropdown listbox, if you want to
implement referential integrity using triggers.
5 Select values for Cardinality, Update Constraint and Delete Constraint.
6 Select Mandatory Parent if you want each row in the child table to have
a corresponding row in the parent table.
Chapter 3 Building Physical Diagrams
PDM User's Guide 143
7 Select Change Parent Allowed if you want to be able to update the
foreign key value in the child table.
8 Click OK.
Modifying the reference display preferences
You can modify the following display preferences for a reference:
Label Displays
Name Name or code of the reference*
Constraint name Referential integrity constraint name
Join Statement of linked columns between the two tables
Referential integrity Update and delete referential integrity constraints.
Stereotype Stereotype of the reference
Role names Role names for parent and child tables of the reference
Cardinality Minimum and maximum number of instances in a child
table that can appear for each corresponding instance in
the parent table
Implementation Implementation mode of referential integrity, declarative
or by triggers
*Displayed text depends on whether the Name or Code radio button is selected.
Reference text
Defining references in a physical diagram
144 PowerDesigner
You now set the display mode of reference symbols by selecting a global
notation in the Model Options dialog box. Whereas in previous versions, it
was possible to set a different notation per diagram in the same model using
the reference display preferences. When you open a model saved in a
previous version, the reference notation in the default diagram is used to
initialize the model notation.
PowerDesigner supports the following notations:
Notation Displays Symbols
Relational Arrow
pointing to
primary key
CODASYL Arrow
pointing to
foreign key
Conceptual Cardinality
displayed in
IE format
(crow's feet)
IDEF1X Cardinality
and
mandatory
status
displayed on
reference
For more information on model options, see section PDM options in
chapter Physical Data Model Basics.
The referential integrity label indicates update and delete integrity, as
follows:
Label Referential integrity
upd() Update
del() Delete
cpa Change Parent Allowed
Reference display
mode
Referential integrity
label
Chapter 3 Building Physical Diagrams
PDM User's Guide 145
A letter between the parentheses indicates the type of constraint, as follows:
Label Referential integrity
( ) None
(R) Restrict
(C) Cascade
(N) Set null
(D) Set default
The default cardinality labels for PowerDesigner indicate the minimum and
maximum number of children as follows:
[minimum..maximum]
For example, the cardinality label [0..n] indicates that any number of children
is acceptable.
The referential integrity label shown below indicates the following:
Cascade on update
Set null on delete
Cardinality is 0..n (any number of children is acceptable).
Moving text on a reference symbol
When a reference symbol displays text, the text position is based on the
position of handles. You can add a handle on the reference symbol by
pressing CTRL while you click the symbol.
Modifying a reference graphically
From the physical diagram graphic, you can modify a reference as follows:
Bend a reference symbols
Straighten a reference symbol
Drag a reference to a different table
Select reference display mode
Default Cardinality
labels
Referential integrity
example
Defining references in a physical diagram
146 PowerDesigner
Bending a reference symbol
To bend a reference symbol:
1 Select SymbolFormat.
The Symbol Format dialog box appears.
2 Click the Line Style tab.
The Line Style page appears.
3 Select the jagged line symbol from the Corners drop down listbox.
4 Click OK.
5 Press CTRL while you click a point on the reference symbol where you
want to insert an angle.
This point becomes a handle.
6 Release CTRL.
7 Drag and drop the handle.
Straightening a reference symbol
To straighten a reference symbol:
1 Click a reference symbol that has angles.
Handles appear on the reference symbol.
2 Press CTRL while you click a handle.
The handle and its angle disappear.
Dragging a reference to a different table
To drag a reference to a different table:
1 Click a reference symbol.
2 Press CTRL while you drag one of its attach points to a different table.
Chapter 3 Building Physical Diagrams
PDM User's Guide 147
Selecting a reference display mode
You can set the display mode for reference symbols by selecting a notation
for the global model. PowerDesigner supports Relational, CODASYL,
Conceptual and IDEF1X notations.
For more information on reference display mode, see section Modifying
the reference display preferences.
Defining indexes in a physical diagram
148 PowerDesigner
Defining indexes in a physical diagram
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.
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.
Index properties
You can access index properties from a table property sheet:
Property Description
Name Name of the index
Code Reference name of the index
Comment Descriptive label for the index
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of index owner. You choose an owner from a list of users,
the index and table owners can be identical or different. An index
can only have one owner at a time. This is normally the index
creator
Table Indicate table to index
Type Proprietary index type (for Sybase IQ, and Oracle only)
Unique Indicate whether an index is a unique index
Cluster Indicate whether an index is a clustered index
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 149
An index also includes the following properties:
Property Description
Columns Columns associated with index. This includes column definition
indicating the primary key, foreign key, or alternate key to index.
The index is associated with the columns of the selected key
Options Physical options for the index. These are DBMS specific
Rules Business rules attached to the index
The following index types exist:
Type Description
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 DISTINCT statements when
data has more than 1000 unique values
HNG (Sybase IQ) HighNonGroup indexes make equality comparisons,
SUM and AVG calculations very fast when data has more than
1000 unique values. Nonequality 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, precision, and scale
WD (Sybase IQ) Is used to index keywords by treating the contents of
a CHAR or VARCHAR column as a delimited list
One clustered index per table
A table cannot have more than one clustered index.
Some DBMS allow you to define an index owner, either identical or different
from the table owner. If the DBMS of the current model does not support
index owners, the table owner will be automatically assigned to the index
after switching to a DBMS that supports index owners.
Index types
Index owner
Defining indexes in a physical diagram
150 PowerDesigner
Creating an index
You can either create a user defined index which is associated with one or
more columns, or create an index that you link to a primary key, alternate
key, or foreign key.
Use the following naming conventions for indexes:
Index Naming convention
Primary key Table code followed by PK; for example EMPLOYEE _PK
Foreign key Table code followed by FK; for example PROJECT _ FK
Alternate key Table code followed by AK; for example EMPLOYEE _ AK
You can indicate the index order for each column attached to an index, by
selecting Ascending or Descending in the Sort column for each column listed
on the Columns page of the Index property sheet.
Creating a user-defined index
To create a user defined index:
1 Double-click the table in the diagram to display the table property sheet.
2 Click the Indexes tab.
The Indexes page appears. It lists indexes associated with the table.
3 Click a new line in the list
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Index naming
conventions
Index ascending or
descending order
Chapter 3 Building Physical Diagrams
PDM User's Guide 151
4 Type an index name and an index code.
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The index property sheet opens to the General page.
6 Type or select index properties.
7 Click the Columns tab.
The Columns page appears. It lists columns associated with the index. At
index creation the list is empty as there are no columns yet associated
with an index.
8 Click the Add a Row tool.
A list of columns defined for the table appears.
9 Select one or more columns.
Click OK.
You return to the Columns page. The columns associated with the index
appear in the column list.
10 Select Ascending or Descending in the Sort column.
11 Click OK in each of the dialog boxes.
Defining indexes in a physical diagram
152 PowerDesigner
Creating an index linked to a key
When you link an index to a primary key, alternate key or a foreign key, the
index is automatically updated when the key column or columns are
modified.
A table contains a compound primary key. This is a primary key designated
to more than one column in a table. You create an index and link it to the
primary key. If one of the primary key columns is deleted, the corresponding
index associated with the column is also deleted.
To create an index linked to a key:
1 Double-click the table in the diagram to display the table property sheet.
2 Click the Indexes tab.
The Indexes page appears. It lists indexes associated with the table.
3 Click a new line in the list
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type an index name and an index code.
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 153
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The index property sheet opens to the General page.
6 Type or select index properties.
7 Click the Columns tab.
The Columns page appears. It lists columns associated with the index. At
index creation the list is empty as there are no columns yet associated
with the index.
8 Select the primary key; an alternate key, or foreign key from the
Columns definition dropdown list.
The index is linked to the selected key. The key columns associated with
the index appear in the column list.
Foreign key names
The foreign keys are represented by the name of the reference that
links the parent and child columns. For example, Refr:sales_title.
9 Select the A check box at the end of the column line, if you want index
entries to be in ascending order for that column.
or
Clear the A check box at the end of the column line, if you want index
entries to be in descending order for that column.
10 Click OK in each of the dialog boxes.
Creating a function-based index
In some DBMS, you can create indexes on functions and expressions that
involve one or more columns in the table being indexed. A function-based
index precomputes the value of the function or expression and stores it in the
index. The function or the expression will replace the index column in the
index definition.
Function-based indexes provide an efficient mechanism for evaluating
statements that contain functions in their WHERE clauses.
An index column with an expression has a LONG data type that cannot be
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.
Reverse
engineering
function-based
index
Defining indexes in a physical diagram
154 PowerDesigner
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.colu
mn_position||'%'
For more information on the use of variables in reverse engineering
queries, see section Extension mechanism for ODBC reverse engineering
queries, in chapter DBMS Reference Guide, in the Advanced User
Documentation.
Function-based indexes defined on UPPER(column_name) or
LOWER(column_name) can facilitate case-insensitive searches.
You want to define an index that will put all names in lowercase on the table
EMPLOYEE in order to ease search. You can define the following index
(syntax for Oracle 8i):
CREATE INDEX low_name_idx ON EMPLOYEE (LOWER(EMPLNAM))
Then the DBMS can use it when processing queries such as:
SELECT * FROM EMPLOYEE WHERE LOWER(EMPLNAM)="brown"
To create a function-based index:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Indexes tab to display the Index page.
3 Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type an index name and an index code.
5 Click Apply.
6 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The index property sheet opens to the General page.
7 Click the Columns tab to display the Columns page.
8 Click the Add a Row tool.
An arrow appears at the beginning of the line.
9 Click in the Expression column and select the Ellipsis button.
The SQL Editor dialog box appears.
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 155
10 Type an expression in the editor.
11 Click OK.
The index expression appears in the Name, Code, and Expression
columns in the Expression column in the list of index columns.
12 Click OK in each of the dialog boxes.
Defining indexes in a physical diagram
156 PowerDesigner
Removing a column from an index
To remove a column from an index:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Indexes tab.
The Indexes page appears. It lists indexes associated with the table.
3 Click an index in the list.
An arrow appears at the beginning of the line.
4 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The index property sheet appears.
5 Click the columns tab.
The Columns page appears. It lists the columns associated with the
index.
6 Select a column in the list of columns.
7 Click the Delete button.
8 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 157
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
model.
You can rebuild indexes for one or more tables in a physical diagram. You
can also choose to rebuild indexes from the model, or from a package.
You can indicate the following parameters to rebuild indexes:
Parameters Description
Primary key When selected, rebuilds primary key indexes. The text
box shows the naming convention for primary keys. By
default this is %TABLE%_PK
Other keys When selected, rebuilds alternate key indexes. The text
box shows the naming convention for alternate keys. By
default this is %AKEY%_AK
Foreign key indexes When selected, rebuilds foreign key indexes. The text
box shows the naming convention for foreign keys. By
default this is %REFR%_FK
Foreign key threshold Minimum number of estimated records in a table that
are necessary before a foreign key index can be created.
The estimated number of records is defined in the
Number box in the table property sheet. If the table has
no specified number of occurrences, the foreign key
indexes are generated by default
Delete and Rebuild When selected all existing indexes are deleted before
index rebuilding
Preserve Indexes When selected, preserves all existing indexes in a
physical diagram.
Rebuilding index
options
Defining indexes in a physical diagram
158 PowerDesigner
You can use the following variables:
You can use the following variables in the PK index names fields:
Variable Value
%TABLE% Generated code of the table. This is the table code generated in
the database. It may be truncated if the code contains characters
not supported by the DBMS
%TNAME% Table name
%TCODE% Table code
%TLABL% Table comment
You can use the following variables in the FK index name field. The
generated code of a variable is the code defined in the object property sheet,
it may be truncated when generated if the code contains characters not
supported by the DBMS
Variable Value
%REFR% Generated code of the reference
%PARENT% Generated code of the parent table
%PNAME% Parent table name
%PCODE% Parent table code
%CHILD% Generated code of the child
%CNAME% Child table name
%CCODE% Child table code
%PQUALIFIER% Parent table qualifier
%CQUALIFIER% Child table qualifier
%REFRNAME% Reference name
%REFRCODE% Reference code
PK index name
variables
FK index name
variables
Chapter 3 Building Physical Diagrams
PDM User's Guide 159
Rebuilding indexes from a model or from a package
To rebuild indexes from a model:
1 Select ToolsRebuild ObjectsRebuild Indexes.
The Rebuild Indexes dialog box appears.
2 Select rebuild options.
3 Click the Selection tab to display the selection page.
4 Select the model, for which you want to rebuild indexes, from the
dropdown list at the top of the page.
The tables in the selected model are displayed.
Rebuilding indexes in a package
To rebuild indexes in a package, select the package from the
dropdown listbox at the top of the page.
To rebuild indexes in a sub-package, select the Include Sub-Packages
icon next to the dropdown listbox, and then select a sub-package from
the dropdown list.
5 Select check boxes for tables containing indexes to rebuild.
Clear check boxes for tables containing indexes that you do not want to
rebuild.
6 Click OK.
Defining indexes in a physical diagram
160 PowerDesigner
A message box asks you to confirm the deletion and rebuilding of key
indexes.
7 Click the Yes button.
You return to the current model. All key indexes have been rebuilt.
Deleting an index
There are two ways to delete an index:
Delete an index from the list of indexes
Delete an index from a table
Deleting an index from the list of indexes
To delete an index from the list of indexes:
1 Select ModelIndexes.
The list of indexes appears.
2 Click the index to delete from in the list.
An arrow appears at the beginning of the line.
3 Click the Delete button.
4 Click OK.
Deleting an index from a table
To delete an index from a table:
1 Double-click a table in the diagram to display the table property sheet.
2 Click the Indexes tab.
The Indexes page lists indexes associated with the table.
3 Click the index that you want to delete from the list.
An arrow appears at the beginning of the line.
4 Click the Delete button.
5 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 161
Defining views in a physical diagram
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.
View properties
You can double-click any view symbol in a diagram to display its properties:
Property Description
Name Name for the view
Code Code for the view. This code is generated in database scripts
Comment Descriptive label for the view
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of view owner. You choose an owner from a list of users.
A view can only have one owner at a time. This is normally the
view creator
Usage Defines 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
Dimensional
type
Indicates the multidimensional type of the view, that is
Dimension or Fact
Type For those DBMS that support it, allows you to define the type of
a view. You can select materialized query table, materialized
view or summary table
Generate Includes view generation as part of database generation script
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
Defining views in a physical diagram
162 PowerDesigner
For more information on materialized views, materialized query tables,
and summary tables, see section Defining query tables in a physical diagram.
A view also includes the following properties:
Property Description
Columns Columns of the view
Triggers Triggers of the view
SQL Query SELECT statements defining the view
Preview SQL preview of view definition
View columns
The Columns page 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 section
Defining a query for a view.
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:
Chapter 3 Building Physical Diagrams
PDM User's Guide 163
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
When you select a column in the list of view columns and click the Properties
tool in the toolbar, the view column property sheet appears. You can define
the following properties from the view column property sheet:
Property Description
Name Name of the view column. This name is automatically 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 Code of the view column. The code is automatically 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 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
Stereotype View column stereotype
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
Precision Maximum number of places after the decimal point
You can also define notes and business rules on a view column.
You can modify the name and the code of a view column from the list. If you
need to recover the name or code default value, you have to clear the
corresponding cell in the list, the default name or code is automatically
restored.
View column
properties
User-defined name
or code
Defining views in a physical diagram
164 PowerDesigner
View triggers
You can define triggers on views for those DBMS that support this feature.
You create a trigger on a view when you want the view to behave like a table;
this feature allows you to define a trigger to fire when one or more attributes
of a table view column are modified.
The triggers you can define on a view are triggers of type "instead of".
To create a trigger on a view:
1 Open the view property sheet.
2 Click the Triggers tab to display the corresponding page.
3 Click the Add a Row tool to insert a new trigger in the list.
4 Click Apply and click the Properties tool to display the trigger property
sheet.
5 Click the Definition tab to display the corresponding page.
The trigger time type is instead of.
6 Select a trigger template in the Trigger Template dropdown listbox and
customize the template.
or
Type the template definition directly in the input zone.
7 Click OK.
Creating a view
There are several ways to create a view:
Create a view for tables and views selected in the diagram
Create an empty view then select tables and views from a list of tables
and views
At creation, a view has a default name including a number, this number is
assigned in the order of creation of objects.
Chapter 3 Building Physical Diagrams
PDM User's Guide 165
Creating a view for tables and views selected in the diagram
You can create a view for tables and views selected in the diagram. If the
selected tables and views are linked by references or view references, their
joins appear as conditions in the view query.
To create a view for tables and views selected in the diagram:
1 Select one or more tables and views in the diagram.
Multiple table selection
You can select multiple tables and views by holding down the SHIFT
key while you select tables in the diagram.
2 Select ToolsCreate View.
A view symbol appears in the diagram. It displays all the columns in
each of the tables and views selected for the view. The names for the
tables and views appear at the bottom of the view symbol.
Defining views in a physical diagram
166 PowerDesigner
3 Double-click the new view symbol to display the view property sheet.
4 Type a name and a code for the view.
5 Click OK.
Creating an empty view then selecting tables and views
To create an empty view then select tables and views:
1 Select ToolsCreate View.
Chapter 3 Building Physical Diagrams
PDM User's Guide 167
A selection box appears. It lists all the tables and views available in the
model.
2 Select check boxes for tables and views that you want to be included in
the view.
3 Click OK.
A view symbol appears in the diagram. It displays all the columns in
each of the tables and views selected for the view. The names for the
tables and views appear at the bottom of the view symbol.
4 Double-click the new view symbol to display the view property sheet.
5 Type a name and a code for the view.
6 Click OK.
Defining views in a physical diagram
168 PowerDesigner
Modifying view properties
You can modify the view properties using the following methods:
From the view property sheet
From the list of views
For more information on the different ways to modify the view
properties, see section Modifying object properties in chapter Managing
objects in the General Features Guide.
Using extended dependencies for views
Extended dependencies are links between physical diagram objects. These
links help to make object relationships clearer between model objects but are
not interpreted and checked by PowerDesigner as they are meant to be used
for documentation purposes only.
You can complement these links by applying stereotypes.
You can type stereotypes directly in the Stereotype column of the object
property sheet or select a value from the dropdown listbox if you have
previously defined stereotypes in an embedded or imported extended model
definition (.XEM).
You can use extended dependencies between a view and tables links in the
model.
Chapter 3 Building Physical Diagrams
PDM User's Guide 169
A view identified as Book Sales can have two extended dependencies
indicating that the view depends on the Title and Sale tables. The diagram
displays their extended dependencies and stereotypes.
For more information on extended model definitions, see Extended
Model Definitions in chapter Physical Data Model Basics.
For more information on extended dependencies, see Using Extended
Dependencies in the General Features Guide.
Defining a query for a view
You define queries for a view from the SQL Query page of the view property
sheet. Each SELECT query is shown in the Query dropdown listbox. The
definition for the selected query appears in the textbox.
You can add tables, views, synonyms, columns, and references to the view
from the property sheet for each query.
Based on your selection of tables, columns, views, synonyms, and references,
PowerDesigner generates a query in SQL syntax.
The resulting query uses FROM statements for tables and WHERE
statements for columns linked by joins in a reference.
Example
Selecting tables,
views, synonyms,
columns, and
references for a
view
Defining views in a physical diagram
170 PowerDesigner
Depending on the selected DBMS, you can construct links between tables
selected from the Query dropdown listbox. These links allow you to create
more complex queries.
Option The resulting query Example
Union Binds two or more SELECT
statements. The query result displays
all the retrieved data. Repeating query
results are not displayed
SELECT 1: ABC
SELECT 2: BCD
Result is ABCD
Union All Binds two or more SELECT
statements. The query result displays
all the retrieved data. Repeating query
results are displayed
SELECT 1: ABC
SELECT 2: BCD
Result is ABCBCD
Intersect Binds two or more SELECT
statements. The query result displays
all the retrieved data that is common
to the SELECT statements
SELECT 1: ABC
SELECT 2: BCD
Result is BC
Minus Binds two or more SELECT
statements. The query result displays
the difference between all the
retrieved data that is common to the
consecutive SELECT statements
(SELECT 1-SELECT 2-)
SELECT 1: ABC
SELECT 2: BCD
Result is AD
You can also construct a query using the SQL Editor. The SQL Editor
provides a more complete query definition environment than the SQL query
page.
In addition to standard SQL statements (SELECT, FROM, WHERE), the
SQL Editor offers greater flexibility through syntax tools for functions and
operators.
You can open the SQL Editor by clicking the Edit tool in the SQL Query
toolbar.
For more information on the SQL Editor, see section Using SQL tools
in chapter Physical Data Model Basics.
Creating relations
between selected
tables
Creating a query
with the SQL editor
Chapter 3 Building Physical Diagrams
PDM User's Guide 171
Creating relations between selected tables
To create relations between selected tables:
1 Double-click a view in the diagram to display the view property sheet.
2 Click the SQL Query tab.
The SQL Query page appears. It shows each SELECT query in the
Query dropdown listbox. The text for the query appears in the textbox.
3 Select a query from the Query dropdown listbox. This is the query that
contains the SELECT statement to which you want to add a table.
4 Click the Properties tool from the tool bar at the top of the page.
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Tables tab if you want to add a table to the view.
or
Click the Columns tab if you want to add columns to the view.
The Tables or Columns page appears. It lists the tables or columns
currently included in the SELECT statement.
Defining views in a physical diagram
172 PowerDesigner
6 Click the Add a Row tool.
Click the new line in the list.
or
Click a new line in the list.
A dropdown list appears. It lists all the available tables in the model, or
all the available columns for the tables currently defined for the view.
7 Select a table name.
or
Select a column name.
The table name, or column name, is added to the list.
Adding multiple tables or columns
You can add multiple tables or columns to a view by clicking a new
line in the list for each table or column that you want to add, and
selecting the appropriate table or column from the dropdown list.
8 Click OK.
You return to the SQL query page. The table and all of its columns, or
the selected new columns, are added to the SELECT statement. If you
select tables that share a reference link, the reference is automatically
added in a WHERE clause to the query.
9 Click OK.
The new table and columns appear in the view symbol.
Chapter 3 Building Physical Diagrams
PDM User's Guide 173
Selecting a reference for a view
To select a reference for a view:
1 Double-click a view in the diagram to display the view property sheet.
2 Click the SQL Query tab.
The SQL Query page appears. It shows each SELECT query in the
Query dropdown listbox. The text for a selected query appears in the
textbox.
3 Select a query from the Query dropdown listbox. This is the query that
contains the SELECT statement to which you want to add a table.
4 Click the Properties tool from the tool bar at the top of the page.
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Where tab.
The Where page appears. It shows the SQL expression for the parent
table column and the child table column that are linked by the =
operator.
6 Click the Add a Row tool.
Click in the first Expression column on the new line in the list.
or
Click in the first Expression column on a new line in the list.
Defining views in a physical diagram
174 PowerDesigner
A dropdown list appears. It lists all the available columns in the tables
defined for the view.
7 Select a column.
Click in the Operator column for the same line.
A dropdown listbox appears listing SQL operators.
8 Select the = operator.
Click in the second Expression column for the same line.
A dropdown listbox appears listing available columns.
Select a column.
9 Click OK.
10 You return to the SQL Query page. The new reference is added to the
WHERE clause.
Assigning an alias to a table or a column
You can assign an alias to a table or a column. You use this alias in the query
script instead of typing out the full code.
To assign an alias to a table or a column:
1 Double-click a view symbol to display the view property sheet.
2 Click the SQL Query tab.
Chapter 3 Building Physical Diagrams
PDM User's Guide 175
The SQL Query page appears. It shows each SELECT query in the
Query dropdown listbox. The text for a selected query appears in the
textbox.
3 Select a query from the Query dropdown listbox. This is the query that
contains the SELECT statement to which you want to add an alias to a
table or a column.
4 Click the Properties tool from the tool bar at the top of the page.
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Tables tab.
or
Click the Columns tab.
The Table or Columns page appears.
6 Click the number at the beginning of the line for the table or column to
which you want to assign an alias.
An arrow appears at the beginning of the line, and the line is highlighted.
7 Click the Alias column for the same line.
8 Type an alias in the Alias column.
9 Click OK in each of the dialog boxes.
Defining query properties
You can use the query property sheet to modify the tables and columns used
by the query.
You can also use it to add the following types of clauses to a query:
SQL clause Description
WHERE Specify search conditions
GROUP BY Divides rows into groups based on values in the columns
HAVING Specify grouping conditions
ORDER BY Sort query results by one or more columns
Defining views in a physical diagram
176 PowerDesigner
Defining the tables and columns of the query
The Tables and Columns pages display the tables and the columns on which
the query is based. You can modify both lists by adding or deleting items.
You can use the following tools available in the list cells:
The down arrow in the Name column opens a dropdown listbox where
you can select tables, views, columns and table or view synonyms
existing in the model
The Ellipsis button displays a SQL Editor in which you can define the
query corresponding to the current object
Using the SQL page
You can view the clauses that are inserted in the query from the SQL page of
the query property sheet. You can also edit the query manually from this
page.
Inserting a WHERE clause in a query
To insert a WHERE clause in a query:
1 From the Query property sheet, click the Where tab.
The Where page appears.
2 Click the Add a Row tool.
Click in the first Expression column for the new line in the list.
or
Click in the first Expression column for a new line in the list.
A down arrowhead appears.
3 Click the down arrowhead.
A dropdown listbox appears. It lists all the available columns in the
tables defined for the view.
4 Select a column.
Click in the Operator column for the same line.
A dropdown listbox appears listing SQL operators.
5 Select an operator.
Click in the second Expression column for the same line.
A dropdown listbox appears listing available columns.
Chapter 3 Building Physical Diagrams
PDM User's Guide 177
Expression column is not visible
You can make the second Expression column visible, by clicking the
Customize Columns and Filter tool from the tool bar at the top of the
page. From the selection box that appears, select the Expression
check box and click OK.
6 Select a column.
7 Type a prefix in the Prefix column.
Type a suffix in the Suffix column.
8 Click OK.
Inserting a GROUP BY clause in a query
To insert a GROUP BY clause in a query:
1 From the Query property sheet, click the Group By tab.
The Group By page appears.
2 Click the Add a Row tool.
Click the new line in the list.
or
Click a new line in the list.
A down arrowhead appears at the end of the line.
3 Click the down arrowhead.
A dropdown list appears. It lists all the available columns in the tables
defined for the view.
4 Select a column.
The Column name appears in the list.
Customizing an expression
You can customize a column expression by clicking the Ellipsis
button next to the down arrowhead. An SQL Editor appears. Type an
expression in the textbox and click OK. The new expression appears
in the column list.
5 Click OK.
The selected columns appear in a GROUP BY clause in the textbox
containing the SQL statement in the SQL Query page.
Defining views in a physical diagram
178 PowerDesigner
Inserting a HAVING clause in a query
To insert a HAVING clause in a query:
1 From the Query property sheet, click the Having tab.
The Having page appears.
2 Click the Add a Row tool.
3 Click in the first Expression column for a new line in the list.
A down arrowhead appears.
4 Click the down arrowhead.
A dropdown listbox appears. It lists all the available columns in the
tables defined for the view.
Customizing an expression
You can customize an expression by clicking the Ellipsis button next
to the down arrowhead. An SQL Editor appears. Type an expression
in the textbox and click OK. The new expression appears in the
Expression column.
5 Select a column.
Click in the Operator column for the same line.
A dropdown listbox appears listing SQL operators.
6 Select an operator.
Click in the second Expression column for the same line.
A dropdown listbox appears listing available columns.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. See the Defining a filter on a list section in
the General Features Guide.
7 Select a column.
8 Type a prefix in the Prefix column.
Type a suffix in the Suffix column.
9 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 179
Inserting an ORDER BY clause in a query
To insert an ORDER BY clause in a query:
1 From the Query property sheet, click the Order By tab.
The Order By page appears.
2 Click the Add a Row tool.
Click the new line in the list.
or
Click a new line in the list.
A down arrowhead appears at the end of the line.
3 Click the down arrowhead.
A dropdown list appears. It lists all the available columns in the tables
defined for the view.
4 Select a column.
The Column name appears in the list.
Customizing an expression
You can customize a column expression by clicking the Ellipsis
button next to the down arrowhead. An SQL Editor appears. Type an
expression in the textbox and click OK. The new expression appears
in the column list.
5 Click OK.
The selected columns appear in an ORDER BY clause in the textbox
containing the SQL statement in the SQL Query page.
Displaying query syntax
You can display each query that PowerDesigner will generate based on the
view definition.
To display query syntax:
1 Double-click a view symbol to display the view property sheet.
2 Click the SQL Query tab.
Defining views in a physical diagram
180 PowerDesigner
The SQL Query page displays the syntax of each query that
PowerDesigner generates based on your view definition.
3 Select a SELECT statement from the Query dropdown listbox.
The query definition is displayed in the textbox.
4 Click OK.
Defining a generation order for views
You can use extended dependencies to define an order in the generation of
views.
Extended dependencies are free links between PDM objects. These links help
to make object relationships clearer between model objects. Usually, these
links are not interpreted and checked by PowerDesigner as they are meant to
be used for documentation purposes only. However, if you assign the
<<DBCreateAfter>> stereotype to an extended dependency between views,
it will be analyzed during generation.
The view from which you start the extended dependency is the dependent
view and the view at the other end of the link is the influent view. The
influent view will be generated before the dependent view.
If you create a reflexive and/or circular set of extended dependencies with the
<<DBCreateAfter>> stereotype, an error message appears 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.
Circular extended
dependencies
Chapter 3 Building Physical Diagrams
PDM User's Guide 181
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
page of the view property sheet:
You decide to create another view called COMPUTER COUNTER to show
only part of the department store offer. This view is created from the view
DEPARTMENT STORE, and retrieves information from it.
By default views are generated in alphabetical order, so the generation of
COMPUTER COUNTER will fail since the view DEPARTMENT STORE
from which it depends is not generated. To bypass this problem, you can
create a extended dependency with the <<DBCreateAfter>> stereotype from
COMPUTER COUNTER to DEPARTMENT STORE.
This allows you to set an order in the generation of views: DEPARTMENT
STORE will be generated before COMPUTER COUNTER.
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 section
Defining a generation order for stored procedures in chapter Triggers and
Procedures.
Example
Defining views in a physical diagram
182 PowerDesigner
To define a generation order for views from the diagram:
1 Select the Extended Dependencies tool in the palette.
2 Click inside the dependent view and while holding down the mouse
button, drag the cursor into the influent view. Release the mouse button.
3 Double-click the extended dependency link.
The dependent view property sheet opens to the Extended Dependencies
tab. you can check that the influent view appears in the Influent Object
column of the list of extended dependencies.
4 Click inside the Stereotype column, click the down arrow and select
<<DBCreateAfter>> in the dropdown listbox.
5 Click OK.
For more information on extended dependencies, see Using Extended
Dependencies in the General Features Guide.
Chapter 3 Building Physical Diagrams
PDM User's Guide 183
Modifying the view display preferences
You can modify the display preferences for a view and for the columns of a
view using the ToolsDisplay Preferences command.
Text display
preference When selected, what it displays
Columns All columns in the view, an asterisk (*) for multiple column
selection, or a defined number (limit) of columns depending on
the selections listed below*
*All columns All columns in the view. Multiple column selection is represented
by an asterisk (*)
*Limit (x) Number of columns depending on defined value of x
Tables Tables in the view
Indexes For those DBMS that support query tables, indexes in the views
of type materialized view, summary table or snapshot
Owner Name of view owner
Stereotype Stereotype of the view
Text display
preference When selected, what it displays
Name View column name
Expression SQL expression for each view column
Data types Data type for each view column
Index indicator For those DBMS that support query tables, indicator next to
indexed columns
For more information on query tables, see section Defining query tables
in a physical diagram.
View display
preferences
View column
display preferences
Defining view references in a physical diagram
184 PowerDesigner
Defining view references in a physical diagram
A view reference is a link between a parent table or view and a child table or
view. It is used to define a set of predefined joins between the columns of the
parent and the child table or view.
View references are not generated in the database.
Table Orders is the parent of view Customer_Order.
View reference properties
You can double-click any view reference symbol in a diagram to display its
properties:
Property Description
Name Name for the view reference. This name improves the readability
of the model
Code Code for the view reference
Comment Descriptive label for the view reference
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-defined
Parent Parent table or view of the view reference
Parent role Role of the parent table or view in the view reference. The text
appears in the diagram, near the parent table or view
Child Child table or view of the view reference
Child role Role of the child table or view in the view reference. The text
appears in the diagram, near the child table or view
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 185
A view reference also includes joins, that are links between parent columns
and child columns.
Creating a view reference
You can create a view reference between two views or between a table and a
view. A view reference cannot link two tables.
To create a view reference:
1 Click the Reference tool in the tool palette.
Same tool for Reference and View Reference
You use the same tool to create references or view references.
Depending on the origin and destination of the link, a reference or a
view reference is created.
2 Click inside the child table or view and while holding down the mouse
button, drag the cursor into the parent table or view. Release the mouse
button.
The link appears between the objects.
Dragging a view reference to a different table or view
You can change the table or view at either end of a view reference by
clicking the view reference and holding down CTRL as you drag one
of its attach points to a different table or view.
3 Click the Pointer tool.
or
Click the right mouse button.
You release the Reference tool.
4 Double-click the new link in the diagram to display the view reference
property sheet.
Defining view references in a physical diagram
186 PowerDesigner
5 Type a view reference name and a view reference code.
You can open the property sheet of the child and parent by clicking the
Child and Parent buttons located in the upper part of the view reference
property sheet.
6 Click OK.
Defining view reference joins
A join is a link between a column in a parent table or view and a column in a
child table or view that is defined within a view reference.
If you create a new view from existing views, the joins defined on these
views influence the WHERE statement in the SQL query of the new view.
Chapter 3 Building Physical Diagrams
PDM User's Guide 187
French_Store is a view of table Store. You define a join between Store_ID in
the table and STORE_STORE_ID in the view.
Customer_Orders is a view of table Orders. You define a join between
Order_No in the table and ORDER_ORDER_N in the view.
You create a view reference between French_Store and Customer_Order in
which you define a join between ORDER_ORDER_STORE and
STORE_STORE_ID. This is to establish a correspondence between the store
ID and the store where the order is sent.
If you create a view from French_Store and Customer_Orders, you can check
in the SQL query page of the view that the SELECT order takes into account
the join defined between the views. The SELECT statement will retrieve
orders sent to French stores only.
In the Joins page of a view reference property sheet, you can use the Reuse
Columns tool to reuse existing child columns with same code as parent
columns.
Example
Defining view references in a physical diagram
188 PowerDesigner
To define joins in a view reference:
1 Double-click a view reference in the diagram to display the view
reference property sheet.
2 Click the Joins tab to display the Joins page.
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 dropdown
listbox.
5 Click in the Child Column column and select a column in the dropdown
listbox.
6 Click OK.
Chapter 3 Building Physical Diagrams
PDM User's Guide 189
Changing a table or view at either end of a view reference
You can change the parent or child table or view of a view reference using
one of the following methods:
Dragging a view reference end to another table or view in the diagram
Selecting a different table or view from the view reference property sheet
Selecting a different table or view from the list of view references
For more information on changing table or view at either end of a view
reference, see section Changing a table at either end of a reference.
Modifying the view reference display preferences
You can modify the following display preferences for a view reference using
the ToolsDisplay Preferences command:
Label Displays
Name Name or code of the view reference
Join Statement of linked columns between the two tables or views
Stereotype Stereotype of the view reference
Role names Role names for parent and child tables or views of the view
reference
You now set the display mode of view reference symbols by selecting a
global notation in the Model Options dialog box. Whereas in previous
versions, it was possible to set a different notation per diagram in the same
model using the view reference display preferences. When you open a model
saved in a previous version, the reference notation in the default diagram is
used to initialize the model notation.
PowerDesigner supports the following notations:
Label Displays
Relational Arrow pointing to parent
CODASYL Arrow pointing to child
Conceptual Cardinality displayed in IE format (crow's feet)
IDEF1X Cardinality and mandatory status displayed on reference
View reference
display mode
Defining view references in a physical diagram
190 PowerDesigner
For more information on model options, see section PDM options in
chapter Physical Data Model Basics.
To modify the view reference display preferences:
1 Select ToolsDisplay Preferences.
The Display Preferences dialog box opens to the Objects page.
2 Select View Reference under the Object View node in the Category tree
view to display the table page.
3 Select or clear the check boxes in the View Reference groupbox.
4 Select a display mode in the Display Mode groupbox.
5 Click OK.
Modifying a view reference graphically
From the physical diagram graphic, you can modify a view reference as
follows:
Bend a view reference symbol
Straighten a view reference symbol
Select a view reference display mode
For more information on modifying a view reference graphically, see
section Modifying a reference graphically.
Chapter 3 Building Physical Diagrams
PDM User's Guide 191
Defining query tables in a physical diagram
A query table is a table whose data proceeds from the result of a query. In
PowerDesigner, you design a query table using a view with a specific type,
depending on the DBMS.
In DB2 CS7, you design a query table using a view with the summary table
type. In later versions of DB2, you should use the materialized query table
type.
For more information on summary tables and materialized views, see
DB2 documentation.
In Oracle, you design a query table using a view with the materialized view
type. Materialized view is the new recommended name for snapshots that
were used before version 8i.
For more information on materialized views and snapshots, see Oracle
documentation.
Defining a view as a query table
You define a view as a query table by selecting the query table or
materialized view type in the view property sheet.
DB2
Oracle
Defining query tables in a physical diagram
192 PowerDesigner
The query creation order of DB2 summary table is of type:
create summary table VIEW_1 as
...
The query creation order of DB2 materialized query table is of type:
create table VIEW_1 as
...
The query creation order of Oracle materialized view is of type:
create materialized view VIEW_1 as
...
The query creation order of an Oracle snapshot is of type:
create snapshot VIEW_1 as
...
If you change the DBMS of a model containing query tables, these are
converted into regular views.
Query tables support physical options. When you select a query table type in
the view property sheet, the Options tab automatically appears to let you
define physical options for view generation.
Defining an index in a query table
You can create an index associated with the columns of a query table. In this
section, these indexes are called view indexes. Query table indexes behave
like indexes defined on tables, they are data structures that improve database
performance and access speed. You normally create indexes for columns that
you access regularly, and where response time is important.
Physical options
Chapter 3 Building Physical Diagrams
PDM User's Guide 193
View index properties
You access view index properties from the view property sheet:
Property Description
Name Name of the view index
Code Reference name of the view index
Comment Descriptive label for the view index
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of view index owner. You choose an owner from a list of
users, the view index and view owners can be identical or
different. A view index can only have one owner at a time. This
is usually the view index creator
View View for which the view index is defined
Type Proprietary view index type (for those DBMS that support it). In
Oracle, you can select the bitmap type. A bitmap index is used
when you want to use a bitmap for each key value instead of a list
of row Ids
Unique Indicates whether the view index is a unique index
Cluster Indicates whether the view index is a clustered index
A view index also includes the following properties:
Property Description
Columns Columns associated with view index
Options Physical options for the view index. These are DBMS specific
Rules Business rules attached to the view index
Creating a view index in a query table
You create a view index from the property sheet of a view of type summary
table, materialized view, or snapshot.
To create a view index in a query table:
1 Double-click a query table in the diagram to display the view property
sheet.
Defining query tables in a physical diagram
194 PowerDesigner
2 Click the Indexes tab.
The Indexes page appears. It lists indexes associated with the view.
3 Click a new line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type an index name and code and click Apply.
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The index property sheet opens to the General page.
6 Type or select index properties.
7 Click OK in each of the dialog boxes.
Adding a column to a view index in a query table
View indexes are defined on the columns of a query table.
You can indicate the index order for each column attached to a view index,
by selecting Ascending or Descending in the Sort column for each column
listed on the Columns page of the view index property sheet.
To add a column to a view index in a query table:
1 In the view index property sheet, click the Columns tab.
The Columns page appears. It lists columns associated with the index. At
index creation, the list is empty as there are no columns yet associated
with an index.
2 Click the Add a Row tool.
A list of columns defined for the table appears.
3 Select one or more columns and click OK.
You return to the Columns page. The columns associated with the index
appear in the column list.
4 Select Ascending or Descending in the Sort column of each column.
5 Click OK in each of the dialog boxes.
Chapter 3 Building Physical Diagrams
PDM User's Guide 195
Defining check parameters in a PDM
Check parameters are set of conditions which data must satisfy to remain
valid.
There are three types of check parameters:
Parameter type Description
Can be
attached to
Standard check
parameters
Common data constraints which define a
data range. For example minimum and
maximum values for a column
Columns
Domains
Additional check
parameters
SQL expression defining a data
constraint using the %MINMAX%,
%LISTVAL%, and %RULES% variables
that are instantiated with standard
parameter values
Columns
Domains
Validation rule Business rule that is defined as a server
expression, and is attached to one of the
following listed objects
Tables
Columns
Domains
Setting standard check parameters for objects in a PDM
Standard parameters indicate common data constraints. The following table
lists standard parameters:
Parameter Description
Minimum Lowest acceptable numeric value
Maximum Highest acceptable numeric value
Default Value selected from a list of default values or typed in the
listbox. The list of values is defined in the
Script\Keywords\ReservedDefault entry of the DBMS
definition file
Format Data format (for example, 9999.99)
Unit Standard measure
Lowercase Forces all alphabetical characters to lowercase
Uppercase Forces all alphabetical characters to uppercase
Defining check parameters in a PDM
196 PowerDesigner
Parameter Description
Cannot Modify Protects from changes, results in a non-modifiable column in
the table when generated in the database
List of Values Authorized values
Label String that identifies an authorized value in the list
For more information on defaults, see section Defining defaults in a
PDM.
To set standard parameters:
1 Select ModelDomains.
or
Select ModelColumns.
The List of Domains or List of Columns appears.
2 Click a domain in the list.
or
Click a column in the list.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the domain or column appears.
4 Click the Standard Checks tab.
Chapter 3 Building Physical Diagrams
PDM User's Guide 197
The Standard Checks page appears.
5 Type your choice of Standard Parameters.
6 Click OK.
For more information on additional check parameters, see section
Defining additional check parameters for objects in a PDM.
For more information on validation rules, see section Using a validation
rule in check parameters in a PDM.
For more information on quotation marks, see section Managing
quotation marks around values.
Defining check parameters in a PDM
198 PowerDesigner
Defining additional check parameters for objects in a PDM
You can write an SQL statement using the following standard variables
defined as standard check parameters and validation rules:
Variable Description
%MINMAX% Minimum and maximum values defined in Values groupbox on
Standard Checks page
%LISTVAL% Customized values defined in List Values groupbox on
Standard Checks page
%RULES% Validation rule expression defined on Expression page of the
Rules property sheet
You define additional check parameters for data constraints where standard
check parameters are not sufficient.
A table in a data model for a clothing shop may contain check parameters
defined for a column SIZE, which depend on the check parameters defined
on another column 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.
To define additional check parameters:
1 Select ModelDomains.
or
Select ModelColumns.
The List of Domains or List of Columns appears.
2 Click a domain in the list.
or
Click a column in the list.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the domain or column appears.
4 Click the Additional Checks tab.
Example
Chapter 3 Building Physical Diagrams
PDM User's Guide 199
The Additional Checks page appears.
5 Type SQL expression using the variables %MINMAX%, %LISTVAL%,
and %RULES%.
6 Click OK.
Using a validation rule in check parameters in a PDM
A validation rule is a rule that validates data based on a corresponding
business rule. A validation rule can be generated as a check parameter when
the following conditions apply:
Validation rule is attached to a table, column, or domain
Validation rule is defined as a server expression
At generation, validation rule variables are instantiated with the following
values:
Variable Value
%COLUMN% Code of the column to which the business rule applies
%DOMAIN% Code of the domain to which the business rule applies
%TABLE% Code of the table to which the business rule applies
%MINMAX% Minimum and maximum values for the column or domain
Defining check parameters in a PDM
200 PowerDesigner
Variable Value
%LISTVAL% List values for the column or domain
%RULES% Server validation rules for the column or domain
For more information on defining business rules, see chapter Using
Business Rules.
To use a validation rule in check parameters:
1 Select ModelTables.
or
Select ModelDomains.
or
Select ModelColumns.
The List of Tables, or List of Domains or List of Columns appears.
2 Click a table in the list.
or
Click a domain in the list.
or
Click a column in the list.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
A property sheet appears.
4 Click the Rules tab.
The Rules page appears.
5 Click the Add button.
A list appears displaying the available business rules in the model.
6 Select a business rule in the list.
7 Click OK in each of the dialog boxes.
Validation rule expressions
You must click the Rules button to modify the expression attached to
a validation rule. You can also modify validation rule expressions
from the list of business rules, by clicking the Define button.
Chapter 3 Building Physical Diagrams
PDM User's Guide 201
Managing quotation marks around values
For a domain or a column, standard parameters can indicate minimum,
maximum, and default values as well as a list of values.
In general, if the data type of domain or column is a string data type,
quotation marks surround its values in the generated script. The generation of
single or double quotation marks depends on the target DBMS.
However, quotation marks are not generated in the following cases:
You define a data type that is not recognized as a string data type by
PowerDesigner
Value is surrounded by tilde characters
Value is a keyword defined in the DBMS (for example, NULL)
In addition, if the value is already surrounded by quotation marks additional
quotation marks are not generated.
The following table shows the way a value for a string data type is generated
in a script:
Value for string data type Result in script
Active 'Active'
'Active' 'Active'
"Active" '"Active"'
Active Active
NULL NULL
Defining physical options for a PDM
202 PowerDesigner
Defining physical options for a PDM
A physical option is a parameter that defines how an object is optimized or
stored in a database. Physical options can be included at the end of a Create
statement and are DBMS-specific.
There are two types of physical options:
Default physical options in a model
Physical options for a specific object
Default physical options can be used for all objects in a model or selected
objects only. Physical options only apply to a specific object. When default
physical options have been defined for a model, any new object you create
takes the default physical option values.
Physical options for specific objects are used to override the default physical
option values.
You define physical options with tools to move options between the Syntax
and the Option pane. The same environment is available for the default
physical options in a model and the physical options for a specific object.
The left pane contains the syntax for the physical options available. The right
pane contains the physical options that have been selected for the object. You
use the following tools to add physical options to, or remove from, the
current object:
Tool Action when clicked
Adds physical option selected in Syntax page (left pane) to Items page
(right pane)
Aligns a selected physical option in the Items page with the
corresponding physical option in the Syntax page
Removes physical option selected in Items page
Tools and selection
layout
Chapter 3 Building Physical Diagrams
PDM User's Guide 203
The syntax for a physical option also depends on the DBMS. The Syntax
page displays an option syntax that is recognized by the current DBMS. The
following is an example of a syntactical difference for the tablespace option
in different DBMS:
DBMS Tablespace option syntax
Oracle 6.0 or higher Tablespace
Sybase Adaptive Server
Anywhere
In
When you change DBMS, the physical option settings apply to the new
DBMS. If a specific physical option was selected in the model, the default
value is preserved for the option in the new DBMS. Unselected physical
options are reset with the new DBMS default values.
For more information on model options, see Defining PDM options in
chapter Physical Data Model Basics.
Defining default physical options
Default physical options define physical options for an entire model. When
default physical options have been defined for a model, any new object you
create takes the default physical option values.
You define default physical options in the Default Physical Options property
sheet accessible from the Database menu. The Default Physical Options page
has tabs corresponding to each type of object in the model.
When you define default physical options, these values replace those defined
in the DBMS definition file that is attached to the model. If you want your
new values for default physical options to apply to all models using a DBMS,
you need to connect the DBMS as Shared. If you assign values to a DBMS
connected as Copy, the default values apply only to the current model.
For information on connecting the DBMS, see chapter Database
Creation and Modification.
The values you assign for default physical options can be included in a
database creation script that you generate from a PDM, or can be directly
generated in the target database via ODBC. You select the appropriate
default physical options from the Selection page of the Database Generation
dialog box.
You can view the script for a physical option in the Preview page for the
object for which it is defined.
DBMS syntax
Changing DBMS
DBMS connection
and default
physical options
Generating default
values
Defining physical options for a PDM
204 PowerDesigner
Physical option default values can also be reverse engineered from a database
into a PDM.
You can select objects to which the default physical options apply to.
If you click the Apply To button and select all objects from the Selection
page, default physical options apply to all existing objects in the model.
When you click OK, default physical options apply to all future objects in the
model.
If you select only some objects, default physical options apply to selected
objects in the model. When you click OK, physical options apply to all future
objects of the selected type in the model.
To define default physical options:
1 Select DatabaseDefault Physical Options to display the Default
Physical Options property sheet. The Table page opens by default.
The Syntax page in the left pane lists the table options available.
2 Select an option from the list on the Syntax page in the left pane.
3 Click the Add tool.
The name of the option appears on the Items page in the right pane.
4 <Optional> Expand the option on the Items page and select one of its
parameters.
Selecting objects
for physical options
Chapter 3 Building Physical Diagrams
PDM User's Guide 205
The parameter name appears with an equals sign next to a text box at the
bottom of the right pane. Depending on the type of value the parameter
can take, a dropdown listbox may appear instead of a text box.
5 Type a value for the parameter in the text box.
or
Select a value for the parameter in the dropdown listbox.
The parameter on the Items page displays the value.
6 If required, select another parameter and similarly type or select a value
for it.
7 Repeat steps 2 to 6 to define the default options you want.
8 <optional> Click the Apply To button to open a selection list and select
the tables to which the table options apply.
The Apply To button is not available for the Database option.
9 Click other options tabs and similarly define other default physical
options.
10 Click OK in each of the dialog boxes.
Defining physical options
In ASA 6, you can define physical options for tables, columns, indexes,
tablespaces, and databases. Depending on the selected DBMS, options for
keys, storages, and sequences may also be available.
Defining physical options for a PDM
206 PowerDesigner
Physical options are not supported for certain databases.
If values for default physical options have been created for the current model,
these values are automatically assigned to objects. Any new object created
automatically receives these default values. You can set physical options for
selected objects to override these default physical options.
For more information on default physical options, see Defining default
physical options.
You can select objects to which the physical options apply to.
If you click the Apply To button and select all objects from the Selection
page, physical options apply to all existing objects in the model. If you select
only some objects, physical options apply to selected objects in the model.
When you click OK, physical options apply to the current object.
You can choose a tablespace or storage already defined in the model as a
value for a tablespace or storage that you define for a table. These are listed
in a dropdown listbox below the right pane in the Options page.
Database prefix in DB2 OS/390
By default, tablespaces are prefixed by the name of the database attached
to the model in DB2 OS/390. See chapter DBMS-specific Features for
more information
Effect of default
physical options
Selecting objects
for physical options
Tablespace and
storage options
Chapter 3 Building Physical Diagrams
PDM User's Guide 207
For more information on defining tablespaces and storages, see chapter
Database Creation and Modification.
To define physical options:
1 Open the property sheet of the object to which you want to assign a
physical option value.
2 Click the Options tab to display the Options page.
The syntax page in the left pane lists the database options available.
These options are DBMS specific. The Options page that appears below
shows the column physical options available for IBM DB2 UDB 5.X
Common Server.
3 Select an option from the options listed on the Syntax page in the left
pane.
4 Click the Add tool.
The name of the option appears on the Items page in the right pane.
5 <Optional> Expand the option and select one of its parameters.
6 Select the option (or parameter) in the Items page in the right pane.
Defining physical options for a PDM
208 PowerDesigner
The option name appears with an equals sign next to a text box at the
bottom of the right pane. Depending on the type of value the option can
take, a dropdown listbox may appear instead of a text box.
7 Type a value for the option (or parameter) in the text box
or
Select a value from the dropdown listbox.
8 <Optional> Click Apply to which opens a selection list.
9 Select the tables to which the options will apply.
10 Click OK.
For more information on using a selection list, see section Adding an
item from a selection list in chapter Using the PowerDesigner Interface in the
General features Guide.
PDM User's Guide 209
C H A P T E R 4
Building Multidimensional Diagrams
This chapter describes how to build a multidimensional diagram in a Physical
Data Model. It explains the role of each object in a multidimensional
diagram, and also shows how to modify them.
Topic Page
Multidimensional diagram basics 210
Defining dimensions in a multidimensional diagram 213
Defining attributes in a multidimensional diagram 217
Defining hierarchies in a multidimensional diagram 220
Defining cubes in a multidimensional diagram 223
Defining facts in a multidimensional diagram 227
Defining measures in a multidimensional diagram 231
Defining associations in a multidimensional diagram 235
About this chapter
Contents
Multidimensional diagram basics
210 PowerDesigner
Multidimensional diagram basics
You can create multidimensional diagrams in a PDM.
Defining a multidimensional diagram
A multidimensional diagram is a model of business activities in terms of
cubes and dimensions. It organizes business data into one or other of these
categories. Numeric values or measures such as sales total, budget limits, are
the facts of the business. The area covered by a business, in terms of
geography, time, or products are the dimensions of the business.
The multidimensional diagram is used to design an OLAP database.
Information in an OLAP database is organized to facilitate the queries
performed by different tools.
OLAP databases are populated with data from a data warehouse or data mart
database. This data transfer is implemented via a relational to
multidimensional mapping, the data warehouse or data mart database being
the data source of the OLAP database. The OLAP cube is designed to
support multidimensional analysis queries, it is organized according to user-
defined dimensions.
For more information on the relational to multidimensional mapping,
see section Defining a relational to relational mapping in chapter Working
with Physical Data Models.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 211
Sales data can have the dimensions product, region, customer, and store.
Facts, for example, the sales totals, are viewed through the user-defined
dimensions. When you retrieve the sales total of a particular product for a
particular region, you are viewing the sales total through the product and
region dimensions. The most common dimension is time because the purpose
of multidimensional analytical queries is to find trends.
Why build a multidimensional diagram?
The multidimensional diagram is used to design the cubes in an OLAP
engine, together with the different analysis dimensions.
Business analysts use OLAP databases to send queries and retrieve business
information from the different dimensions existing in the database.
Multidimensional analysis queries usually involve calculated lists, such as
growth and decline rates and time-based comparisons. They aim at detecting
trends and relationships. These types of queries are supported by an OLAP
database, but not by an operational database.
Creating a multidimensional diagram
You can create a multidimensional diagram using different methods.
For more information on creating a multidimensional diagram in a new
PDM, see section Creating a PDM, in chapter Physical Data Model
Basics
Example
Multidimensional diagram basics
212 PowerDesigner
For more information on creating a multidimensional diagram in an
existing PDM, see section Creating a new diagram in the General
Features Guide
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 213
Defining dimensions in a multidimensional
diagram
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.
The dimension can be mapped to tables or views: this mapping allows to
transfer operational data to the dimension.
For more information on object mapping, see section Mapping objects
in a PDM in chapter Working with Physical Data Models.
A dimension may have one or more hierarchies representing attribute sets.
Dimension properties
You can double-click any dimension symbol in a diagram to display its
properties:
Property Description
Name Name for the dimension. This name improves the readability of
the model
Code Reference code for the dimension
Comment Descriptive label for the dimension
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Default
Hierarchy
Dimension hierarchy used by default for a cube to perform its
consolidation calculations. The hierarchy used by the cube is
defined on the cube dimension association
Defining dimensions in a multidimensional diagram
214 PowerDesigner
A dimension definition also includes the following properties:
Property Description
Attributes List of attributes that qualify the dimension
Hierarchies List of hierarchies used to organize the dimension attributes
Mapping Defines the mapping between the current dimension and a
table or a view in a data source
Notes Description associated with the dimension
Rules Business rules associated with the dimension
Extended
Dependencies
User defined semantic dependencies between objects in the
model
Dependencies Relationship between two modeling elements, in which a
change to the influent element will affect the dependent
element
Version Info Dimension owner, version number, modification and creation
details
Creating a dimension
There are several ways to create a dimension:
From a diagram
From the Browser
From the list of dimensions
At creation, a dimension has a default name including a number, this number
is assigned in the order of creation of objects.
For more information on the different ways to create a dimension, see
section Creating an object in chapter Managing objects in the General
Features Guide.
To create a dimension from a diagram:
1 Click the Dimension tool.
2 Click an empty space in the diagram.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 215
The following symbol appears at the click position:
3 Click the Pointer tool.
4 Double-click the new dimension symbol in the diagram to display the
dimension property sheet.
5 Type a name and a code.
6 Click OK.
Modifying dimension properties
You can modify the dimension properties using the following methods:
From the dimension property sheet
From the list of dimensions
For more information on the different ways to modify the dimension
properties, see section Modifying object properties in chapter Managing
objects in the General Features Guide.
Defining dimensions in a multidimensional diagram
216 PowerDesigner
Modifying the dimension display preferences
You can modify the following display preferences for a dimension using the
ToolsDisplay Preferences command:
Text display
preference When selected, what it displays
Attributes Shows the dimension attributes
All Attributes If the Attributes check box is selected, allows to display all
attributes in the dimension symbol
Limit If the Attributes check box is selected, allows to restrict the
display of attributes to a given number
Hierarchies Shows the dimension hierarchies
Default Hierarchy Displays <Default> beside the default hierarchy in the
dimension symbol
Stereotype Displays the stereotype of the dimension. You can also
display the stereotype of the dimension attributes and
hierarchy
Text display preference When selected, what it displays
Indicators of Hierarchy If the Attributes check box is selected, displays
the hierarchies indicators for attributes
Levels of Hierarchy If the Attributes check box is selected, displays
the hierarchies level for attributes
Default options
Click the Default button to display default dimension display preferences.
Click the Set As Default button to set current display preferences as
default selections.
Dimension display
Attribute display
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 217
Defining attributes in a multidimensional
diagram
An attribute is used to qualify dimensions used in queries. For example, the
Time dimension can contain attributes Year, Quarter, Month, and Week.
Attributes can be organized in hierarchies.
For more information on hierarchies, see section Defining hierarchies in
a multidimensional diagram.
Attribute properties in a multidimensional diagram
You can access the attribute properties from the dimension property sheet:
Property Description
Name Name for the attribute. This name improves the readability of
the model
Code Reference code for the attribute
Comment Descriptive label for the attribute
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Dimension Parent dimension of the attribute
Defining attributes in a multidimensional diagram
218 PowerDesigner
An attribute definition also includes the following properties:
Property Description
Notes Description associated with the attribute
Rules Business rules associated with the attribute
Dependencies User defined semantic dependencies between objects in the
model
Version Info Attribute owner, version number, modification and creation
details
Creating an attribute in a multidimensional diagram
You create an attribute from the dimension property sheet. To display the
dimension property sheet:
Double-click the dimension symbol
Right-click the dimension node in the Browser and select Properties
At creation, an attribute has a default name including a number, this number
is assigned by default in the order of creation of objects.
To create an attribute:
1 Select the Attributes tab in the dimension property sheet.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 219
3 Type a name and a code.
4 Click OK.
Modifying attribute properties in a multidimensional diagram
You can modify the attribute properties using the following methods:
From the attribute property sheet
From the list of attributes
For more information on the different ways to modify the attribute
properties, see section Modifying object properties in chapter Managing
object in the General Features Guide.
Defining hierarchies in a multidimensional diagram
220 PowerDesigner
Defining hierarchies in a multidimensional
diagram
A hierarchy defines navigational and consolidation paths through
dimensions.
As an organizational path, the hierarchy 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.
As a consolidation path, the hierarchy can represent 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.
Hierarchy properties
You can access the hierarchy properties from the dimension property sheet:
Property Description
Name Name for the hierarchy. This name improves the readability of
the model
Code Reference code for the hierarchy
Comment Descriptive label for the hierarchy
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Dimension Parent dimension of the hierarchy
A hierarchy definition also includes the following properties:
Property Description
Attributes List of attributes of the hierarchy
Notes Description associated with the hierarchy
Rules Business rules associated with the hierarchy
Version Info Hierarchy owner, version number, modification and creation
details
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 221
Creating a hierarchy
You create a hierarchy from the dimension property sheet. To display the
dimension property sheet:
Double-click the dimension symbol
Right-click the dimension node in the Browser and select Properties
At creation, a hierarchy has a default name including a number, this number
is assigned by default in the order of creation of objects.
To create a hierarchy:
1 Select the Hierarchies tab in the dimension property sheet.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a name and a code.
4 Click OK.
Defining hierarchies in a multidimensional diagram
222 PowerDesigner
Modifying hierarchy properties
You can modify the hierarchy properties using the following methods:
From the hierarchy property sheet
From the list of hierarchies
For more information on the different ways to modify the hierarchy
properties, see section Modifying object properties in chapter Managing
object in the General Features Guide.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 223
Defining cubes in a multidimensional diagram
A cube is a collection of measures corresponding to values stored into each
of its data cell. The measures are organized into dimensions 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.
For more information on facts, see section Defining facts in a
multidimensional diagram.
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. You define this
query from the Query page of the cube in the multidimensional diagram.
Cube properties
You can double-click any cube symbol in a diagram to display its properties:
Property Description
Name Name for the cube. This name improves the readability of the
model
Code Reference code for the cube
Comment Descriptive label for the cube
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Fact Fact used by the cube
Defining cubes in a multidimensional diagram
224 PowerDesigner
A cube definition also includes the following properties:
Property Description
Queries SQL statement required to generate the cube data text file
that will be used to populate the OLAP cube
Fact Measures Measures linked to the fact of the cube
Notes Description associated with the cube
Rules Business rules associated with the cube
Extended
Dependencies
User defined semantic dependencies between objects in the
model
Dependencies Relationship between two modeling elements, in which a
change to the influent element will affect the dependent
element
Version Info Cube owner, version number, modification and creation
details
Creating a cube
There are several ways to create a cube:
From a diagram
From the Browser
From the list of cubes
At creation, a cube has a default name including a number, this number is
assigned in the order of creation of objects.
For more information on the different ways to create a cube, see section
Creating an object in chapter Managing objects in the General Features
Guide.
To create a cube from a diagram:
1 Click the Cube tool.
2 Click an empty space in the diagram.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 225
The following symbol appears at the click position:
3 Click the Pointer tool.
4 Double-click the new cube symbol in the diagram to display the cube
property sheet.
5 Type a name and a code.
6 Click OK.
Modifying cube properties
You can modify the cube properties using the following methods:
From the cube property sheet
From the list of cubes
For more information on the different ways to modify the cube
properties, see section Modifying object properties in chapter Managing
object in the General Features Guide.
Defining cubes in a multidimensional diagram
226 PowerDesigner
Modifying the cube display preferences
You can modify the following display preferences for a cube using the
ToolsDisplay Preferences command:
Text display preference When selected, what it displays
Fact Measures Shows fact measures
All Fact Measures If the Measures check box is selected, allows to
display all measures in the cube symbol
Limit If the Measures check box is selected, allows to
restrict the display of measures to a given number
Fact Shows cube fact
Stereotype Shows the stereotype of the cub. You can also
display the stereotype of the measure and fact

Chapter 4 Building Multidimensional Diagrams


PDM User's Guide 227
Defining facts in a multidimensional diagram
A fact corresponds to the focus of a decision support investigation. It is a set
of measures manipulated by the cube. For example, Sale, Revenue, Budget
could be facts.
Facts can be reused among different cubes.
Fact properties
You can access the fact properties from the list of facts:
Property Description
Name Name for the fact. This name improves the readability of the
model
Code Reference code for the fact
Comment Descriptive label for the fact
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Defining facts in a multidimensional diagram
228 PowerDesigner
A fact definition also includes the following properties:
Property Description
Measures List of measures manipulated by the cube
Mapping Defines the mapping between the current fact and a table or a
view in a data source
Notes Description associated with the fact
Rules Business rules associated with the fact
Extended
dependencies
User defined semantic dependencies between objects in the
model
Dependencies Relationship between two modeling elements, in which a
change to the influent element will affect the dependent
element
Version Info Fact owner, version number, modification and creation
details
Creating a fact
You create a fact from the cube property sheet.
At creation, a fact has a default name including a number, this number is
assigned by default in the order of creation of objects.
To create a fact:
1 Double-click a cube symbol in the diagram to display the cube property
sheet.
2 Click the Ellipsis button beside the Fact box to open the list of facts.
3 Click a blank line in the list
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 229
4 Type a name and a code.
5 Click OK in each of the dialog boxes.
Modifying fact properties from the list of facts
You can modify the fact properties from the list of facts. The list of facts
displays all facts of the current package or model.
To modify fact properties from the list of facts:
1 Select ModelFacts to display the List of Facts.
2 Select the fact you want to modify.
Defining facts in a multidimensional diagram
230 PowerDesigner
An arrow appears at the beginning of the line.
3 Modify any of the properties of the fact directly in the list.
or
Double-click the arrow at the beginning of the line to display the fact
property sheet and modify the properties of the fact.
4 Click OK.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 231
Defining measures in a multidimensional
diagram
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 the cube.
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.
Measure properties
You can access the measure properties from the fact property sheet:
Property Description
Name Name for the measure. This name improves the readability of the
model
Code Reference code for the measure
Comment Descriptive label for the measure
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Fact Parent fact of the measure
Formula Indicates if the measure is a computed expression and allows to
define this expression
A measure definition also includes the following properties:
Property Description
Notes Description associated with the measure
Rules Business rules associated with the measure
Version Info Measure owner, version number, modification and creation
details
Defining measures in a multidimensional diagram
232 PowerDesigner
Creating a measure
You create a measure from the fact property sheet. You display the fact
property sheet by double-clicking a fact in the list of facts.
At creation, a measure has a default name including a number, this number is
assigned by default in the order of creation of objects.
To create a measure:
1 Select the Measures tab in the fact property sheet.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a name and a code.
4 Click OK.
Modifying measure properties
You can modify the measure properties using the following methods:
From the measure property sheet
From the list of measures
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 233
Modifying measure properties from the property sheet
Read only Fact Measures tab
The Fact Measures page in the cube property sheet is read only, you
cannot modify or add measures to the fact from this page.
To modify measure properties from the property sheet:
1 Double-click a cube in the diagram to display the cube property sheet.
2 Click the Properties button beside the Fact box to display the fact
property sheet.
3 Click the Measures tab to display the Measures page.
4 Select the measure you want to modify.
An arrow appears at the beginning of the line.
5 Modify any of the properties of the measure directly in the list.
or
Double-click the arrow at the beginning of the line.
The measure property sheet appears.
6 Modify the measure properties as required in the different tabbed pages.
7 Click OK in each of the dialog boxes.
Modifying measure properties from the list of measures
The list of measures displays all measures of the current package or model.
To modify measure properties from the list of measures:
1 Select ModelMeasures to display the List of Measures.
2 Select the measure you want to modify.
Defining measures in a multidimensional diagram
234 PowerDesigner
An arrow appears at the beginning of the line.
3 Modify any of the properties of the measure directly in the list.
or
Double-click the arrow at the beginning of the line to display the
measure property sheet and modify the properties of the measure.
4 Click OK in each of the dialog boxes.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 235
Defining associations in a multidimensional
diagram
An association relates a cube to the dimension 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.
There can be only one association between a cube and a dimension.
Association properties in a multidimensional diagram
You can double-click any association symbol in a diagram to display its
properties:
Property Description
Cube Cube origin of the association
Dimension Destination dimension of the association
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-defined
Hierarchy Hierarchy used by the cube for the consolidation calculation
Creating an association in a multidimensional diagram
There are several ways to create an association:
From a diagram
From the list of associations
Defining associations in a multidimensional diagram
236 PowerDesigner
At creation, an association has a default name including a number, this
number is assigned in the order of creation of objects.
For more information on the different ways to create an association, see
section Creating an object in chapter Managing objects in the General
Features Guide.
To create an association from a diagram:
1 Click the Association tool.
2 Click inside the cube and while continuing to hold down the mouse
button, drag the cursor to the dimension. Release the mouse button inside
the dimension.
The association appears between the two objects.
3 Click the Pointer tool.
4 Double-click the new association symbol in the diagram to display the
association property sheet.
5 Type a name and a code.
You can open the property sheet of the cube and dimension objects by
clicking the Cube and Dimension buttons located in the upper part of the
association property sheet.
Chapter 4 Building Multidimensional Diagrams
PDM User's Guide 237
6 Click OK.
Modifying association properties in a multidimensional diagram
You can modify the association properties using the following methods:
From the association property sheet
From the list of associations
For more information on the different ways to modify the association
properties, see section Modifying object properties in chapter Managing
object in the General Features Guide.
Modifying the association display preferences in a
multidimensional diagram
You can modify the following display preferences for an association using
the ToolsDisplay Preferences command:
Text display
preference When selected, what it displays
Name The name of the association
Hierarchy The name of the hierarchy used to compute the cube
Stereotype The stereotype of the association
Defining associations in a multidimensional diagram
238 PowerDesigner
PDM User's Guide 239
C H A P T E R 5
Denormalizing a Physical Data Model
This chapter describes the different methods for denormalizing a Physical
Data Model.
Topic Page
Overview 240
Horizontal partitioning 241
Vertical partitioning 248
Table collapsing 256
Column denormalization 261
About this chapter
Contents
Overview
240 PowerDesigner
Overview
Usually normalization consists in eliminating redundancy and inconsistent
dependencies between tables in order to create a functional and efficient
relational database.
Denormalization is the process of putting one fact in numerous places, in
order to speed data retrieval. The only valid reason for denormalizing a
relational design is to enhance performance. However, there are several
indicators which will help to identify systems and tables which are potential
denormalization candidates. These are:
Critical queries rely upon data from more than one table
Many calculations need to be applied to one or many columns before
queries can be successfully answered
Tables need to be accessed in different ways by different users during the
same timeframe
Certain columns are queried a large percentage of the time
When deciding whether to denormalize, you need to analyze the data access
requirements of the applications in your environment and their actual
performance characteristics. Often, good indexing and other solutions solve
many performance problems rather than denormalization.
Denormalization may be accomplished in several ways:
Horizontal partitioning is used to divide a table into multiple tables
containing the same columns but fewer rows
Vertical partitioning is used to divide a table into multiple tables
containing the same number of rows but fewer columns
Table collapsing is used to merge tables in order to eliminate the join
between them
Column denormalization is used to repeat a column in tables in order
to avoid creating a join between tables
The following sections explain these different denormalization techniques.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 241
Horizontal partitioning
Horizontal partitioning consists in segmenting a table into multiple tables
each containing a subset of rows and the same columns as the partitioned
table.
Horizontal partitioning optimizes data retrieval by dividing rows of a table.
The table Annual_Sales contains the following columns:
This table is likely to contain a very large amount of data. You can use the
Horizontal Partitioning Wizard to optimize data retrieval by creating
partitions corresponding to sales per year. You can use any column, even
primary keys, as partitioning criteria.
The result is the following:
Horizontal partitioning allows you to divide a large table into smaller tables
in order to:
Improve the query response time
Accelerate incremental data backup and recovery
Decrease time required to load into indexed tables
However, horizontal partitioning also implies to:
Create joins and unions to retrieve related data from multiple tables
Create more intelligent queries to determine which table contains the
requested data
Use additional metadata to describe the partitioned table
Example
Pros and cons
Horizontal partitioning
242 PowerDesigner
Using the Horizontal Partitioning Wizard
The Horizontal Partitioning Wizard lets you generate multiple tables from a
selected table. The generated tables correspond to partitions of a table; they
contain the same columns as the partitioned table apart from those columns
used as partitioning criterion.
You can keep or delete the original table used for the partitioning.
The Horizontal Partitioning Wizard is accessible from the Tools menu or the
contextual menu of a table. The wizard lets you define the following
parameters:
Wizard page Description
Partitioned Table Selection Lets you select the table to partition in any package
of the current model. If a table is selected in the
diagram, it appears in the Partitioned Table box. If
you select the Keep the Partitioned Table After the
Partitioning check box, you preserve the original
table used for the transformation
Partition Definition Lets you define the partitions of the selected table.
You can use the Insert or Add a row tools to create
as many partitions as needed. The name of each
partition is unique in the model. A table will be
created for each partition using the partition name
Discriminant Column
Selection
Lets you define the columns that will not be
duplicated in each partition. Such columns are
partition criteria. You can use the Add Columns
tool to select the columns not to duplicate
Partitioning Information Lets you enter a name and a code for the
transformation object that will be created together
with the partitions. In this documentation, we shall
call this object horizontal partitioning object
To use the Horizontal Partitioning Wizard:
1 Select ToolsDenormalizationHorizontal Partitioning.
or
Right-click a table in the diagram and select Horizontal Partitioning from
the contextual menu.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 243
The Horizontal Partitioning Wizard appears.
2 Select a partitioned table.
3 <optional> Select Keep the Partitioned Table After the Partitioning
check box.
4 Click Next.
5 Define the partitions to generate and click Next.
6 Define the partition criteria and click Next.
7 Define the name and code of the horizontal partitioning object and click
Finish.
After the creation of the partitions and their corresponding tables, all
references incoming or outgoing the partitioned table are also created on each
partition table.
A horizontal partitioning object is created each time you perform a horizontal
partitioning on a table.
Using the horizontal partitioning object
The horizontal partitioning object is automatically created when you define
table partitions, this object belongs to the category of transformation objects
that appears in the List of Transformations, available from the menu
command ModelTransformations.
Horizontal partitioning
244 PowerDesigner
The horizontal partitioning object has the following properties:
Property Description
Name Name of the horizontal partitioning object. It is recommended
to provide a clear name in the Horizontal Partitioning Wizard
Code Code of the horizontal partitioning object
Comment Additional information about the horizontal partitioning
object. The comment box is also used to display the
Partitioned table Name of the table used to create the table partitions. This
table no longer exists in the model
Discriminant
Columns
Name and code of the columns used as partition criteria
The Partitions page in the horizontal partitioning object property sheet
displays the list of partitions created during horizontal partitioning. You can
manage partitions from this list.
For more information on how to manage partitions, see section
Managing horizontal partitions.
Delete a horizontal partitioning object
You can use the List of Transformations to delete a horizontal partitioning
object using the Delete tool in the list toolbar. Delete removes the horizontal
partitioning object and the partitions, but does not delete the tables
corresponding to the partitions. The tables become independent from each
other.
Cancel a horizontal partitioning transformation
You can use the List of Transformations to cancel a transformation using the
Cancel Transformation tool in the list toolbar. When you cancel a
transformation, you delete the horizontal partitioning object, the partitions,
and their corresponding tables from the model.
Cancel can be used to recover the original table of the partitioning.
For more information on recovering the original table of the
partitioning, see section Revert a horizontal partitioning.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 245
Managing horizontal partitions
You can manage partitions from the Partitions page of the property sheet of a
horizontal partitioning object. The following actions can be performed:
Open the property sheets of the tables corresponding to the partitions.
You can modify the properties of the table from the property sheet. If
you modify the name or the code of the table, the name or code of the
corresponding partition is automatically updated
Add more partitions and define the properties of their corresponding
tables
Use the Comment column to comment and specify the discriminating
criteria of the different partitions
Delete one or several partitions and their corresponding tables. When
you delete a partition, a message box appears to ask you if you want to
delete the corresponding table. You can delete a partition and keep the
corresponding table, however you cannot delete a table and keep an
orphan partition
You cannot move or paste a horizontal partitioning object into another model
or package.
Intermodel generation of horizontal partitions
When you generate in update mode a PDM from a PDM, a CDM or an
OOM, horizontal partitioning is preserved.
For example, model Sales.CDM contains entity Customer:
Sales.CDM is generated in SALES.PDM, entity Customer becomes table
Customer:
Horizontal partitioning
246 PowerDesigner
You decide to create partitions for this table using the City criterion, you use
horizontal partitioning to create table partitions from which you remove the
city column:
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
merge dialog box: CDM changes (creation of the Activity attribute) are
selected by default, and column modifications related to partition creation are
not selected.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 247
Revert a horizontal partitioning
The revert feature is used to recover the original table used for partitioning.
This procedure does not apply if you have kept the original table.
Revert is not a single-click operation, you have to perform several actions as
described in the procedure below. Revert is only accessible if the partitioned
table is a generated object proceeding from a PDM, CDM, or OOM
generation into a PDM, otherwise you will not be able to recover the
partitioned table.
To revert a horizontal partitioning:
1 Select a horizontal partitioning object in the List of Transformations.
2 Click the Cancel Transformation tool in the list toolbar in order to
initiate the revert process.
Cancel Transformation tool
The Cancel Transformations tool is disabled if the table is not a
generated object
The horizontal partitioning object is removed from the list.
3 Click OK.
The horizontal partitions and their corresponding tables are deleted from
the PDM.
4 Regenerate the PDM in update mode.
Since the transformation object is no longer in the model, the merge
dialog box lets you recreate the original table used for the partitioning.
You have reverted the horizontal partitioning.
Vertical partitioning
248 PowerDesigner
Vertical partitioning
Vertical partitioning consists in segmenting a table into multiple tables each
containing a subset of columns and the same number of rows as the
partitioned table. The partition tables share the same primary key.
The table Customer contains the following columns:
This table can be divided in two tables corresponding to different aspects of
the table. You can use the Vertical Partitioning Wizard to split the table as
follows:
Vertical partitioning allows queries to scan less data thus improves the query
response time. It also allows you to split data requiring different levels of
protection, you can store confidential information in a special partition.
However, vertical partitioning also implies to:
Create joins and unions to retrieve related data from multiple tables
Create more intelligent queries to determine which table contains the
requested data
Additional metadata to describe the partitioned table
Using the Vertical Partitioning Wizard
The Vertical Partitioning Wizard lets you generate multiple tables from a
selected table. The generated tables correspond to partitions of a table.
Example
Pros and cons
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 249
The key columns of the partitioned table are duplicated whereas the other
columns are distributed among the partition tables. PowerDesigner verifies
that all the columns of the partitioned table are used in the partition tables.
You can keep the original table used for the partitioning.
The Vertical Partitioning Wizard is accessible from the Tools menu or the
contextual menu of a table. The wizard lets you define the following
parameters:
Wizard page Description
Partitioned Table Selection Lets you select the table to partition in any
package of the current model. If a table is selected
in the diagram, it appears in the Partitioned Table
box. If you select the Keep the Partitioned Table
After the Partitioning check box, you preserve the
original table used for the transformation
Partition Definition Lets you define the partitions of the selected
table. You can use the Insert or Add a row tools
to create as many partitions as needed. The name
of each partition is unique in the model. A table
will be created for each partition using the
partition name
Partition Column Selection Lets you define the columns to include in each
partition table. You can use the Add button to add
columns from the partitioned table to the partition
tables. The key columns do not appear in the list
because they are duplicated in each partition
table. Include each column in a partition and click
Next
Partitioning Information Lets you enter a name and a code for the
transformation object that will be created together
with the partitions. In this documentation, we
shall call this object vertical partitioning object
To use the Vertical Partitioning Wizard:
1 Select ToolsDenormalizationVertical Partitioning.
or
Right-click a table in the diagram and select Vertical Partitioning from
the contextual menu.
Vertical partitioning
250 PowerDesigner
The Vertical Partitioning Wizard appears.
2 Select a partitioned table.
3 <optional> Select Keep the Partitioned Table After the Partitioning
check box.
4 Click Next.
5 Define the partitions to generate and click Next.
6 Select the columns to include in each partition and click Next.
7 Define the name and code of the vertical partitioning object and click
Finish.
After the creation of the partitions and their corresponding tables, the
partitioned table is deleted from the model. All references incoming or
outgoing the partitioned table are recreated on each partition table.
A vertical partitioning object is created each time you perform a vertical
partitioning on a table.
Using the vertical partitioning object
The vertical partitioning object is automatically created when you define
table partitions, this object belongs to the category of transformation objects
that appears in the List of Transformations, available from the menu
command ModelTransformations.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 251
This vertical partitioning object has the following properties:
Property Description
Name Name of the vertical partitioning object. It is recommended to
provide a clear name in the Vertical Partitioning Wizard
Code Code of the vertical partitioning object
Comment Additional information about the vertical partitioning object
Partitioned table Name of the table used to create the table partitions. This
table no longer exists in the model
The Partitions page in the vertical partitioning object property sheet displays
the list of partitions created during vertical partitioning. You can manage
partitions from this list.
For more information on how to manage partitions, see section
Managing vertical partitions.
Delete a vertical partitioning object
You can use the List of Transformations to delete a vertical partitioning
object using the Delete tool in the list toolbar. Delete removes the vertical
partitioning object and the partitions, but does not delete the tables
corresponding to the partitions. The tables become independent from each
other.
Cancel a vertical partitioning transformation
You can use the List of Transformations to cancel a transformation using the
Cancel Transformation tool in the list toolbar. When you cancel a
transformation, you delete the vertical partitioning object, the partitions, and
their corresponding tables from the model.
Cancel can be used to recover the original table of the partitioning.
For more information on recovering the original table of the
partitioning, see section Revert a vertical partitioning.
Vertical partitioning
252 PowerDesigner
Managing vertical partitions
You can manage partitions from the Partitions page of the property sheet of a
vertical partitioning object. The following actions can be performed:
Open the property sheets of the tables corresponding to the partitions.
You can modify the properties of the table from the property sheet. If
you modify the name or the code of the table, the name or code of the
corresponding partition is automatically updated
Add more partitions and define the properties of their corresponding
tables
Delete one or several partitions and their corresponding tables. When
you delete a partition, a message box appears to ask you if you want to
delete the corresponding table. You can delete a partition and keep the
corresponding table, however you cannot delete a table and keep an
orphan partition
The Partition Columns page lets you move columns between partition tables.
You can drag and drop columns from one partition table to another.
You cannot move or paste a vertical partitioning object into another model or
package.
Intermodel generation of vertical partitions
When you generate in update mode a PDM from a PDM, a CDM or an
OOM, vertical partitioning is preserved.
For example, you build a CDM to design the project management process,
this model contains entity Task:
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 253
The CDM is generated in a PDM, entity Task becomes table Task:
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:
Vertical partitioning
254 PowerDesigner
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.
Revert a vertical partitioning
The revert feature is used to recover the original table used for partitioning.
This procedure does not apply if you have kept the original table.
Revert is not a single-click operation, you have to perform several actions as
described in the procedure below. Revert is only accessible if the partitioned
table is a generated object proceeding from a PDM, CDM, or OOM
generation into a PDM, otherwise you will not be able to recover the
partitioned table.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 255
To revert a vertical partitioning:
1 Select a vertical partitioning object in the List of Transformations.
2 Click the Cancel Transformation tool in the list toolbar in order to
initiate the revert process.
Cancel Transformation tool
The Cancel Transformations tool is disabled if the table is not a
generated object
The vertical partitioning object is removed from the list.
3 Click OK.
The vertical partitions and their corresponding tables are deleted from
the PDM.
4 Regenerate the PDM in update mode.
Since the transformation object is no longer in the model, the merge
dialog box lets you recreate the original table used for the partitioning.
You have reverted the vertical partitioning.
Table collapsing
256 PowerDesigner
Table collapsing
Table collapsing consists in merging tables into a single table in order to
eliminate joins and to improve query performance.
The generated table gathers the columns of the merged tables. All incoming
and outgoing references to the input tables are preserved in the resulting
table. When the collapsed tables are related by references, the following
occurs:
The parent column of the join is no longer needed, thus removed
The columns of the parent table are duplicated
The foreign keys of the children are removed, but their columns are
preserved in the resulting table
Tables Customer and Order are linked together.
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:
Example
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 257
Using the 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.
You can keep or delete the input tables used for the collapsing.
The Table Collapsing Wizard is accessible from the Tools menu. The wizard
lets you define the following parameters:
Wizard page Description
Table Collapsing Target Lets you define the name and code of the table
resulting from the collapsing of selected tables
Input Table Selection Lets you select the tables to collapse. If table
symbols are selected in the diagram, the selection
appears in the list. You can use the Add Tables tool
to display a selection dialog box. The tables you
select will disappear. If you select the Keep the
Input Tables After the Table Collapsing check box,
you preserve the original tables used for the
transformation
Table Collapsing
Information
Lets you enter a name and a code for the
transformation object that will be created together
with the new table. In this documentation, we shall
call this object table collapsing object
To use the Table Collapsing Wizard:
1 Select ToolsDenormalizationTable Collapsing.
or
Right-click the a reference among the tables to collapse in the diagram
and select Table Collapsing from the contextual menu.
Table collapsing
258 PowerDesigner
The Table Collapsing Wizard appears.
2 Define the target table and click Next.
3 Select the input tables.
4 <optional> Keep the Input Tables After the Table Collapsing check box.
5 Click Next.
6 Define the name and code of the table collapsing object and click Finish.
A table collapsing object is created each time you perform a table collapsing.
Using the table collapsing object
The table collapsing object is automatically created when you collapse tables,
this object belongs to the category of transformation objects that appears in
the List of Transformations, available from the menu command
ModelTransformations.
The table collapsing object has the following properties:
Property Description
Name Name of the table collapsing object. It is recommended to provide
a clear name in the Table Collapsing Wizard
Code Code of the table collapsing object
Comment Additional information about the table collapsing object
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 259
Property Description
Target table Name of the table resulting from the collapsing of selected tables
The Source Tables page displays the list of collapsed tables. These tables no
longer exist in the model.
You cannot move or paste a table collapsing object into another model or
package.
Delete a table collapsing object
You can use the List of Transformations to delete a table collapsing object
using the Delete tool in the list toolbar. Delete removes the table collapsing
object, but does not delete the resulting table created in the model.
Cancel a table collapsing transformation
You can use the List of Transformations to cancel a transformation using the
Cancel Transformation tool in the list toolbar. When you cancel a
transformation, you delete the table collapsing object, and the resulting table
from the model.
Cancel can be used to recover the original tables of the collapsing.
For more information on recovering the original tables of the
collapsing, see section Revert a table collapsing.
Intermodel generation of table collapsing
When you generate in update mode a PDM from a PDM, a CDM or an
OOM, table collapsing is preserved.
Revert a table collapsing
The revert feature is used to recover the original tables used for collapsing.
This procedure does not apply if you have kept the original tables.
Table collapsing
260 PowerDesigner
Revert is not a single-click operation, you have to perform several actions as
described in the procedure below. Revert is only accessible if the collapsed
tables are generated objects proceeding from a PDM, CDM, or OOM
generation into a PDM, otherwise you will not be able to recover the
collapsed tables.
To revert a table collapsing:
1 Select a table collapsing object in the List of Transformations.
2 Click the Cancel Transformation tool in the list toolbar in order to
initiate the revert process.
Cancel Transformation tool
The Cancel Transformations tool is disabled if the table is not a
generated object
The table collapsing object is removed from the list.
3 Click OK.
The table collapsing and resulting table are deleted from the PDM.
4 Regenerate the PDM in update mode.
Since the transformation object is no longer in the model, the merge
dialog box lets you recreate the original table used for the collapsing.
You have reverted the table collapsing.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 261
Column denormalization
Note
Column denormalization uses the object replication feature, it is
recommended to read the object replication chapter in the General
Features Guide before using column denormalization
You can denormalize columns to eliminate frequent joins using column
denormalization.
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:
Column denormalization eliminates joins for many queries, however it
requires more maintenance and disk space.
Using the Column Denormalization Wizard
The Column Denormalization Wizard lets you duplicate columns in a
selected table. The result is a column replica object in the target table.
For more information on replications, see chapter Managing Object
Replications in the General Features Guide.
Example
Column denormalization
262 PowerDesigner
The Column Denormalization Wizard is accessible from the Tools menu or
the contextual menu of a table. The wizard lets you define the following
parameters:
Wizard page Description
Target Table Selection Lets you select the table in which you will duplicate
one or several columns. If a table is selected in the
diagram, it appears by default in the Target Table
Selection box. you can use
Selection Lets you select one or several columns that will be
duplicated in the selected table
To use the Column Denormalization Wizard:
1 Select ToolsDenormalizationColumn Denormalization.
The Column Denormalization Wizard appears.
2 Select the table in which you want to duplicate columns and click Next.
3 Select the columns to duplicate and click Finish.
A replica is created for each duplicated column.
You can display the list of replica from the menu command
ModelReplications. Each replica has a property sheet with details about the
replicated object, replicated attributes, replicated collections (association
between metaclasses in the metamodel), and sub-replications.
Chapter 5 Denormalizing a Physical Data Model
PDM User's Guide 263
For more information on replica, see chapter Managing Object
Replications in the General Features Guide.
You can move and paste a denormalized column into another model or
package using the standard copy/paste or cut/paste features.
Intermodel generation of denormalized columns
When you generate in update mode a PDM from a PDM, a CDM or an
OOM, denormalized columns are preserved.
Revert a column denormalization
You can revert a column denormalization by deleting the duplicated column
from the target table property sheet. This automatically removes the column
replica.
You cannot revert a column denormalization by deleting a column replica
from the list of replications.
Column denormalization
264 PowerDesigner
PDM User's Guide 265
C H A P T E R 6
Working with Physical Data Models
This chapter describes how to work with Physical Data Models.
Topic Page
Checking a PDM 266
Object parameters verified during check model 274
Mapping objects in a PDM 322
Retrieving multidimensional objects 341
Rebuilding cubes 343
Generating extraction scripts 346
Generating Cube Data 348
Migrating from version 6 data warehouse 351
Using PowerBuilder extended attributes 355
Importing an ERwin model into a PDM 362
About this chapter
Contents
Checking a PDM
266 PowerDesigner
Checking a PDM
You can use the Check Model command to check the validity of a PDM at
any time. A valid PDM conforms to the following rules:
Each object name must be unique
Model constraints must be compatible with database constraints
Each table must have at least one column
Each index must have a column
Each reference must have at least one column pair
Apply Check model before generating a database
It is recommended that you start database generation by checking the
validity of the PDM. If an error is found, the database (or database
generation script) can not be generated.
PDM check options
When you check a PDM, you can define levels of severity for problems that
Check model finds and have certain problems automatically corrected.
You can set a level of problem severity for each object parameter verified by
Check model. This severity level depends on the degree of normalization that
you want to achieve in your model.
When you check a PDM, you can display an invalid parameter with one of
two types of messages, depending on the degree of problem severity you
assigned to that parameter:
Message Description
Error Major problem that impedes database generation
Warning Minor problem or recommendation
You can choose to have certain problems corrected automatically by
PowerDesigner. However, before using automatic correction, make sure you
understand how it will affect your model.
For example, if a column code length is longer than the length specified in
the MaxColumnLen field in the DBMS, then PowerDesigner can
automatically truncate the code length to be within the specified length.
Levels of problem
severity
Automatic
correction
Chapter 6 Working with Physical Data Models
PDM User's Guide 267
However, truncating such a column code can make its name a duplicate of an
existing one. If automatic correction is active for column code uniqueness,
PowerDesigner renames the duplicated column code. If you do not want this
to occur, you must deselect automatic correction for column code uniqueness.
For more information on automatic correction, see Object parameters
verified during check model.
Automatic correction is not available for all object parameters.
All problems that can not be corrected automatically are corrected manually.
For example, PowerDesigner will not create a column for an existing index.
You need to create the appropriate column from an object property sheet.
You can use the following tools from the Check Model Parameters dialog
box to set either an error or warning level of problem severity, and also if you
want PowerDesigner to automatically correct an error:
Tool Indicates Description
Error Indicates a major problem that prevents database
generation
Warning Indicates a minor problem or recommendation
Automatic
correction
Allows automatic error correction
Object selection for Check Model
You select objects for verification by Check Model from the Selection page.
You can list for selection objects in the current model, or objects in
individual packages contained in the model.
You can list all objects in the current model, or a package, by selecting the
Include Sub-objects tool.
You have the following selection options:
Parent
object
Include Sub-objects tool
selected
Include Sub-objects tool
not selected
Model All objects in model including
all objects contained in
packages and sub-packages
All objects in model except
objects contained in packages
and sub-packages
Setting problem
severity and
automatic
correction
Listing objects
contained in a
model or package
Checking a PDM
268 PowerDesigner
Parent
object
Include Sub-objects tool
selected
Include Sub-objects tool
not selected
Package All objects contained in
package including all objects
contained in sub-packages
All objects in package except
objects contained in sub-
packages
Selecting objects graphically for check model
When you click the Use Graphical Selection tool in the Selection page
tool bar, you can graphically select objects in your diagram for verification
by Check Model.
Checking a global PDM
To check a global PDM:
1 Select ToolsCheck Model.
or
Right-click the diagram background and select Check Model from the
contextual menu.
The Check Model Parameters dialog box opens to the Options page.
2 Expand an object parameter node.
Chapter 6 Working with Physical Data Models
PDM User's Guide 269
The object parameters which are verified by Check Model are displayed
with the symbols indicating a degree of problem severity.
3 If you want to change a degree of problem severity, select the object
parameter and then select either the Error or Warning tool.
The symbol changes to the appropriate severity level.
4 If you want PowerDesigner to automatically correct a problem, select the
object parameter and then select the Automatic Correction tool.
The Automatic Correction symbol appears superimposed on the Error or
Warning symbol for that object parameter.
5 Click the Selection tab.
The Selection page appears.
6 Select a model from the dropdown list at the top of the dialog box.
7 Click an object tab.
Checking a PDM
270 PowerDesigner
The corresponding object page displays all the objects in the current
PDM.
8 Select check boxes for objects that you want to be checked.
Clear check boxes for objects that you do not want to be checked.
Selecting all or clearing all check boxes
You can select all object check boxes by clicking the Select All tool.
You can clear all object check boxes by clicking the Deselect All
tool.
9 Click OK.
The Check Model Result List displays errors and warnings based on
your choice of check options.
Chapter 6 Working with Physical Data Models
PDM User's Guide 271
Dockable result window
When you right click an object parameter a menu appears listing
correction options. Among these, you can also select options to clear,
dock or hide the result window.
Displaying previously applied check options
If you click the Apply button in the Check Model Parameters dialog box, all
error and warning selections are stored in memory.
To display errors and warnings selected in the last check:
Select ToolsCheck Model.
The Check Model Parameters dialog box opens to the Options page. The
object parameters are displayed with the Error or Warning icons selected
in the last check.
Making corrections based on PDM check results
You can use the Check Model to locate and correct problems in the PDM.
You can choose one of the following correction options from the Check
toolbar:
Symbol Option Description
Manual correction Displays property sheet of problem object
Display help Displays description of the error and suggestion
for correction
Check again Checks selected object parameter, normally
after a correction has been done
Automatic
correction
Automatically corrects certain errors
The Check tool bar also contains navigation tools that you can use to move to
the first, previous, next, or last errors that are listed. You can also navigate in
the list of errors by right-clicking an object parameter and selecting Go To
First error, Previous error, Next error, or Last error from the contextual
menu.
Navigating in the
error list
Checking a PDM
272 PowerDesigner
Right click menu
When you right click an object parameter, a menu appears listing the
correction options Manual Correction, Help, Check again, and Automatic
Correction. You can also select options to clear, dock and hide the result
window.
Automatic correction fixes the following types of errors and warnings:
Inappropriate foreign key columns
Non-unique names
Code too long for target database (if you select Database Constraints)
Inappropriate primary keys, foreign keys, and unique indexes
Divergence in domain values, check parameters, and validation rules for
auto-migrated foreign keys
Divergence in auto-migrated foreign keys
Divergence in domain values, check parameters, and validation rules
for an auto-migrated foreign key are only corrected if you have
selected the corresponding auto-migrate options in Model options.
You must always correct other errors manually.
Making manual corrections to a PDM
To make manual corrections to a PDM:
1 From the Result List, select an object parameter.
2 Right-click the object parameter and select Correct from the contextual
menu.
The object property sheet appears.
3 Select the appropriate tab and make the necessary correction.
4 Close the property sheet.
5 Re-select the object parameter.
6 Right-click the object parameter and select Check again from the
contextual menu.
Verify that the problem has been corrected.
Automatic
correction
Chapter 6 Working with Physical Data Models
PDM User's Guide 273
Making automatic corrections to a PDM
To make automatic corrections to a PDM:
1 From the Result List, select an object parameter.
2 Right-click the object parameter and select Automatic Correction from
the contextual menu.
3 Right-click the object parameter and select Check again from the
contextual menu.
Verify that the problem has been corrected.
Object parameters verified during check model
274 PowerDesigner
Object parameters verified during check model
The Check Model command verifies the validity of PDM objects.
Control availability and corrections
The controls available for different PDM objects depend on your target
DBMS specifications.
When errors are encountered during a check model, corrections can be made
manually or automatically. Manual corrections depend on how you are using
your model.
Use the Help command to select object control options
When you right click a PDM object control in the Check Model
Parameters page, a menu appears listing several options. The Help
command opens a contextual help page explaining the checks performed
for the selected object type.
Horizontal partitioning check
During a horizontal partitioning check, the following object controls are
made.
Horizontal partitioning name and code uniqueness
A model cannot contain two horizontal partitioning objects with identical
name and/or code.
Manual correction Automatic correction
Modify the duplicated name/code Modifies the name/code of a selected
horizontal partitioning object by appending
a number to its current name
Chapter 6 Working with Physical Data Models
PDM User's Guide 275
Existence of partitions
A horizontal partitioning object cannot be empty, it must contain at least one
partition.
Manual correction Automatic correction
Delete the horizontal partitioning
object or create at least one
partition in the horizontal
partitioning object property sheet
Deletes empty horizontal partitioning object
Unavailable target table
A partition should have a corresponding table. You could delete a table that
actually corresponds to a partition, this check verifies that each partition has a
corresponding table.
Manual correction Automatic correction
Delete the partition with no
corresponding table
Deletes the partition with no corresponding
table
Table collapsing check
During a table collapsing check, the following object controls are made.
Table collapsing name and code uniqueness
A model cannot contain two table collapsing objects with identical name
and/or code.
Manual correction Automatic correction
Modify the duplicated name/code Modifies the name/code of a selected table
collapsing object by appending a number to
its current name
Object parameters verified during check model
276 PowerDesigner
Existence of target table
A table collapsing must have a table as result of the collapsing.
Manual correction Automatic correction
Delete the table collapsing object
Unavailable target table
The table resulting from the collapsing should be available.
Manual correction Automatic correction
Delete the table collapsing object Deletes the table collapsing object
Vertical partitioning check
During a vertical partitioning check, the following object controls are made.
Vertical partitioning name and code uniqueness
A model cannot contain two vertical partitioning objects with identical name
and/or code.
Manual correction Automatic correction
Modify the duplicated name/code Modifies the name/code of a selected
vertical partitioning object by appending a
number to its current name
Existence of partitions
A vertical partitioning object cannot be empty, it must contain at least one
partition.
Manual correction Automatic correction
Delete the vertical partitioning
object or create at least one
partition in the vertical partitioning
object property sheet
Deletes empty vertical partitioning object
Chapter 6 Working with Physical Data Models
PDM User's Guide 277
Unavailable target table
A partition should have a corresponding table. You could delete a table that
actually corresponds to a partition, this check verifies that each partition has a
corresponding table.
Manual correction Automatic correction
Delete the partition with no
corresponding table
Deletes the partition with no corresponding
table
Business Rule check in a PDM
During a business rule check, the following object controls are made.
Business rule name and code uniqueness
A model cannot contain two business rules with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated business
rule name/code
Modifies the business rule name/code of a
selected object by appending a number to its
current name
Unused business rule
The business rule you have created is not used in the model.
Manual correction Automatic correction
Apply the business rule to an
object in the model

Package check
During a package check, the following object controls are made.
Object parameters verified during check model
278 PowerDesigner
Circular reference
A circular reference occurs when a table refers to another table, and so on
until a loop is created between tables. A package cannot contain circular
references.
Manual correction Automatic correction
Resolve the circular reference by
correcting the reference, deleting
its source, or clearing the
Mandatory parent or Check on
commit option

Constraint name uniqueness


A constraint name is a unique identifier for the constraint definition of tables,
columns, primary and foreign keys in the database. You define the constraint
name in the following pages:
Check page of the table property sheet
Additional Check page of the column property sheet
General page of the key property sheet
A constraint name must be unique in a model.
Manual correction Automatic correction
Modify the duplicated constraint
name in the corresponding page
Modifies the duplicated constraint name of
a selected object by appending a number to
its current name
Constraint name maximum length
The constraint name length cannot be longer than the length specified in the
DBMS definition: either in the MaxConstLen entry, in the Object category,
or in each object category.
Manual correction Automatic correction
Modify the constraint name to
meet this requirement
Truncates the constraint name to the
maximum length specified in the DBMS
definition
Chapter 6 Working with Physical Data Models
PDM User's Guide 279
Circular dependencies
Extended dependencies with the stereotype <<DBCreateAfter>> can be used
between stored procedures to define a generation order for stored procedures.
An extended dependency with the stereotype <<DBCreateAfter>> should not
introduce a circular dependency in the model.
Manual correction Automatic correction
Remove the <<DBCreateAfter>>
extended dependency

Shortcut code uniqueness


Two shortcuts with the same code cannot be in the same namespace.
Manual correction Automatic correction
Change the code of one of the
shortcuts

User check
During a user check, the following object controls are made.
User name and code uniqueness
A model cannot contain two users with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated user
name/code
Modifies the user name/code of a selected
object by appending a number to its current
name
Object parameters verified during check model
280 PowerDesigner
User code length
The user code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsUser category).
Manual correction Automatic correction
Modify the user code length to
meet this requirement
Truncates the user code length to the
maximum length specified in the DBMS
definition
User password empty
Users must have a password to be able to connect to the database.
Manual correction Automatic correction
Define a password for the user
Group check
During a group check, the following object controls are made.
Group name and code uniqueness
A model cannot contain two groups with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated group
name/code
Modifies the group name/code of a selected
object by appending a number to its current
name
Existence of user
A group is created to factorize privilege and permission granting to users. A
group without user members is useless.
Manual correction Automatic correction
Add users to group or delete group Deletes unassigned group
Chapter 6 Working with Physical Data Models
PDM User's Guide 281
Group code length
The group code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsGroup category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the group code length to
meet this requirement
Truncates the group code length to the
maximum length specified in the DBMS
definition
Group password empty
Groups must have a password to be able to connect to the database (for those
DBMS that support passwords for groups.)
Manual correction Automatic correction
Define a password for the group
Role check
During a role check, the following object controls are made.
Role name and code uniqueness
A model cannot contain two roles with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated role
name/code
Modifies the role name/code of a selected
object by appending a number to its current
name
Existence of user or role
A role is used to create predefined profile that can be assigned to users or
roles. A role that is not assigned to any user or role is useless.
Manual correction Automatic correction
Assign role to users or delete role Deletes unassigned role
Object parameters verified during check model
282 PowerDesigner
Role code length
The role code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsRole category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the role code length to
meet this requirement
Truncates the role code length to the
maximum length specified in the DBMS
definition
Domain check
During a domain check, the following object controls are made.
Domain name and code uniqueness
A model cannot contain two domains with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated domain
name/code
Modifies the domain name/code of a
selected object by appending a number to its
current name
Domain code length
The domain code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsDomain category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the domain code length to
meet this requirement
Truncates the domain code length to the
maximum length specified in the DBMS
definition
Inconsistency in check parameters
The values entered in the check parameters page are inconsistent for numeric
and string data types: default 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.
Chapter 6 Working with Physical Data Models
PDM User's Guide 283
Manual correction Automatic correction
Modify default, minimum,
maximum or list of values in the
check parameters page

Data type precision and length


The data type precision should not be greater than the length.
Manual correction Automatic correction
Make the data type length greater
than the precision

Undefined data type


A model should not contain domains with undefined data type, all domains
should have a defined data type.
Manual correction Automatic correction
Select a data type from the domain
property sheet

Missing default object


A domain cannot have a default value without being attached to a default
object.
Manual correction Automatic correction
Create a default object for the
domain or use the rebuild default
feature
Creates a default object for domain
Table check
During a table check, the following object controls are made;
Object parameters verified during check model
284 PowerDesigner
Table name and code uniqueness
A model cannot contain two tables with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated name/code Modifies the table name/code of a selected
object by appending a number to its current
name
Table name and code length
The table name and code length is limited by the maximum length specified
in the DBMS definition (MaxLen entry, in the ObjectsTable category) and
in the naming conventions of the model options.
Manual correction Automatic correction
Modify the name/code length to
meet this requirement
Truncates the name/code length to the
maximum length specified in the DBMS
definition
Constraint name conflict with index name
A constraint name of the table cannot be the same as an index name.
Manual correction Automatic correction
Change the name of the table
constraint

Existence of column, reference, index, key


A table should contain at least one column, one index, one key, and one
reference.
Manual correction Automatic correction
Add missing item to the definition
of the table

Chapter 6 Working with Physical Data Models


PDM User's Guide 285
Number of auto-incremented columns
Auto-incremented columns contain automatically calculated values. A table
cannot contain more than one auto-incremented column.
Manual correction Automatic correction
Delete all but one auto-
incremented column

Table index definition uniqueness


Identical indexes are indexes with the same columns, order and type. A table
cannot have identical indexes.
Manual correction Automatic correction
Delete index or change its
properties

Table mapping not defined


When a table belongs to a model containing one or several data sources, it
must be mapped to tables or views in the data source in order to establish a
relational to relational mapping.
Manual correction Automatic correction
Map the current table to one or
several tables or views in the
model belonging to the data source
Destroys the mapping for the table. This
removes the data source from the Mapping
For dropdown listbox in the table Mapping
page
Column mapping not defined
When a column belong to a table in a model containing one or several data
sources, it should be mapped to columns in the data source in order to
establish a relational to relational mapping.
Manual correction Automatic correction
Map the current column to one or
several columns in the models
belonging to the data source
Destroys the mapping for the column. This
removes the columns that are not mapped to
any object in the Columns Mapping page of
the table Mapping page
Object parameters verified during check model
286 PowerDesigner
Existence of permission
Permissions are usage restrictions set on a table for a particular user, group or
role.
Manual correction Automatic correction
Define permissions on the table for
users, groups and roles

Column check
During a column check, the following object controls are made.
Column name and code uniqueness
A table cannot contain two columns with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated name/code Modifies the column name/code of a
selected object by appending a number to its
current name
Column code length
The column code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsColumn category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the column code length to
meet this requirement
Truncates the code length to the maximum
length specified in the DBMS definition
Chapter 6 Working with Physical Data Models
PDM User's Guide 287
Domain divergence
Divergence is verified between columns, domains, and data types. Various
checks and attributes are also examined. The Enforce non divergence check
box in Model Options must be cleared.
Manual correction Automatic correction
Select the Enforce non divergence
check box in Model Options to
enforce non divergence
Restores divergent attributes from domain
to column (domain values overwrite column
values)
Column mandatory
In some DBMS, the columns included in a key or a unique index should be
mandatory.
Manual correction Automatic correction
Select the Mandatory check box in
the column property sheet
Makes the column mandatory
Inconsistency in check parameters
The values entered in the check parameters page are inconsistent for numeric
and string data types: default 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 Automatic correction
Modify default, minimum,
maximum or list of values in the
check parameters page

Data type precision and length


The data type precision should not be greater than the length. Note that some
DBMS accept a precision higher than the length.
Manual correction Automatic correction
Make the data type length greater
than the precision

Object parameters verified during check model


288 PowerDesigner
Undefined data type
A model should not contain columns with undefined data type, all columns
should have a defined data type.
Manual correction Automatic correction
Select a data type in the column
property sheet

Foreign key column data type and constraint parameters divergence


Primary/alternate and foreign key columns involved in a join should have
consistent data types and constraint parameters.
Manual correction Automatic correction
Modify foreign key data types and
constraint parameters to make them
consistent
Parent column overwrites existing data type
and constraint parameters in the foreign key
column
Column with sequence not in a key
Since a sequence is used to initialize a key, it should be attached to a column
that is part of a key. This applies to those DBMS that support sequences.
Manual correction Automatic correction
Attach the sequence to a column
that is part of a key

Auto-incremented column with data type not numeric


An auto-incremented column must have a numeric data type.
Manual correction Automatic correction
Change the column data type Changes data type to numeric data type
Chapter 6 Working with Physical Data Models
PDM User's Guide 289
Missing computed column expression
A computed column should have a computed expression defined.
Manual correction Automatic correction
Add a computed expression to the
column in the Details page of the
column property sheet

Existence of permission
Permissions are usage restrictions set on a column for a particular user, group
or role.
Manual correction Automatic correction
Define permissions on the column
for users, groups and roles

Index check
During an index check, the following object controls are made.
Index name and code uniqueness
Depending on the DBMS, a model or a table cannot contain two indexes with
identical name and/or code.
Manual correction Automatic correction
Modify the duplicated index
name/code
Modifies the index name/code of a selected
object by appending a number to its current
name
Index code length
The index code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsIndex category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the index code length to
meet this requirement
Truncates the index code length to the
maximum length specified in the DBMS
definition
Object parameters verified during check model
290 PowerDesigner
Existence of index column
An index must have at least one index column.
Manual correction Automatic correction
Add an index column from the
Column page of the index property
sheet or delete the index
Deletes the index without column
Index inclusion
An index should not include another index.
Manual correction Automatic correction
Delete the index that includes an
existing index

Undefined index type


An index type must be specified.
Manual correction Automatic correction
Specify a type in the index
property sheet or delete the index
with no type

Index column count


The current DBMS does not support more than the number of index columns
specified in the MaxColIndex entry of the current DBMS.
Manual correction Automatic correction
Delete one or more columns in the
index property sheet. You can
create additional indexes for these
columns

Chapter 6 Working with Physical Data Models


PDM User's Guide 291
Uniqueness forbidden for HNG index type
An index of HNG (HighNonGroup) type cannot be unique.
Manual correction Automatic correction
Change the index type or set the
index as non unique

View index check


During a view index check, the following object controls are made.
Index name and code uniqueness
Depending on the DBMS, a model or a view cannot contain two view
indexes with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated view index
name/code
Modifies the view index name/code of a
selected object by appending a number to its
current name
Index code length
The view index code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsIndex category) or in the
naming conventions of the model options.
Manual correction Automatic correction
Modify the view index code length
to meet this requirement
Truncates the view index code length to the
maximum length specified in the DBMS
definition
Object parameters verified during check model
292 PowerDesigner
Existence of index column
A view index must have at least one index column.
Manual correction Automatic correction
Add an index column from the
Column page of the view index
property sheet or delete the index
Deletes the view index without column
Index inclusion
A view index should not include another index.
Manual correction Automatic correction
Delete the view index that includes
an existing index

Index column count


The current DBMS does not support more than the number of index columns
specified in the MaxColIndex entry in the Index category of the current
DBMS.
Manual correction Automatic correction
Delete one or more columns in the
view index property sheet. You can
create additional view indexes for
these columns

Key check
During a key check, the following object controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 293
Key name and code uniqueness
A model cannot contain two keys with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated key
name/code
Modifies the key name/code of a selected
object by appending a number to its current
name
Key code length
The key code length is limited by the maximum length specified in the
DBMS definition (MaxConstLen entry, in the ObjectKey category).
Manual correction Automatic correction
Modify the key code length to meet
this requirement
Truncates the key code length to the
maximum length specified in the DBMS
definition
Key column exists
Each key must have at least one column.
Manual correction Automatic correction
Add a column to the key from the
Column page of the key property
sheet
Deletes key without column
Key inclusion
A key cannot include another key (on some columns, regardless of their
order).
Manual correction Automatic correction
Delete the key that includes an
existing key

Object parameters verified during check model


294 PowerDesigner
Multi-column key has sequence column
Since the column initialized by a sequence is already a key, it should not be
included in a multi-column key.
Manual correction Automatic correction
Detach the sequence from a
column that is already part of a
multi-column key

Trigger check
During a key check, the following object controls are made.
Trigger name and code uniqueness
A model cannot contain two triggers with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated trigger
name/code
Modifies the trigger name/code of a selected
object by appending a number to its current
name
Trigger code length
The trigger code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsTrigger category).
Manual correction Automatic correction
Modify the trigger code length to
meet this requirement
Truncates the trigger code length to the
maximum length specified in the DBMS
definition
Reference check
During a reference check, the following object controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 295
Reference name and code uniqueness
A model cannot contain two references with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated reference
name/code
Modifies the reference name/code of a
selected object by appending a number to its
current name
Reference code length
The reference code length is limited by the maximum length specified in the
DBMS definition (MaxConstLen entry, in the ObjectReference category)
or in the naming conventions of the model options.
Manual correction Automatic correction
Modify the reference code length
to meet this requirement
Truncates the reference code length to the
maximum length specified in the DBMS
definition
Reflexive mandatory reference
A reflexive reference exists should not have a mandatory parent which could
lead to inconsistent joins.
Manual correction Automatic correction
Correct the reference by clearing
the Mandatory parent check box

Existence of reference join


A reference must have at least one reference join.
Manual correction Automatic correction
Create a reference join for the
reference or delete the reference
Deletes reference without join
Object parameters verified during check model
296 PowerDesigner
Incomplete joins
Joins must be complete.
Manual correction Automatic correction
Select a foreign key column or
activate the primary key column
migration

Join order
The join order must be the same as the key column order for some DBMS.
Manual correction Automatic correction
If required, change the join order
to reflect the key column order
The join order is changed to match the key
column order
During a reference check, the following object controls are made.
View reference check
During a view reference check, the following object controls are made.
View reference name and code uniqueness
A model cannot contain two view references with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated view
reference name/code
Modifies the view reference name/code of a
selected object by appending a number to its
current name
Existence of view reference join
A view reference must have at least one view reference join.
Manual correction Automatic correction
Create a view reference join for the
view reference or delete the
reference
Deletes view reference without join
Chapter 6 Working with Physical Data Models
PDM User's Guide 297
View check
During a view check, the following object controls are made.
View name and code uniqueness
A model cannot contain two views with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated view
name/code
Modifies the view name/code of a selected
object by appending a number to its current
name
View code length
The view code length is limited by the maximum length specified for the
table code length.
Manual correction Automatic correction
Modify the view code length to
meet this requirement
Truncates the view code length to the
maximum length specified in the DBMS
definition
Existence of permission
Permissions are usage restrictions set on a view for a particular user, group or
role.
Manual correction Automatic correction
Define permissions on the view for
users, groups and roles

Abstract data type check


During an abstract data type check, the following object controls are made.
Object parameters verified during check model
298 PowerDesigner
Abstract data type name and code uniqueness
A model cannot contain two abstract data types with identical name and/or
code.
Manual correction Automatic correction
Rename one of the abstract data
types
Renames the abstract data type by appending
a number to its name
Instantiable object type
If an abstract data type of type Object (or SQLJ Object) is instantiable
(Abstract option not checked), then it must have attributes and no abstract
procedure.
Manual correction Automatic correction
Define at least one attribute in
the ADT Attributes page and
clear the Abstract option in the
procedures property sheet

Abstract object type


If an abstract data type of type Object (or SQLJ Object) is not instantiable
(Abstract option checked), then it must not have tables based on it.
Manual correction Automatic correction
Set the Based on property to
<None> in the tables property
sheet

Abstract data type procedure check


During an abstract data type (ADT) procedure check, the following object
controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 299
Abstract data type procedure name and code uniqueness
An abstract data type cannot contain two procedures with identical name
and/or code.
Manual correction Automatic correction
Rename one of the ADT
procedures
Renames the ADT procedure by appending a
number to its name
Name conflict with attribute
An abstract data type procedure cannot have the same name as an attribute.
Manual correction Automatic correction
Change the name of the ADT
procedure

Abstract data type procedure definition empty


An abstract data type procedure must have a definition.
Manual correction Automatic correction
Create an ADT procedure
definition in the Definition page
of the ADT procedure property
sheet

Inconsistent return type


If the abstract data type procedure is a function, a map or an order, you
should define a return data type for the function, map or order.
Manual correction Automatic correction
Select a return data type in the
Return data type dropdown
listbox

Object parameters verified during check model


300 PowerDesigner
Synonym check
During a synonym check, the following object controls are made.
Synonym name and code uniqueness
A model cannot contain two synonyms with identical name and/or code.
Manual correction Automatic correction
Rename one of the synonyms Renames the synonym object by appending a
number to its name
Synonym name and code length
The synonym name and code length is limited by the maximum length
specified in the DBMS definition (MaxLen entry, in the ObjectsSynonym
category) and in the naming conventions of the model options.
Manual correction Automatic correction
Modify the name/code length to
meet this requirement
Truncates the name/code length to the
maximum length specified in the DBMS
definition
Existence of base object
A synonym must correspond to a model object. By default, when you create
synonyms from the List of Synonyms using the Add a Row tool, they are not
attached to any base object.
Manual correction Automatic correction
Select a base object from the
synonym property sheet
Deletes the synonym
Database package check
During a database package check, the following object controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 301
Database package name and code uniqueness
A model cannot contain two database packages with identical name and/or
code.
Manual correction Automatic correction
Rename one of the database
packages
Renames the database package object by
appending a number to its name
Database package name and code length
The database package name and code length is limited by the maximum
length specified in the DBMS definition (MaxLen entry, in the ObjectsDB
Package category) and in the naming conventions of the model options.
Manual correction Automatic correction
Modify the name/code length to
meet this requirement
Truncates the name/code length to the
maximum length specified in the DBMS
definition
Existence of package procedure
A database package is an encapsulated collection of related procedures. It
should contain at least one procedure.
Manual correction Automatic correction
Create one or several procedures
in the database package or use
existing stored procedures and
duplicate them in the database
package

Existence of package cursor


This check is to suggest that a database package can contain cursors to define
a work area and access its stored information.
Manual correction Automatic correction
Create one or several cursors in
the Cursors page of the database
package property sheet

Object parameters verified during check model


302 PowerDesigner
Existence of package variable
This check is to suggest that a database package can contain variables to
capture or provide a value when one is needed.
Manual correction Automatic correction
Create one or several variables in
the Variables page of the
database package property sheet

Existence of package type


This check is to suggest that a database package can contain user-defined
data types called types.
Manual correction Automatic correction
Create one or several types in the
Types page of the database
package property sheet

Existence of package exception


This check is to suggest that a database package can contain exceptions to
handle internal and user-defined error conditions.
Manual correction Automatic correction
Create one or several exceptions
in the Exceptions page of the
database package property sheet

Database package procedure check


During a package procedure check, the following object controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 303
Package procedure name and code uniqueness
A database package cannot contain two package procedures with identical
name and/or code.
Manual correction Automatic correction
Rename one of the package
procedures
Renames the package procedure by appending
a number to its name
Package procedure definition empty
A package procedure must have a definition.
Manual correction Automatic correction
Create the package procedure
definition in the Definition page
of the package procedure
property sheet

Existence of parameter
A package procedure must contain parameters for input and output values.
Manual correction Automatic correction
Create one or several parameters
in the Parameters page of the
package procedure property sheet

Undefined return type


If the package procedure is a function, you should define a return data type
for the function.
Manual correction Automatic correction
Select a return data type in the
Return Data Type dropdown
listbox

Object parameters verified during check model


304 PowerDesigner
Database package cursor check
During a package cursor check, the following object controls are made.
Package cursor name and code uniqueness
A database package cannot contain two cursors with identical name and/or
code.
Manual correction Automatic correction
Rename one of the cursors Renames the cursor by appending a number to
its name
Package cursor definition empty
A package cursor must have a definition.
Manual correction Automatic correction
Create the cursor definition in
the Definition page of the cursor
property sheet

Undefined return type


You should define a return data type for a cursor.
Manual correction Automatic correction
Select a return data type in the
cursor property sheet

Existence of parameter
A cursor must contain parameters for input values.
Manual correction Automatic correction
Create one or several parameters
in the Parameters page of the
cursor property sheet

Chapter 6 Working with Physical Data Models


PDM User's Guide 305
Database package variable check
During a package variable check, the following object controls are made.
Package variable name and code uniqueness
A database package cannot contain two variables with identical name and/or
code.
Manual correction Automatic correction
Rename one of the variables Renames the variable by appending a number
to its name
Undefined data type
You should define a data type for a variable.
Manual correction Automatic correction
Select a data type in the variable
property sheet

Database package type check


During a package type check, the following object controls are made.
Package type name and code uniqueness
A database package cannot contain two package types with identical name
and/or code.
Manual correction Automatic correction
Rename one of the package types Renames the package type by appending a
number to its name
Object parameters verified during check model
306 PowerDesigner
Package type definition empty
A package type must have a definition.
Manual correction Automatic correction
Create the type definition in the
Definition page of the package
type property sheet

Database package exception check


During an exception check, the following object controls are made.
Package exception name and code uniqueness
A database package cannot contain two exceptions with identical name
and/or code.
Manual correction Automatic correction
Rename one of the exceptions Renames the exception by appending a
number to its name
Procedure check
During a procedure check, the following object controls are made.
Procedure name and code uniqueness
A model cannot contain two procedures with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated procedure
name/code
Modifies the procedure name/code of a
selected object by appending a number to its
current name
Chapter 6 Working with Physical Data Models
PDM User's Guide 307
Procedure code length
The procedure code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsProcedure category).
Manual correction Automatic correction
Modify the procedure code length
to meet this requirement
Truncates the procedure code length to the
maximum length specified in the DBMS
definition
Procedure definition body empty
A procedure definition should have a body to specify its functionality.
Manual correction Automatic correction
Specify a procedure body from the
Definition page of the procedure
property sheet

Existence of permission
Permissions are usage restrictions set on a procedure for a particular user,
group or role.
Manual correction Automatic correction
Define permissions on the
procedure for users, groups and
roles

Data source check


During a data source check, the following object controls are made.
Data source name and code uniqueness
A model cannot contain two data sources with identical name and/or code.
Manual correction Automatic correction
Rename one of the data sources Renames the data source object by appending
a number to its name
Object parameters verified during check model
308 PowerDesigner
Existence of physical data model
A data source must contain at least one physical data model in its definition.
Manual correction Automatic correction
Add a physical data model from
the Models page of the property
sheet of the data source
Deletes data source without physical data
model
Differing DBMS types
The models in a data source should share the same DBMS since they
represent a single database.
Manual correction Automatic correction
Delete models with different
DBMS or modify the DBMS of
models in the data source

File object check


During a file check, the following object controls are made.
Embedded file name uniqueness
A model cannot contain two embedded file objects with identical name.
Manual correction Automatic correction
Rename one of the embedded file
objects
Renames the file object by appending a
number to its name
Existence of external file location
External file objects should have a valid location path.
Manual correction Automatic correction
Define a valid path location
Chapter 6 Working with Physical Data Models
PDM User's Guide 309
Cube check
During a cube check, the following object controls are made.
Cube name and code uniqueness
A model cannot contain two cubes with identical name and/or code.
Manual correction Automatic correction
Rename one of the cubes Renames the cube object by appending a
number to its name
Existence of association
A cube must have at least one association with a dimension.
Manual correction Automatic correction
Create an association between
the cube and a dimension

Existence of fact
A cube must be associated to a fact.
Manual correction Automatic correction
Click the Ellipsis button beside
the Fact box in the cube property
sheet, and select a fact from the
List of Facts

Duplicated association with the same dimension


A cube cannot have more than one association with the same dimension.
Manual correction Automatic correction
Delete one of the associations
Object parameters verified during check model
310 PowerDesigner
Fact check
During a fact check, the following object controls are made.
Fact name and code uniqueness
A model cannot contain two facts with identical name and/or code.
Manual correction Automatic correction
Rename one of the facts Renames the fact object by appending a
number to its name
Existence of measure
A fact must have at least one measure.
Manual correction Automatic correction
Create a measure in the Measures
page of the fact property sheet

Fact mapping not defined


A fact must be mapped to tables or views in an operational model in order to
be populated by data from this model.
Manual correction Automatic correction
Map the fact to tables or views.
You may need to create a data
source before you can create the
mapping
Destroys the mapping for the fact. This
removes the data source from the Mapping
For dropdown listbox in the fact Mapping
page
Measure mapping not defined
Fact measures must be mapped to columns in the data source tables or views.
Manual correction Automatic correction
Map the fact measure to columns
in the data source
Destroys the mapping for the measure. This
removes the measures that are not mapped to
any object in the Measures Mapping page of
the fact Mapping page
Chapter 6 Working with Physical Data Models
PDM User's Guide 311
Fact measure check
During a fact measure check, the following object controls are made.
Fact measure name and code uniqueness
A model cannot contain two fact measures with identical name and/or code.
Manual correction Automatic correction
Rename one of the fact measures Renames the fact measure object by
appending a number to its name
Dimension check
During a dimension check, the following object controls are made.
Dimension name and code uniqueness
A model cannot contain two dimensions with identical name and/or code.
Manual correction Automatic correction
Rename one of the dimensions Renames the dimension object by appending a
number to its name
Existence of attribute
A dimension must have at least one attribute.
Manual correction Automatic correction
Create an attribute in the
Attributes page of the dimension
property sheet

Object parameters verified during check model


312 PowerDesigner
Existence of hierarchy
A dimension must use at least one hierarchy.
Manual correction Automatic correction
Create a hierarchy in the
Hierarchies page of the
dimension property sheet

Duplicated hierarchies
Dimensions should not have duplicated hierarchies, that is to say hierarchies
organizing identical attributes.
Manual correction Automatic correction
Remove one of the duplicated
hierarchies

Dimension without a default hierarchy


A dimension should have a default hierarchy.
Manual correction Automatic correction
Select a hierarchy in the Default
Hierarchy dropdown listbox of
the dimension property sheet

Dimension mapping not defined


A dimension should be mapped to tables or views in an operational model in
order to be populated by data from this model.
Manual correction Automatic correction
Map the dimension to a table or a
view. You may need to create a
data source before you can create
the mapping
Destroys the mapping for the dimension. This
removes the data source from the Mapping for
dropdown listbox in the dimension Mapping
page
Chapter 6 Working with Physical Data Models
PDM User's Guide 313
Attribute mapping not defined
Attributes must be mapped to columns in the data source tables or views.
Manual correction Automatic correction
Map the attributes to columns in
the data source

Attribute check
During an attribute check, the following object controls are made.
Attribute name and code uniqueness
A model cannot contain two attributes with identical name and/or code.
Manual correction Automatic correction
Rename one of the attributes Renames the attribute object by appending a
number to its name
Dimension hierarchy check
During a dimension hierarchy check, the following object controls are made.
Dimension hierarchy name and code uniqueness
A model cannot contain two dimension hierarchies with identical name
and/or code.
Manual correction Automatic correction
Rename one of the dimension
hierarchies
Renames the dimension hierarchy object by
appending a number to its name
Object parameters verified during check model
314 PowerDesigner
Existence of attribute
A dimension hierarchy must have at least one attribute.
Manual correction Automatic correction
Add an attribute to the hierarchy
from the Attributes page of the
hierarchy property sheet

Association check
During an association check, the following object controls are made.
Association name and code uniqueness
A model cannot contain two associations with identical name and/or code.
Manual correction Automatic correction
Rename one of the associations Renames the association object by appending
a number to its name
Existence of hierarchy
An association must use a hierarchy.
Manual correction Automatic correction
Select a hierarchy in the
Hierarchy dropdown listbox in
the association property sheet

Join index check


During a join index check, the following object controls are made on join
indexes and bitmap join indexes.
Chapter 6 Working with Physical Data Models
PDM User's Guide 315
Join index name and code uniqueness
A model cannot contain two join indexes with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated join index
name/code
Modifies the join index name/code of a
selected object by appending a number to its
current name
Existence of base table
Join index must have a base table.
Manual correction Automatic correction
Select a base table in the join index
property sheet

Join Index tables owners


The tables associated to a join index must have the same owner.
Manual correction Automatic correction
Modify the join index owner or the
table owner

Join index references connection


Join index references must be connected to selected table on a linear axis.
Manual correction Automatic correction
Delete or replace references in the
join index

Object parameters verified during check model


316 PowerDesigner
Duplicated join indexes
Join indexes cannot have the same set of references.
Manual correction Automatic correction
Delete one of the duplicated join
indexes

Reference without parent key


References in bitmap join index should be linked to a key.
Manual correction Automatic correction
Delete or replace references in the
join index

Replication check
During a replication check, the following object controls are made.
Partial replication
A replica object is partially synchronized with its replicated object.
Manual correction Automatic correction
Modify the list of replicated
attributes from the replication
property sheet
Enforces the replication of desynchronized
attributes of the replica object in the
replication property sheet
Default check
During a default check, the following object controls are made.
Chapter 6 Working with Physical Data Models
PDM User's Guide 317
Default name and code uniqueness
A model cannot contain two defaults with identical name and/or code.
Manual correction Automatic correction
Rename one of the defaults Renames the default object by appending a
number to its name
Default code maximum length
The default code length is limited by the maximum length specified in the
DBMS definition (MaxLen entry, in the ObjectsDefault category).
Manual correction Automatic correction
Modify the default code length to
meet this requirement
Truncates the default code length to the
maximum length specified in the DBMS
definition
Default value empty
You must type a value for the default, this value is used during generation.
Manual correction Automatic correction
Type a value in the Value box of
the default property sheet

Several defaults with same value


A model should not contain several defaults with identical value.
Manual correction Automatic correction
Modify default value or delete
defaults with identical value

Storage check
During a storage check, the following object controls are made.
Object parameters verified during check model
318 PowerDesigner
Storage name and code uniqueness
A model cannot contain two storages with identical name and/or code.
Manual correction Automatic correction
Rename one of the storages Renames the default object by appending a
number to its name
Storage not used
The storage you have created is not used in the model.
Manual correction Automatic 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 page
of the object property sheet)

Tablespace check
During a tablespace check, the following object controls are made.
Tablespace name and code uniqueness
A model cannot contain two tablespaces with identical name and/or code.
Manual correction Automatic correction
Rename one of the tablespaces Renames the default object by appending a
number to its name
Chapter 6 Working with Physical Data Models
PDM User's Guide 319
Tablespace not used
The tablespace you have created is not used in the model.
Manual correction Automatic 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 page of
the object property sheet)

Extended object check


During an extended object check, the following object controls are made.
Extended object name and code uniqueness
Extended object names and codes must be unique in the namespace.
Manual correction Automatic correction
Modify the duplicate extended object
name/code
Modifies the extended object name or
code of a selected object by appending a
number to its current name or code
Extended link check
During an extended link check, the following object controls are made.
Extended link name and code uniqueness
Extended link names and codes must be unique in the namespace.
Manual correction Automatic correction
Modify the duplicate extended link
name/code
Modifies the extended link name or
code of a selected object by appending a
number to its current name or code
Object parameters verified during check model
320 PowerDesigner
Web service check
During a Web service check, the following object controls are made.
Web service name and code uniqueness
A model cannot contain two Web services with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated Web service
name/code
Modifies the name/code of a selected
Web service by appending a number to
its current name
Web service code maximum length
The Web service code length is limited by the maximum length specified in
the DBMS definition (Maxlen entry, in the ObjectsWeb Service category).
Manual correction Automatic correction
Modify the Web service code length to
meet this requirement
Truncates the Web service code length
to the maximum length specified in the
DBMS definition
Web operation check
During a Web operation check, the following object controls are made.
Web operation name and code uniqueness
A model cannot contain two Web operations with identical name and/or
code.
Manual correction Automatic correction
Modify the duplicated Web operation
name/code
Modifies the name/code of a selected
Web operation by appending a number
to its current name
Chapter 6 Working with Physical Data Models
PDM User's Guide 321
Web operation code maximum length
The Web operation code length is limited by the maximum length specified
in the DBMS definition (Maxlen entry, in the ObjectsWeb Operation
category).
Manual correction Automatic correction
Modify the Web operation code length
to meet this requirement
Truncates the Web operation code
length to the maximum length specified
in the DBMS definition
Undefined operation type
A Web operation for a Web service in IBM DB2 should have a defined type.
Manual correction Automatic correction
Select a value in the Operation
Type dropdown listbox of the Web
operation property sheet

Mapping objects in a PDM


322 PowerDesigner
Mapping objects in a PDM
Object mapping is the ability to establish a correspondence between objects
belonging to heterogeneous models and diagrams.
In a PDM, you can link physical and multidimensional objects for the
following purpose:
Relational to relational mapping between physical objects to generate
extraction scripts to populate a data warehouse with operational data
Relational to multidimensional mapping between physical and
multidimensional objects to generate text files containing cube data to
fill the OLAP database
Understanding object mapping
You create a mapping between PDM objects to setup a structure for data
movement and transformation. Data comes from a data source and is loaded
in another database.
In PowerDesigner, the data source and the destination database can be
designed in physical data models.
The following schema illustrates the transfer of data between the different
types of databases:
The above diagram shows the different paths for data transfer:
From operational to data warehouse databases
From data warehouse to OLAP databases
Data transfer
Chapter 6 Working with Physical Data Models
PDM User's Guide 323
From Operational to OLAP databases. This path is less common.
Usually operational data need to be stored in a data warehouse database
before they can be used in an OLAP engine. However, when there are no
large amounts of data, it is possible to skip the data warehouse step and
have a data transfer directly from the operational database to the OLAP
engine. For clarity purpose, we will not develop this aspect of data
transfer in this section
A data source is usually a database from which data is taken and sent to
another database. As mentioned above, the transfer can be from operational
to data warehouse or OLAP databases, or from data warehouse to OLAP
databases.
Object mapping consists in linking objects in the data source to objects in the
database that needs to receive data.
For a relational to relational mapping, you can associate tables or views
from the source models to tables in the destination models
For a relational to multidimensional mapping, you can associate tables or
views from the source models to cubes and facts in the destination
models
The mapping appears as a query defined in the destination table or cube: this
query allows data selection from the data source and transfer it to the
destination database. You can further define the mapping by linking table
columns from the source and to table columns, fact measures, or attributes.
Defining data sources in a PDM
You create a data source to define where (in which database) data should be
extracted to be transferred to another database.
When you define a data source, you have to declare physical data models in
the list of data source models. A data source can contain several models, you
can select the source models among a list of models opened in the current
workspace. All the selected models represent the same database that contains
operational data.
A model can contain several data sources.
When you use a single PDM to design an operational, a data warehouse, and
an OLAP database, the PDM is its own data source. In this case, you can use
the Rebuild Cubes feature.
For more information on the Rebuild Cubes feature, see section
Rebuilding cubes.
Mapping objects in a PDM
324 PowerDesigner
Data source properties in a PDM
A data source includes the following properties:
Property Description
Name Name for the data source
Code Reference code for the data source
Comment Descriptive label for the data source
A data source also includes the following properties:
The Models page lets you define the list of models representing one database.
This database is the source of data for the model where you define a data
source. You use the Add Models tools to open a selection dialog box, you
must select among models opened in the current workspace.
The ODBC page lets you define the following parameters to connect to the
database:
Parameter Description
Data source Name of the ODBC data source associated with the database
Login User login
Password User password
Creating a data source in a PDM
You can create as many data sources as you need in a model. Each data
source defines the list of models used as source of data in the current model.
To create a data source in a PDM:
1 Select ModelData Sources to display the List of Data Sources.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a name and a code.
4 Click Apply.
Models
ODBC
Chapter 6 Working with Physical Data Models
PDM User's Guide 325
5 Click the Properties button to display the property sheet of the data
source.
6 Click the Models tab.
7 Click the Add Models tool.
A model selection dialog box appears. You can select the models for the
current data source.
8 Click the ODBC tab to define the database ODBC connection
parameters.
9 Click OK in each of the dialog boxes.
Mapping objects in a PDM
326 PowerDesigner
Selecting an ODBC data source
The Select an ODBC Data Source dialog box lets you define the following
parameters:
Parameter Description
Machine data source This data source is created on the client machine, and is
available to the user currently logged onto the system.
Machine data sources are stored in the part of the registry
containing settings for the current user
File data source This data source is stored as a file. A file data source has
the extension .dsn. It can be used by different users if it is
placed in the default location for file data sources. File
data sources are usually managed by database
administrators
Setup Displays the ODBC Configuration dialog box for the
selected DBMS
Add Displays the ODBC Data Source Administrator dialog
box for creating a data source
ODBC drivers
It is strongly recommended that customers connecting to Oracle databases
should use the ODBC drivers that ship with PowerDesigner. These drivers
are fully compliant and will offer optimum reliability and performance
Defining a relational to relational mapping
Data warehousing requires to extract, transform, and load data from
operational systems to a data warehouse database. You can map PDM objects
to create a relational to relational mapping between operational and data
warehouse data.
Operational and data warehouse data can be designed in physical data
models.
This kind of mapping is used to clearly identify the data sources i.e. the
operational databases, of the data warehouse database.
Chapter 6 Working with Physical Data Models
PDM User's Guide 327
Moreover, once this mapping is defined, it can be used to generate extraction
scripts to populate a data warehouse with operational data.
The following table lists object mapping in a relational to relational mapping:
Operational object Data warehouse object
Table Table (Fact or Dimension type)
Column Column
The relational to relational mapping implies:
The creation of data sources to define where the data comes from
The mapping of each table in the data warehouse model with tables in
the source model
For more information on creating a data source, see section Creating a
data source in a PDM.
Mapping tables
The table mapping allows you to identify the physical data objects (tables or
views) used to populate data warehouse tables.
Once the source tables or views are identified and mapped with the tables of
the current model, you can define mappings between columns.
Mapping objects in a PDM
328 PowerDesigner
You have to use the Mapping page of a table property sheet to define table
mappings. In the Mapping page, you can use the following tools to select a
data source:
Tool Description
Adds a mapping between the current table and an existing data source.
The first time you define a mapping for a table, the Mapping For
dropdown listbox is empty, you have to add a mapping to a data source
before you can map the table to tables or views in the data source
Deletes the mapping for the data source
Edits properties of the selected data source
The Table sources page allows you to associate one or several tables or views
in the data source to the current table. Operational data from the source tables
will be transferred to the current table.
You can use the Add Objects tool to select tables or views from the physical
data models opened in the current workspace.
The Columns mapping page allows you to define the mapping between
columns in the source tables or views and the current columns.
Icon Tool Description
Add Mapping To select the columns in the current table that will be
mapped to columns in the source table or view. Once
you have selected the columns, you can use the
dropdown listbox in the Mapped to column to select
corresponding columns in the source table or view
Generate
Mapping
To automatically generate a mapping between columns
with same name or code in the data source and the
current model
Create from
Sources
To copy columns from the tables or views in the data
source to the current table. The name, code ,
description, annotation, and comment are copied and
the data types are converted in order to match the
DBMS of the current model
The Ellipsis button in the Mapped to column opens the SQL Editor dialog
box to let you customize the source expression for the column.
The Criteria page allows you to specify join criteria between source tables.
For example: EMPLOYEE.ID < 100
Table sources
page
Columns mapping
page
Criteria page
Chapter 6 Working with Physical Data Models
PDM User's Guide 329
The Select page displays the entire SQL statement used to select data in the
data source. This statement is automatically generated.
If you modify it, the statement is no longer calculated and the User Defined
tool is pressed in the toolbar. You can recover the automatically generated
statement by clicking the User-Defined tool, this will automatically remove
any non-calculated expression in the page.
Creating a relational to relational mapping for a table
To create a relational to relational mapping for a table:
1 Double-click a table to display the table property sheet.
2 Select the Mapping tab to display the Mapping page.
3 Click the Add A Mapping For A Data Source tool to select a data source
for the mapping.
or
Select a data source in the Mapping For dropdown listbox if you have
already selected one or several data sources.
4 In the Table Sources page, click the Add Objects tool to select the source
tables you want to map to the current table.
The name and code of the tables appear in the list.
Select page
Mapping objects in a PDM
330 PowerDesigner
5 Select the Columns Mapping tab in the Mapping page.
6 Click the Add Mapping tool.
7 Select the columns that will be mapped to columns in the source tables
or views and click OK.
The selected columns appear in the first column of the list.
Generate mapping
You can click the Generate Mapping tool to automatically create the
mapping between columns with identical name or code in the data
source and the current model
8 Click the down arrow in the Mapped To column to select the column in
the data source table to which the selected column will be mapped.
You have to repeat this operation for each column you want to map to
the data source.
9 Select the Criteria tab if you want to specify join criteria between the
source tables or views.
10 Select the Select tab if you want to visualize or modify the entire
statement.
11 Click OK.
Chapter 6 Working with Physical Data Models
PDM User's Guide 331
Modifying the mapping of a column
You can modify the default mapping created for a column. The Column
Mappings property sheet can be used to fine-tune the mapping between a
column in the current table and columns in other tables in the data source.
Note:
This feature also applies to attribute mapping in relational to
multidimensional mapping.
In the Mapped To box, you can see the column expression. By default,
columns used in this expression are prefixed by their tables. You can
customize the content of the Mapped To box by inserting comments
manually. You can also click the Ellipsis button and use the SQL Editor to
modify the default mapping syntax. To recover the default column expression
click the User-defined tool.
In the Sources page it is possible to select several columns and map them to
the current column. To do so, you have to use the Add Sources tool to select
columns from the list of columns belonging to the tables mapped to the
current table. When you add columns from the Sources page, and when the
column expression has not been modified by the user, the content of the
Mapped To box in the General page is updated.
For example, you define a mapping between table TOTAL_SALES in
Model_1 and tables EUROPEAN_SALES in Model_2 and ASIAN_SALES
in Model_3. Each table has a column called TOTAL AMOUNT. You can
define column TOTAL AMOUNT in TOTAL_SALES as the sum of total
amounts in EUROPEAN_SALES and ASIAN_SALES:
Mapping objects in a PDM
332 PowerDesigner
To modify the mapping of a column:
1 In the Mapping page, select the Columns Mapping tab to display the
corresponding page.
2 Select a column in the list and click the Properties tool.
The Column Mappings Properties appears.
3 Click the Sources tab to display the corresponding page.
4 Click the Add Sources tool to display a Selection dialog box.
5 Select source columns and click OK.
The columns appear in the Sources list.
6 Click the General tab to display the corresponding page. The selected
columns appear in the Mapped To box.
7 Click OK.
Defining a relational to multidimensional mapping
OLAP cubes are usually filled with data from a data warehouse database.
As mentioned in section Understanding object mapping, it is possible to skip
the data warehouse step and have an OLAP engine directly filled from an
operational database. However this is not very common, and supposes fairly
small amounts of data to manipulate. In this section, we will consider the case
of OLAP database filled with data from a data warehouse.
Chapter 6 Working with Physical Data Models
PDM User's Guide 333
You can link PDM objects to create a relational to multidimensional mapping
between physical objects and OLAP objects. With this link, it will be
possible to generate text files containing data warehouse data. These text files
can be used to populate OLAP cubes.
The following table lists object mapping in a relational to multidimensional
mapping:
Data warehouse object OLAP object
Table (Fact type or children
tables)
Fact
Table (Dimension type or
parent tables)
Dimension
Column Attribute of a fact or measure of a dimension
The relational to multidimensional mapping implies:
The creation of data sources to define where the data comes from
The mapping of each dimension and fact with tables in the data
warehouse (or operational model)
For more information on creating a data source, see section Creating a
data source in a PDM.
Operational and data warehouse data are designed in physical diagrams and
OLAP data are designed in multidimensional diagrams.
Mapping objects in a PDM
334 PowerDesigner
Automatic mapping
When you use the Rebuild Cubes feature to create cubes and dimensions
from fact and dimension tables, the mapping between source tables and
OLAP objects is automatically performed. For more information on the
Rebuild Cubes feature, see section Rebuilding Cubes in chapter Building
Multidimensional Diagrams.
The relational to multidimensional mapping is used to generate cube data in
text files to be loaded by OLAP engines.
Mapping a dimension to a table or a view
The mapping for a dimension is used to supply data for the cube dimensions
in OLAP databases. You can identify the tables or views used to populate
OLAP cubes. The tables in the data source need not be of dimension type.
Once the source tables or views are identified, you can define mappings
between attributes and table columns.
You define the dimension mapping from the Mapping page of the dimension
property sheet.
In the mapping page, you can use the following tools to select a data source:
Tool Description
Adds a mapping between the current dimension and an existing data
source. The first time you define a mapping for a dimension, the
Mapping For dropdown listbox is empty, you have to add a mapping to a
data source before you can map the dimension to tables or views in the
data source
Deletes the mapping
Edits the selected data source
The Dimension sources page allows you to associate one or several tables or
views in the data source to the current dimension. Data from the selected
tables will be transferred to the current dimension.
You can use the Add Objects tool to select tables or views from the physical
data models opened in the current workspace.
Dimension sources
page
Chapter 6 Working with Physical Data Models
PDM User's Guide 335
The Attributes mapping page allows you to define the mapping between
attributes and columns in the previously selected source tables or views.
Icon Tool Description
Add Mapping To select the attributes in the current dimension that
will be mapped to columns in the source table or view.
Once you have selected the attributes, you can use the
dropdown listbox in the Mapped to column to select
corresponding columns in the source table or view
Generate
Mapping
To automatically generate a mapping between columns
and attributes with same name or code in the current
model and the data source
Create from
Sources
To copy columns from the tables or views in the data
source to the current dimension. The name, code ,
description, annotation, and comment are copied and
the data types are converted in order to match the
DBMS of the current model
When you click the Ellipsis button in the Mapped to column, the SQL Editor
dialog box appears to let you customize the source expression for the column.
The Criteria page allows you to specify join criteria between source tables
and dimensions. For example: EMPLOYEE.ID < 100
The Select page displays the entire SQL statement used to select data in the
data source. This statement is automatically generated.
If you modify it, the statement is no longer calculated and the User Defined
tool is pressed in the toolbar. You can recover the automatically generated
statement by clicking the User-Defined tool, this will automatically remove
any non-calculated expression in the page.
The Generate Cube Data feature uses this SQL statement to fill the text files
used to populate cubes in an OLAP database.
For more information on the generation of cube data, see section
Generating Cube Data.
Creating a relational to multidimensional mapping for a dimension
To create a relational to multidimensional mapping for a dimension:
1 Double-click a dimension to display the dimension property sheet.
2 Select the Mapping tab to display the Mapping page.
Attributes mapping
page
Criteria page
Select page
Mapping objects in a PDM
336 PowerDesigner
3 Click the Add A Mapping For A Data Source tool to select a data source
for the mapping.
or
Select a data source in the Mapping For dropdown listbox if you have
already selected one or several data sources.
4 In the Dimension Sources page, click the Add Objects tool to select the
tables you want to map to the current dimension.
The name and code of the tables appear in the list.
5 Select the Attributes Mapping tab in the Mapping page.
6 Click the Add Mapping tool.
7 Select the attributes that will be mapped to columns in the source tables
or views and click OK.
The selected attributes appear in the first column of the list.
Generate mapping
You can click the Generate Mapping to tool to automatically create
the mapping between attributes and columns with identical name or
code in the data source.
8 Click the down arrow in the Mapped to column to select the column in
the data source table to which the selected attribute will be mapped.
Chapter 6 Working with Physical Data Models
PDM User's Guide 337
You have to repeat this operation for each attribute you want to map to
the data source.
9 Select the Criteria tab if you want to specify join criteria between the
source tables.
10 Select the Select tab if you want to visualize the entire statement.
11 Click OK.
Mapping a fact to a table or a view
The mapping for a fact is used to supply data for the cube measures in OLAP
databases. You can identify the tables or views used to populate OLAP
cubes. The tables in the data source need not be of fact type. Once the source
tables or views are identified, you can define mappings between fact
measures and table columns.
You define the fact mapping from the Mapping page of the fact property
sheet.
In the Mapping page, you can use the following tools to select a data source:
Tool Description
Adds a mapping between the current fact and an existing data source.
The first time you define a mapping for a fact, the Mapping For
dropdown listbox is empty, you have to add a mapping to a data source
before you can map the fact to tables or views in the data source
Mapping objects in a PDM
338 PowerDesigner
Tool Description
Deletes the mapping
Edits the selected data source
The Fact sources page allows you to associate one or several tables or views
in the data source to the current fact. Data from the selected tables will be
transferred to the current fact.
You can use the Add Objects tool to select tables or views from the physical
data models opened in the current workspace.
The Measures mapping page allows you to define the mapping between
measures and columns in the source tables or views.
Icon Tool Description
Add Mapping To select the measures in the current fact that will be
mapped to columns in the source table or view. Once
you have selected the measures, you can use the
dropdown listbox in the Mapped to column to select
corresponding columns in the source table or view
Generate
Mapping
To automatically generate a mapping between columns
and measures with same name or code
Create from
Sources
To copy columns from the tables or views in the data
source to the current fact. The name, code, description,
annotation, and comment are copied and the data types
are converted in order to match the DBMS of the
current model
When you click the Ellipsis button in the Mapped to column, the SQL Editor
dialog box appears to let you customize the source expression for the column.
The Criteria page allows you to specify join criteria between source tables
and dimensions. For example: EMPLOYEE.ID < 100
The Select page displays the entire SQL statement used to select data in the
data source. This statement is automatically generated.
If you modify it, the statement is no longer calculated and the User Defined
tool is pressed in the toolbar. You can recover the automatically generated
statement by clicking the User-Defined tool, this will automatically remove
any non-calculated expression in the page.
Fact sources page
Measures mapping
page
Criteria page
Select page
Chapter 6 Working with Physical Data Models
PDM User's Guide 339
The Generate Cube Data feature uses this SQL statement to fill the text files
used to populate cubes in an OLAP database.
For more information on the generation of cube data, see section
Generating Cube Data.
Creating a relational to multidimensional mapping for a fact
To create a relational to multidimensional mapping for a fact:
1 Open the property sheet of a fact.
2 Select the Mapping tab to display the Mapping page.
3 Click the Add A Mapping For A Data Source tool to select a data source
for the mapping.
or
Select a data source in the Mapping For dropdown listbox if you have
already selected one or several data sources.
4 In the Fact sources page, click the Add Objects tool to select the tables
you want to map to the current fact.
The name and code of the tables appear in the list.
5 Select the Measures Mapping tab in the Mapping page.
6 Click the Add Mapping tool.
Mapping objects in a PDM
340 PowerDesigner
7 Select the measures that will be mapped to columns in the data source
and click OK.
The selected measures appear in the first column of the list.
Generate mapping
You can click the Generate Mapping to tool to automatically create
the mapping between measures and columns with identical name or
code in the data source
8 Click the down arrow in the Mapped to column to select the column in
the data source table to which the selected measure will be mapped.
You have to repeat this operation for each measure you want to map to
the data source.
9 Select the Criteria tab if you want to specify join criteria between the
source tables.
10 Select the Select tab if you want to visualize the entire statement.
11 Click OK.
For more information on the cube query, see section Defining the query
of a cube.
Chapter 6 Working with Physical Data Models
PDM User's Guide 341
Retrieving multidimensional objects
You will need to identify fact and dimension tables and views during the
design of a data warehouse. Tables and views support multidimensional
types, in this section both are referred to as fact and dimension tables.
A fact table stores variable numerical values related to aspects of a business.
For example, sales, revenue, budget. These are usually the values you want to
obtain when you carry out a decision support investigation.
A dimension table stores data related to the axis of investigation of a fact.
For example, geography, time, product. A dimension table should be
connected to a central fact table.
You can use the retrieve multidimensional objects feature to highlight the fact
and dimension tables in a physical diagram. The Retrieve Multidimensional
Object feature analyzes the references between the tables in order to deduce
the table type:
Child tables or views become Fact tables or views
Parent tables or views along the path to the child table or view become
Dimension tables or views
The new table type is indicated in the Type dropdown list box in the table
property sheet. A type icon is also displayed in the upper left corner of the
table symbol:
Fact table Dimension table
To retrieve multidimensional objects:
1 Select ToolsMultidimensionRetrieve Multidimensional Objects.
A selection box appears.
2 Select retrieve options in the General page.
3 Select the tables that will be transformed in the Selection page.
Retrieving multidimensional objects
342 PowerDesigner
If you are using Sybase AS IQ (version 12.0)
If your current DBMS is Sybase AS IQ (version 12.0), an additional
check box appears. The option allows you to automatically rebuild
join indexes after retrieving multidimensional objects. For more
information on rebuilding join indexes, see section Rebuilding Join
Indexes in section Support for Sybase Adaptive Server IQ in chapter
DBMS Specific Features.
4 Click OK.
The selected tables are assigned a multidimensional type.
Chapter 6 Working with Physical Data Models
PDM User's Guide 343
Rebuilding cubes
The Rebuild Cubes feature allows you to create cubes and dimensions from
fact and dimension tables and views. Tables and views support
multidimensional types, in this section both are referred to as fact and
dimension tables
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 feature allows the switch to the multidimensional
environment by transforming 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 axis 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 the tables have a multidimensional
type (Fact or Dimension). If the tables have no type, an error message
appears.
You define the type of a table or view using the following methods:
Using the Dimensional Type dropdown listbox from the object property
sheet
For more information on using the table property sheet, see section
Defining tables in chapter Building Physical Diagrams.
Using the retrieve multidimensional objects feature
For more information on retrieving multidimensional objects, see
section Retrieving multidimensional objects.
The rebuild cubes operation creates multidimensional objects in a
multidimensional diagram. If there is no multidimensional diagram in the
model when you start the rebuild cubes, it will be created. Otherwise the
symbols appear in the active multidimensional diagram or the first
multidimensional diagram created in the model.
The rebuild cubes functionality modifies objects according to the following
rule:
Physical object After rebuild cubes, creates
Fact table One fact with the same name as the fact table
+
One Cube
Column in a Fact
table (except foreign
keys)
Measure
Object
transformation
Rebuilding cubes
344 PowerDesigner
Physical object After rebuild cubes, creates
Dimensions tables
attached to the fact
table
One dimension, the name of the dimension corresponds
to the concatenation of the dimension tables along the
path to the child table, from the furthest to the closest
+
One hierarchy that becomes the default hierarchy. This
hierarchy contains the attributes corresponding to the
primary key columns of the tables converted into a
dimension
Column in a
Dimension table
(except foreign keys)
One attribute, the name of the attribute is the
concatenation of the dimension table name and column
name if column names are ambiguous. Otherwise the
name is identical to the name of the column.
References between a
fact and a dimension
table
One cube dimension association
The Cube Rebuild dialog box allows you to select among the following
rebuild modes:
Rebuild mode Impact
Delete and Rebuild All objects previously rebuilt are deleted when you start the
current cube rebuild
Preserve Objects previously rebuilt are preserved during current cube
rebuild
To start the cube rebuild:
1 Select ToolsMultidimensionRebuild Cubes.
Chapter 6 Working with Physical Data Models
PDM User's Guide 345
The Cube Rebuild dialog box appears.
2 Select the rebuild mode in the General page.
3 Select the fact tables that will be transformed in the Selection page.
4 Click OK.
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. You can double-click the diagram node in the
Browser to display the symbols of the multidimensional objects.
Generating extraction scripts
346 PowerDesigner
Generating extraction scripts
The Generate Extraction Script feature allows you to generate script files that
will be used to fill and update tables in a data warehouse or data mart
database.
The link between the operational database and the data warehouse or data
mart database is a relational to relational mapping.
For more information on relational to relational mapping, see section
Defining a relational to relational mapping.
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.
The name of the script is identical to the name of the data source, it is stored
in the directory defined in the Extraction Script Generation dialog box.
You can define the following options in the Generate Extraction Script dialog
box:
Extraction option Description
Title Inserts the database header and the name of the tables
before each select query
Check Model before
generation
Verifies the PDM syntax before generation in order to
output correct SQL script
Chapter 6 Working with Physical Data Models
PDM User's Guide 347
Extraction option Description
Encoding Encoding format to use for generation. You should select
the encoding format that supports the language used in
your model and the database encoding format
Character Case Defines the character case in the generated text file
No Accent When selected, disallows the use of accents
To generate an extraction script:
1 In the Physical Diagram, select DatabaseGenerate Extraction Script.
The Extraction Script Generation dialog box appears.
2 Define a destination directory for the generated file in the Directory box.
3 Select generation options in the Options page.
4 Select the tables which queries you want to generate in the Selection
page.
5 Click OK.
The generated script files are stored in the destination directory you have
defined.
Generating Cube Data
348 PowerDesigner
Generating Cube Data
The cube data generation feature allows the generation of a text file that will
be used by an OLAP tool to create and populate cubes using data from
operational sources.
Defining the query of a cube
Cubes in an OLAP database have to be filled with data from a data
warehouse, data mart or operational database.
You use text files to load data in the cubes of the OLAP database. The text
files contain records and fields. A record is a row of fields that is read as a
unit, and a field is a vertical list of values.
In the multidimensional diagram, each cube is associated with a query. There
is actually one cube per mapping and per data source. The query defined on a
cube is used to extract data from a data warehouse or operational database to
populate the cubes in the OLAP database. The link between the data
warehouse database and the OLAP database is a relational to
multidimensional mapping.
For more information on relational to multidimensional mapping, see
section Defining a relational to multidimensional mapping.
The Generate Cube Data feature allows the generation of a text file
containing the cube data. This text file will then be loaded to populate the
cubes in the OLAP engine.
Chapter 6 Working with Physical Data Models
PDM User's Guide 349
Generating a text file
The Generate Cube Data feature allows you to generate one text file for each
selected cube and each selected data source. The name of the generated file is
a concatenation of the name of the cube and the name of the data source.
Each file contains the following fields:
Field Details
Dimension Lists the attributes of the cube
Member Lists the attribute values
Data fields Contains the values stored in the fact measures
The generated text file must be easily loaded in the OLAP database. You can
customize the format of the generated text files from the Generate Cube Data
dialog box.
Generation
option Description
Header When selected, includes the name of the attribute at the
beginning of the generated text file
Extension Extension of the generated text file, you can choose between
.txt and .csv
Separator Separator used between columns
Delimiter String delimiter
Encoding Encoding format to use for generation. You should select the
encoding format that supports the language used in your model
and the database encoding format
Character Case Defines the character case in the generated text file
No Accent When selected, disallows the use of accents
To generate cube data:
1 In the multidimensional diagram, select ToolsGenerate Cube Data.
Generating Cube Data
350 PowerDesigner
The Generate Cube Data dialog box appears.
2 Define a destination directory for the generated file in the Directory box.
3 Select the generation options in the Options page.
4 Select the cubes and data sources for which you want to generate a file
from the different tabbed pages in the Selection page.
5 Click OK.
The generated files are stored in the destination directory you have
defined.
Chapter 6 Working with Physical Data Models
PDM User's Guide 351
Migrating from version 6 data warehouse
You can import a data warehouse model from version 6 into a PDM in the
current version of PowerDesigner.
Comparing version features
The warehouse features in the current version of PowerDesigner differ from
version 6:
Version 6 Current version
Warehouse model Physical Data Model with data warehouse
extension
Multidimensional hierarchies Multidimensional hierarchies are converted
into simplified hierarchies associated with
cubes in a multidimensional diagram
Extraction script generation Extraction script generation
Cube generation Cube data generation
OLAP interface
Partitioning and aggregation
wizard

Converting objects from version 6


When you import a data warehouse model with external sources from
PowerDesigner version 6, the links to external sources are preserved: each
external database is converted into a new PDM in the current workspace.
This new PDM is automatically declared as a data source for the imported
model. Tables and columns in the imported model are automatically mapped
to tables and columns in the data source model.
Migrating from version 6 data warehouse
352 PowerDesigner
The modeling elements and their relationships are slightly different between
previous and current version of PowerDesigner. When you open a version 6
data warehouse model into the current version of PowerDesigner, the
following object translations are performed:
Object in
version 6
Object in current
version Details
Fact table without
fact hierarchy
Fact A fact is created for each fact table
Fact table with fact
hierarchy
Fact and cube A fact and a cube are created for
each fact table having a fact
hierarchy. The fact is automatically
associated with the cube
Dimension table Dimension Each dimension table directly
attached to a fact is converted into a
new dimension containing all the
attributes of the dimension
Attribute Attribute attribute
Metric Measure A measure is created for each metric
in the origin model
Dimension
hierarchy
Dimension Hierarchies are created in the
dimension based on the
multidimensional hierarchy
Each dimension hierarchy is converted into a single dimension.
The dimensions inside the dimension hierarchy are merged into a new
dimension. The attributes of these child dimensions become attributes of the
new dimension, and, if necessary, their names are prefixed by the name of the
new parent dimension.
The conversion process also creates a new hierarchy with the same attributes
as the child dimensions copied into the new dimension.
Version 6 Current version
Hierarchies and
dimensions
Chapter 6 Working with Physical Data Models
PDM User's Guide 353
In the dimension hierarchy, an association is created for each dimension and
each dimension hierarchy linked to a fact.
Version 6 Current version
Converting external sources
When you open a version 6 data warehouse model into the current version of
PowerDesigner, the links to external sources are preserved thanks to a
mapping mechanism.
For more information on object mapping, see section Mapping objects
in a PDM.
Version 6 Current version Details
External database Physical Data Model
opened in the current
workspace
Each external database
becomes a new PDM with
the same name and the same
DBMS family. A message
appears if the DBMS cannot
be found
External table Table in the new Physical
Data Model opened in the
current workspace
The external tables in the
external database become
regular tables in the new
PDM. A shortcut is created
for each external table in the
imported model to illustrate
the mapping
External column Column in the tables of
the new Physical Data
Model opened in the
current workspace
The external columns
become columns in the
tables of the new PDM
Associations
Migrating from version 6 data warehouse
354 PowerDesigner
The concept of external database in PowerDesigner version 6 becomes a
data source: when you import a data warehouse model with one or several
external databases, the model is imported and the external databases are
converted into physical models. These models are automatically declared as
data sources of the imported model, and the tables of the model are mapped
with tables in the data source. Shortcuts of the mapped tables appear in the
imported model diagram.
For more information on data sources, see section Defining data sources
in a PDM.
Chapter 6 Working with Physical Data Models
PDM User's Guide 355
Using PowerBuilder extended attributes
When designing tables to be used in a PowerBuilder DataWindow,
PowerDesigner lets you manage the extended attributes which PowerBuilder
uses to store application-based information such as label and heading text for
columns, validation rules, display formats, and edit styles.
Importing the PowerBuilder extended model definition
In order to use the PowerBuilder extended attributes, you must first import
the PowerBuilder extended model definition into the current physical data
model. You can then view and modify the extended attribute values through
the extended attributes page in a table or column property sheet.
For more information on extended model definitions, see chapter
Extended Model Definitions Reference Guide in the Advanced User
Documentation.
PowerDesigner supports two PowerBuilder system tables: PBCatTbl for
tables and PBCatCol for columns. Note that for both tables, PowerDesigner
does not support all columns. You can view the supported columns by
displaying the extended attributes page of a table or a column in a model
where you have attached the PowerBuilder extended model definition.
Supported system
tables
Using PowerBuilder extended attributes
356 PowerDesigner
The list of extended attributes corresponds to the supported columns in tables
PBCatTbl and PBCatCol.
To import the PowerBuilder extended model definition:
1 Create a new PDM.
2 Select ModelExtended Model Definition to display the List of
Extended Model Definitions.
3 Click the Import an Extended Model Definition tool.
The Extended Model Definition Selection dialog box appears.
4 Select PowerBuilder.
or
Click the Path tool to browse to the extended model definitions
directory.
5 Select the Share or Copy radio button.
6 Click OK
The extended model definition appears in the list.
7 Double-click the PowerBuilder extended model definition to display its
properties in the resource editor.
Chapter 6 Working with Physical Data Models
PDM User's Guide 357
You can expand the Extended Attributes sub-category in the different
metaclass categories under Profile to display the extended attributes.
Importing models with PowerBuilder extended attributes from a
previous version
When importing a previous version model containing PowerBuilder extended
attributes, PowerDesigner detects these extended attributes and automatically
attaches the PowerBuilder extended model definition to the model.
The PowerBuilder extended model definition contains only the PowerBuilder
extended attributes supported in the current version of PowerDesigner. If the
imported model contains PowerBuilder extended attributes other than those
in the PowerBuilder extended model definition, they are lost when the model
is imported.
The values of PowerBuilder extended attributes are imported with the model.
You can also import the extended attributes contained in a .EXA file.
For more information on how to import .EXA files, see section
Importing the extended attributes from a .EXA file in chapter Extended
Model Definitions Reference Guide in the Advanced User Documentation.
Using PowerBuilder extended attributes
358 PowerDesigner
To import a model with PowerBuilder extended attributes from a
previous version:
1 Open a model saved with a previous version of PowerDesigner.
2 Select ModelExtended Model Definitions.
The list displays the PowerBuilder extended model definition.
Modifying the value of a PowerBuilder extended attribute
You can use the PowerDesigner interface to modify the values of
PowerBuilder extended attributes.
To modify the value of a PowerBuilder extended attribute:
1 Display a table or column property sheet.
2 Click the Extended Attributes tab.
Chapter 6 Working with Physical Data Models
PDM User's Guide 359
3 Select an extended attribute in the list and modify its value in the Value
column using the down arrow or the Ellipsis button.
4 Click OK.
Generating PowerBuilder extended attributes
You can update the PowerBuilder extended attribute system tables by
performing a PowerBuilder extended attribute generation.
During generation, certain extended attributes may contain variables in their
values, which are translated during generation, for example to access object
properties. The following object properties are translated during generation:
Object Property
Table Comment
Column Comment
Label
Header
Initial value
This automated process uses the PowerDesigner generation template
language (GTL).
Using PowerBuilder extended attributes
360 PowerDesigner
For more information on the PowerDesigner template language, see
chapter Generation Reference Guide in Advanced User Documentation.
To generate PowerBuilder extended attributes:
1 Select ToolsPowerBuilderGenerate Extended Attributes.
The PowerBuilder Extended Attributes Generation dialog box appears.
2 Click the Connect to an ODBC Data Source tool.
The Connect to an ODBC Data Source dialog box appears.
3 Select a machine or file data source and click Connect.
The selected data source appears in the ODBC Data Source box in the
upper part of the PowerBuilder Extended Attributes Generation dialog
box.
4 Select the tables you want to generate.
5 Click OK to start generation.
The Output window displays the generation messages.
Reverse engineering PowerBuilder extended attributes
The reverse engineering feature reads the PowerBuilder extended attributes
contained in a database and writes them into the appropriate tables and
columns in a PDM.
During reverse engineering, certain reversed extended attributes are
compared with the translated default values in the PowerBuilder extended
model definition. It these attributes match, the reversed value is replaced by
the default value from the extended model definition.
For more information on objects translated during reverse engineering,
see section Generating PowerBuilder extended attributes.
This automated process uses the PowerDesigner generation template
language (GTL).
For more information on the PowerDesigner template language, see
chapter Generation Reference Guide in Advanced User Documentation.
To reverse engineer PowerBuilder extended attributes:
1 Select ToolsPowerBuilderReverse Extended Attributes.
Chapter 6 Working with Physical Data Models
PDM User's Guide 361
The PowerBuilder Extended Attributes Reverse Engineering dialog box
appears.
2 Click the Connect to an ODBC Data Source tool.
The Connect to an ODBC Data Source dialog box appears.
3 Select a machine or file data source and click Connect.
The selected data source appears in the ODBC Data Source box in the
upper part of the PowerBuilder Extended Attributes Reverse Engineering
dialog box.
4 Select the tables you want to reverse engineer.
5 Click OK to start reverse engineering.
The Output window displays the reverse engineering messages.
Importing an ERwin model into a PDM
362 PowerDesigner
Importing an ERwin model into a PDM
You can easily import a model built with ERwin into a PDM with no loss of
metadata. PowerDesigner allows complete flexibility through reliable
conversion between conceptual, physical and object-oriented model
approaches, providing outstanding model clarity and flexibility. Migrating
from ERwin offers the following advantages:
The separate logical and physical database designs make it possible to
use a single logical model for multiple physical implementations
Our powerful object-oriented model approach is not available in ERwin
The import process translates ERwin objects into PDM objects as follows:
Object in an ERwin model Imported object in a PDM
Model Model
Stored display and subject area Diagram
Business rule Business rule
Domain Domain
Column Column
Key Key
Table Table
Relationship Reference
Index Index
View table View
Fact, dimension, outrigger Table
Target database Current DBMS
Valid value Check parameter
Tablespace Tablespace
Segment Storage
Symbols (including size and position) Symbols (including size and position)
Description Description
Notes Annotation
Text block Text symbol
Object translation
Chapter 6 Working with Physical Data Models
PDM User's Guide 363
Object in an ERwin model Imported object in a PDM
User-defined properties Imported as extended attributes stored
into a specific extended model
definition embedded in the model. The
name of this extended model definition
is Imported Attributes, you can manage
it from the resource editor
For more information on extended model definitions, see chapter
Extended Model Definitions Reference Guide in the Advanced User
Documentation.
The import process preserves object notation:
ERwin notation PowerDesigner equivalent
IE & DM Relational
IDEF1X IDEF1X
You cannot import ERwin triggers and stored procedures, ERwin reports, or
ER1 files. It is also impossible to import ERwin data sources and target
clients.
Migrating from ERwin
Migration from ERwin is both simple and reliable. PowerDesigner supports
the new ERwin XML format output file.
The migration procedure depends on the version of the ERwin file:
ERwin version Import options
ERwin 3.x You can choose between CDM, PDM, and synchronized
CDM and PDM
ERwin 4.x If the model is conceptual, it is imported as a CDM
If the model is physical, it is imported as a PDM
If the model is both conceptual and physical, you can choose
to import it as a CDM, a PDM or synchronized CDM and
PDM
Importing a physical ERwin file (4.x)
PowerDesigner detects the type of the ERwin file and automatically starts its
migration to a PDM.
Notation
Limitations
Importing an ERwin model into a PDM
364 PowerDesigner
To import a physical ERwin model:
1 Select FileImportERwin File to display a standard Open dialog box.
2 Select or browse to the directory that contains the ERwin physical file.
3 Select a file.
4 Click Open.
A progress box shows the progress rate of the import process. At the end
of the import process, the physical model appears in the Browser.
Importing an ERwin mixed model into a CDM/PDM pair
You can import an ERwin mixed model into a synchronized CDM/PDM pair
this feature does not apply to ERwin physical models. The following steps
are automatically performed during import: import ERwin model as CDM1,
import ERwin model as PDM1, generate CDM1 into PDM2 and merge
PDM1 and PDM2.
To import an ERwin mixed model into a CDM/PDM pair:
1 Select FileImportERwin File to display a standard Open dialog box.
2 Select or browse to the directory that contains the ERwin file.
3 Select a file.
4 Click Open.
A format selection dialog box appears.
5 Select PowerDesigner Synchronized CDM/PDM pair and click OK.
A progress box shows the progress rate of the import process. At the end
of the import process, the conceptual and the physical models appear in
the Browser.
PDM User's Guide 365
C H A P T E R 7
Reverse Engineering in a PDM
This chapter describes how you can reverse engineer database objects into a
PDM.
Topic Page
Reverse engineering a database schema 366
About this chapter
Contents
Reverse engineering a database schema
366 PowerDesigner
Reverse engineering a database schema
Reverse engineering is the process of generating a PDM, or specific PDM
objects, from an existing database schema.
There are two ways to generate a PDM from a database schema:
Generate using Description
Script file You reverse engineer SQL scripts which contain creation
statements. This is normally the script used to generate the
database but can also include other scripts
ODBC data source You reverse engineer the schema for an existing database,
specifying an ODBC data source, and connection
information. When reverse engineering an ODBC data
source, you can select to reverse using administrator
permissions in order to be able to select in the system tables
that are reserved to a database admin
PowerDesigner allows you to reverse engineer one or more script files.
The procedure to reverse engineer one script file is very straightforward.
However, when you reverse engineer several script files, make sure that the
order among script files respects dependencies among objects. For example,
trigger creation script before table creation script; or grant permission script
before table and user creation script.
Set options appropriately
When you reverse engineer a database, make sure that you set the rebuild
options appropriately. Click the Options tab and select or clear the
checkboxes to rebuild references and/or primary keys according to your
needs. By default, no rebuild options are selected.
You can reverse engineer an existing database schema into a new PDM or
into an existing PDM.
Defining reverse engineering options
When you reverse engineer a database schema using script files or an ODBC
data source, you can define rebuild options after reverse engineering.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 367
The rebuild options automatically perform the following tasks after reverse
engineering:
Reverse options Description
Automatically rebuild
references when no
reference is reversed
Rebuilds references when no references are reverse
engineered. The rebuild references feature starts by
detecting columns with identical name and data type
in different tables. A reference is created between
each column belonging to a primary key and a
column, with identical name and data type, that does
not belong to a primary or a foreign key in another
table
Automatically rebuild
primary keys from
unique indexes when
tables have no key and
only one unique index
Rebuilds primary keys using unique indexes when
tables have no key and only one unique index
Automatically reverse
parent tables for
references of selected
tables
Reverse engineers the parents of the selected child
tables in order to complement the definition of these
child tables
Retrieve number of rows
in tables
Used to recover the number of records in the physical
database tables and display it in the Number box in
the property sheet of tables
Create symbols Creates a symbol for each reversed object in the
diagram. Otherwise, reversed objects are visible only
in the browser
Script terminator block Declares the end of block character for the reversed
script. By default, the box displays the value defined
in the DBMS, under Script\SQL\Syntax. You can
modify this value, in this case the value is saved in
the Registry and reused in another model. You can
also restore the DBMS value using the Restore from
DBMS tool
Script terminator
command
Declares the end of command character for the
reversed script. By default, the box displays the value
defined in the DBMS, under Script\SQL\Syntax. You
can modify this value, in this case the value is saved
in the Registry and reused in another model. You can
also restore the DBMS value using the Restore from
DBMS tool
Case sensitive database Declares the reverse engineered database as case
sensitive and enables the case sensitive option in the
resulting model
Reverse engineering a database schema
368 PowerDesigner
For more information on indexes, rebuilding references and rebuilding
primary keys, see chapter Building Physical Diagrams.
If you select the Create Symbols reverse option, the layout of the symbols in
the diagram is automatically arranged. In case of a reverse engineering with a
large number of objects with complex interactions, the auto-layout feature is
likely to create synonyms of objects to improve the diagram readability. For
example, if a table has a large number of references, the auto-layout feature
will create a synonym of this table in another location of the diagram in order
to improve the diagram presentation.
Reverse engineering shortcuts
External shortcuts depend on their corresponding target objects located in
different models. When you need several models to design a single database,
you can use shortcuts to share objects between models.
During reverse engineering, PowerDesigner allows you to create external
shortcuts from target objects in target models. In the Database Reverse
Engineering dialog box, the Target Models page displays the list of detected
target models containing target objects for shortcuts in the current model to
reverse.
This page is always visible in the Database Reverse Engineering dialog box,
even if the model does not contain shortcuts.
This page is empty when you reverse engineer into a new model. This is to let
you add target models and create shortcuts instead of duplicating objects.
Symbol creation
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 369
You can use the Target Models page in the Database Reverse Engineering
dialog box to manage target models using the following tools:
Tool Tooltip Description
Change Target
Model
Displays a standard Open dialog box to let you select
another file as target model
Open Model Opens selected target model in current workspace
Add Models Opens a selection list with the models opened in the
current workspace. This tool is particularly useful
when you reverse engineer into a new model where
the target models are not defined
Delete Deletes the target model and the shortcuts in the
current model that reference the deleted target model
When you try to reverse engineer a model, the target models should be
opened in order to create external shortcuts from target objects. If not, the
following confirmation dialog box appears to let you open the target models:
All the create statements in the script create objects, provided the 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.
When you reverse engineer by ODBC, external shortcuts are created for all
selected objects already existing in another target model. These existing
objects are deselected by default in the Selection page of the Reverse
Engineering dialog box, except the target objects corresponding to shortcuts
already existing in the reversed model.
Generating a PDM from a database
When you reverse engineer a database schema using script files or an ODBC
data source, you can choose to generate a PDM for all objects, or selected
objects, in the database.
Reverse
engineering by
script
Reverse
engineering by
ODBC
Reverse engineering a database schema
370 PowerDesigner
The object types that you can reverse engineer are DBMS-dependent.
Unavailable object types do not appear for selection.
When you select tables containing triggers from the Table page of the ODBC
reverse engineering dialog box, you must be aware that the corresponding
triggers are automatically selected in the Trigger page.
Only users that have creation rights are reverse engineered.
You can reverse engineer user-defined and abstract data types. In the
generated PDM, the names of these data types appear in the List of Abstract
Data Types.
You can reverse engineer either into a new or an existing PDM. Reverse
engineering into an existing PDM involves a merging of both sources into an
updated PDM.
Filters and options for reverse engineering
You can use filters to restrict the number of objects to reverse engineer.
Certain object types have attributes, or options, that you can select to be
included in the generated PDM.
Tables with triggers
Users
User-defined and
abstract data types
Reverse
engineering
choices
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 371
You can restrict database objects to reverse engineer by selecting an owner or
a database qualifier. You can use the Select qualifier and owner tool to
display a selection dialog box.
The following filters are available:
Filter Description
Qualifier A qualifier is a database, or a partition in a database, that contains
one or more tables. When a qualifier is selected as a filter, it restricts
the objects available for reverse engineering to the objects contained
within the selected qualifier. For example, the DB2 DBMS
authorizes the use of the qualifier field to select which databases are
to be reverse engineered from a list
Owner Normally the creator of a database object is its owner. When an
owner is selected as a filter; it restricts the objects available for
reverse engineering to the objects owned by the selected owner. Be
careful, if the selected qualifier contains a large number of table
owners, the opening of the Owner dropdown listbox may take a very
long time; in this case, it is highly recommended to use the Select
Qualifier and Owner dialog box to type an owner name directly
Selecting objects from multiple owners
To reverse engineer objects from multiple owners, you can select All
users as a filter from the owner dropdown listbox. All the objects
belonging to all owners appear in the list, and you can select the objects
for reverse engineering regardless of their owner.
Reverse engineering options depend on object type and the selected DBMS.
To display, or modify, the reverse engineering options for an object type,
click the appropriate page tab in the ODBC Reverse engineering dialog box.
Unavailable options appear grayed.
Optimizing ODBC reverse engineering queries
ODBC reverse engineering has been optimized in order to improve
performance. All ODBC queries run according to an optimization process
rule. This process uses the following registry keys:
RevOdbcMinCount defines a number of selected objects for reverse
engineering. The default number is 100
RevOdbcMinPerct defines a percentage of selected objects for reverse
engineering. The default percentage is 10
Filters
Reverse options
Reverse engineering a database schema
372 PowerDesigner
These keys do not exist by default, you have to create and edit them in the
Registry under:
Current User \Software\Sybase\PowerDesigner 11\FolderOptions\Physical
Objects
During reverse engineering, PowerDesigner compares the total number of
current objects for reverse engineering to the value of RevOdbcMinCount.
If the total number of listed items is lower than the value of
RevOdbcMinCount A global reverse query is executed.
If the total number of listed items is higher than the value of
RevOdbcMinCount The process uses key RevOdbcMinPerct.
If the percentage of reversed items is lower than the percentage defined
in RevOdbcMinPerct, then a global query is executed
If the percentage of reversed items is higher than the percentage defined
in RevOdbcMinPerct, then the same query is executed for each object
Reverse engineering into a new PDM
You can reverse engineer existing databases into a new PDM. The data
source can be either from script files or an ODBC data source.
Reverse engineering database objects from script files into a new PDM
When you reverse engineer using scripts, you can use a single or several
script files. You can use the following tools in the Database Reverse
Engineering dialog box:
Tool Tooltip Description
Add Files Allows you to select files
Move Up Allows you to move a file or multi-selected files up one
row. You can select more than one file at a time. This
tool is grayed if the selected file or files are at the top of
the list or if there is only one file in the list
Move Down Allows you to move a file or multi-selected files down
one row. You can select more than one file at a time.
This tool is grayed if the selected file or files are at the
bottom of the list or if there is only one file in the list
Clear All Deletes all files from the list
For more information on other tools, see the General Features Guide.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 373
Caution
The reverse engineering process handles files sequentially, which means
that trigger scripts must always be executed after table scripts. Use the
Move tools to position the files correctly in the list. If you fail to do this,
triggers will not be reverse engineered into the PDM.
For example, to add a table script and a trigger script after an existing script
file: select the Add Files tool; then select or browse the appropriate directory
to find the table script file and click Open; finally, select or browse the
appropriate directory to find the trigger script file and Click Open. Both files
appear sequentially in the list, after the existing file.
To reverse engineer database objects from script files:
1 Select FileReverse EngineerDatabase to display the New Physical
Data Model dialog box.
2 Click the Share radio button.
3 Select a DBMS in the dropdown listbox.
4 Click OK.
The Database Reverse Engineering dialog box appears.
5 Click the Using a script file radio button.
Reverse engineering a database schema
374 PowerDesigner
6 If a script file that you want appears in the list, you can keep it and select
more files.
If you do not want the script file, click the Delete File tool.
7 Select or browse the appropriate directory to find more script files.
Always place trigger script files after table script files
This is the only constraint for ordering your files in the list, but it is
essential for a successful reverse engineering of triggers.
8 Select reverse engineering options in the Options page.
9 Click OK.
A message in the Output window indicates that the specified files have
been fully reverse engineered. The new PDM appears in the workspace.
Reverse engineering from an ODBC data source into a new PDM
The following procedure explains how to:
Connect to an ODBC data source
Select or add a user ID to display only the user objects
Select or clear objects to reverse engineer
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 375
To reverse engineer database objects from an ODBC data source
into a new PDM:
1 Select FileReverse EngineerDatabase to display the New Physical
Data Model dialog box.
2 Click the Share radio button.
3 Select a DBMS in the dropdown listbox.
4 Click OK.
The Database Reverse Engineering dialog box appears.
5 Click the Using an ODBC data source radio button.
Reverse engineering a database schema
376 PowerDesigner
ODBC data source
An ODBC data source (previously used) might be predefined, or you
can type the name of an existing ODBC data source. In both cases,
when you click OK, a database connection dialog box appears, if you
need to specify additional connection parameters. Click Connect and
the ODBC Reverse Engineering dialog box appears. (Go to step 12)
6 Click the Connect to an ODBC Data Source tool to display the
Connect to an ODBC Data Source dialog box.
7 Click the Machine data source radio button and select a data source from
the dropdown listbox.
or
Click the File data source radio button, then the Select a File DSN tool
to select a .DSN file from an appropriate directory.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 377
8 Type a user ID and a password.
9 Click Connect.
The selected ODBC data source appears in the Database Reverse
Engineering dialog box.
10 Check the Reverse using administrators permissions check box, if
you want to select tables reserved to the database administrator.
Reverse engineering a database schema
378 PowerDesigner
11 Select reverse engineering options in the Options page.
12 Click OK.
The ODBC Reverse Engineering dialog box appears with the user
objects. Only tables and triggers are selected by default.
13 <optional> In the upper part of the dialog box, select a qualifier in the
Filter on object qualifier dropdown listbox.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 379
14 <optional> You can select another user ID in the Filter on object owner
dropdown listbox.
or
Click the Select Qualifier and Owner tool, to display the Qualifier and
Owner Selection dialog box.
Type a user ID and click OK. If the user ID is unknown, an error
message appears.
Click OK to the error message, type a new user ID and click OK in the
Qualifier and Owner Selection dialog box. The ODBC Reverse
Engineering dialog box appears with the new user objects.
15 Click the object type tabs and select or clear check boxes for objects you
want to reverse engineer or not.
In the lower part of the dialog box, select or clear option check boxes
specific to each object type.
Selecting or clearing all object check boxes
You can select or clear all object check boxes for an object type by
clicking the Select All or Deselect All tools.
16 Click OK.
A message in the Output window indicates that the database has been
fully reverse engineered. The new PDM appears in the workspace.
Reverse engineering into an existing PDM
You can also reverse engineer into an existing PDM. This type of reverse
engineering relies on the DBMS definition of the current DBMS.
Reverse engineering a database schema
380 PowerDesigner
The data source can be either script files or an ODBC data source. When you
reverse engineer using scripts, you can use a single or several script files.
When you reverse engineer into an existing PDM, a model merge window
appears after the reverse engineering process is complete. You can then use
the model merge function to integrate the current and newly reversed objects
into a model.
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
The procedures for reverse engineering objects into an existing PDM vary
slightly depending on whether you want to reverse engineer a single file or
several files.
Reverse engineering objects from a single script file into an existing PDM
The following procedure assumes you have a PDM open in the workspace.
To reverse engineer objects from a single script file:
1 Select DatabaseReverse Engineer Database to display the Database
Reverse Engineering dialog box.
2 Click the Using script files radio button.
3 Select or browse the appropriate directory to find the script file. You can
use the Add files and Clear All tools.
4 Select reverse engineering options in the Options page.
Merging two PDM
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 381
5 Click OK.
A message in the Output window indicates that the specified file has
been fully reverse engineered and the Merge Models window appears.
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
Reverse engineering objects from several script files into an existing PDM
You can use tools in the Database Reverse Engineering dialog box to select
and arrange files.
For more information on tools available in the Database Reverse
Engineering dialog box, see Reverse engineering into a new PDM.
Caution
The reverse engineering process handles files sequentially, which means
that trigger scripts must always be executed after table scripts. Use the
Move tools to position the files correctly in the list. If you fail to do this,
triggers will not be reverse engineered into the PDM.
For example, to add a table script and a trigger script after an existing script
file: select the Add Files tool; then select or browse the appropriate directory
to find the table script file and click Open; finally, select or browse the
appropriate directory to find the trigger script file and Click Open. Both files
appear sequentially in the list, after the existing file.
The following procedure assumes you have a PDM open in the workspace.
To reverse engineer objects from several script files:
1 Select DatabaseReverse Engineer Database to display the Database
Reverse Engineering dialog box.
2 Click the Using script files radio button.
Reverse engineering a database schema
382 PowerDesigner
3 If a script file that you want appears in the list, you can keep it and select
more files.
If you do not want the script file, click the Delete File tool.
4 Select or browse the appropriate directory to find more script files.
Always place trigger script files after table script files
This is the only constraint for ordering your files in the list, but it is
essential for a successful reverse engineering of triggers.
5 Select reverse engineering options in the Options page.
6 Click OK.
A message in the Output window indicates that the specified files have
been fully reverse engineered and the Merge Models window appears.
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
Reverse engineering from an ODBC data source into an existing PDM
The following procedure explains how to:
Connect to an ODBC data source
Select or add a user ID to display only the user objects
Select or clear objects to reverse engineer
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 383
A PDM must be open in the workspace.
To reverse engineer database objects from an ODBC data source
into an existing PDM:
1 Select DatabaseReverse Engineer Database to display the Database
Reverse Engineering dialog box.
2 Click the Using an ODBC data source radio button.
ODBC data source
An ODBC data source (previously used) might be predefined, or you
can type the name of an existing ODBC data source. In both cases,
when you click OK, a database connection dialog box appears, if you
need to specify additional connection parameters. Click Connect and
the ODBC Reverse Engineering dialog box appears. (Go to step 9)
Reverse engineering a database schema
384 PowerDesigner
3 Click the Connect to an ODBC Data Source tool to display the
Connect to an ODBC Data Source dialog box.
4 Click the Machine data source radio button and select a data source from
the dropdown listbox.
or
Click the File data source radio button, then the Select a File DSN tool
to select a .DSN file from an appropriate directory.
5 Type a user ID and a password.
6 Click Connect.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 385
The selected ODBC data source appears in the Database Reverse
Engineering dialog box.
7 Check the Reverse using administrators permissions check box, if
you want to select tables reserved to the database administrator.
8 Select reverse engineering options in the Options page.
9 Click OK.
Reverse engineering a database schema
386 PowerDesigner
The ODBC Reverse Engineering dialog box appears with the user
objects. Only tables and triggers are selected by default.
10 <optional> In the upper part of the dialog box, select a qualifier in the
Filter on object qualifier dropdown listbox. The default value is All
qualifiers.
11 <optional> You can select another user ID in the Filter on object owner
dropdown listbox.
or
Click the Select Qualifier and Owner tool, to display the Qualifier and
Owner Selection dialog box.
Type a user ID and click OK. If the user ID is unknown, an error
message appears.
Chapter 7 Reverse Engineering in a PDM
PDM User's Guide 387
Click OK to the error message, type a new user ID and click OK in the
Qualifier and Owner Selection dialog box. The ODBC Reverse
Engineering dialog box appears with the new user objects.
12 Click the object type tabs and select or clear check boxes for objects you
want to reverse engineer or not.
In the lower part of the dialog box, select or clear option check boxes
specific to each object type.
Selecting or clearing all object check boxes
You can select or clear all object check boxes for an object type by
clicking the Select All or Deselect All tools.
13 Click OK.
A message in the Output window indicates that the database has been
fully reverse engineered and the Merge Models window appears.
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
Reverse engineering a Microsoft Access 97 database
PowerDesigner and MS Access 97 use .DAT files to exchange information.
These files are reversed into the PDM. The access.mdb database uses or
creates .DAT files to reverse Access databases.
You can define the database reverse parameters from the access.mdb
database window.
To reverse an MS Access database into a PowerDesigner PDM:
1 Double-click ACCESS.MDB in the PowerDesigner \tools directory.
2 Select Reverse Engineer Access Database File to PowerDesigner Script.
3 Type the Access database name in the Select Database box.
4 Type the .DAT file to create in the PowerDesigner File.
5 Click the Create button.
6 Select DBMSReverse Engineering Databases in PowerDesigner.
7 Select the newly generated script file to reverse.
8 Click OK.
Reverse engineering a database schema
388 PowerDesigner
PDM User's Guide 389
C H A P T E R 8
Triggers and Procedures
This chapter presents triggers and procedures used to generate database
constraints.
Topic Page
Trigger overview 390
Using triggers 393
Using trigger templates 409
Using template items 428
Defining stored procedures and functions 443
Using macros 451
Using the SQL/XML Wizard 462
Generating triggers and procedures 469
About this chapter
Contents
Trigger overview
390 PowerDesigner
Trigger overview
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.
If you want to include Chicago toaster sales in a national database, you can
not limit the action to enter Chicago sales.
You first need to locate the area of the database containing states, then cities
in the targeted state, then the toaster product area. Once the correct location
is found and the data entered, you need to update the database with a new
total sales figure for the city of Chicago, the state of Illinois, and national
sales. If something goes wrong, such as not finding the city of Chicago in
Illinois, you need to create the city before attempting to include Chicago
sales.
A trigger can be seen as the set of actions and checks required by the enter
Chicago sales command to carry out the operation correctly and completely.
Referential integrity
You can use triggers to enforce referential integrity, where declarative
constraints are not sufficient.
You can also use triggers to implement sequences for columns.
Triggers and stored procedure store procedural SQL statements in the
database for use by all applications. They enhance the security, efficiency,
and standardization of databases.
How to design triggers
Triggers are defined to be used in tables. There are two ways to create a
trigger for a table:
Trigger created Description
Automatically The Rebuild Triggers function creates triggers for one or
more selected tables based on trigger templates defined in
the current model and current DBMS. Triggers are built
for: tables that have Trigger referential integrity defined for
one or more references linking the table with a parent or
child table, and for tables containing columns linked to a
sequence
What is a trigger?
Example
Triggers and
stored procedures
Creating triggers
Chapter 8 Triggers and Procedures
PDM User's Guide 391
Trigger created Description
Manually Trigger is defined manually for a specific table or view.
You can base the trigger on an existing trigger template, or
type the definition independently of a template
For more information on creating triggers automatically, see section
Creating triggers automatically.
For more information on creating triggers manually, see section
Creating a trigger manually.
A trigger template is a pre-defined form for creating triggers. 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
trigger template can be stored in the model, or in the current DBMS.
A template item is a reusable block of SQL script that can implement
referential integrity, or do any other work on database tables. 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.
A template item can be stored in the current model, or in the current DBMS.
PowerDesigner ships pre-defined template items for each supported DBMS.
The type of pre-defined template items available depends on the current
DBMS.
The availability of a trigger template, or template item, to models other than
the current model, depends on where the template is stored:
Template stored in Available to
Model Current model only
DBMS connected as Shared All models using the DBMS (.XDB file)
DBMS connected as Copy Current model only
For more information on the DBMS connections, see chapter Database
Creation and Modification.
The Rebuild Triggers function creates new triggers based on template items
that correspond to trigger referential integrity defined for references and
sequence implementation for columns.
The Rebuild Triggers function does not use pre-defined template items which
are not applicable to trigger referential integrity or sequence implementation.
Trigger templates
Template items
Availability of
trigger templates
and template items
Overview of the
Rebuild Triggers
process
Trigger overview
392 PowerDesigner
An overview of the Rebuild Triggers process is shown below:
Chapter 8 Triggers and Procedures
PDM User's Guide 393
Using triggers
Triggers are flexible tools for table management and modification. They can
contain variables and, depending of your DBMS, several triggers of the same
type can be defined.
For an overview of how to design triggers, see section How to design
triggers.
Trigger properties
Each trigger definition includes the following properties:
Property Description
Name Name of the trigger
Code Reference code of the trigger template
Comment Descriptive label for the trigger
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of trigger owner. You choose an owner from a list of
users. A trigger can only have one owner at a time. This is
normally the trigger creator
Table Table attached to trigger
Generate Indicates to generate trigger
User-defined (Read-only) Indicates that the trigger definition is modified
by user. You modify a trigger definition when you change
the trigger template script in the Definition page of the
trigger
A trigger definition also includes the following properties, each with their
respective page:
Property Description
Definition Definition of trigger
Template Items Template items available for current DBMS
Preview Previews of trigger definition code
Using triggers
394 PowerDesigner
The Definition page of the trigger property sheet also includes the following
trigger properties:
Property Description
Template Template on which the trigger is based
User-defined This button is automatically depressed when you modify the
definition of a trigger, that is to say the trigger template code.
You can click the User-Defined button to restore the trigger
definition as it is provided in the template
Time Time attribute of the template. The content of the dropdown
listbox depends on the DBMS
Event Event attribute of the template. The content of the dropdown
listbox depends on the DBMS
Order Firing order of trigger
Time and event attributes are no longer concatenated in a single type. You
can customize the trigger time and event, and you can also handle multiple
events on a single trigger.
The time and event dropdown listboxes are filled with the values defined in
the trigger template and the values defined in the Time and Event entries in
the Trigger category of the DBMS editor. For example, if you define Select
as an event in the DBMS definition file, it will appear in the list of events.
For more information on the DBMS definition file, see DBMS
Reference Guide in the Advanced User Documentation.
For more information on triggers with multiple event, see section
Defining triggers with multiple events.
Defining triggers with multiple events
Some DBMS support multiple events on triggers. If such is the case, the
EventDelimiter entry in the Trigger category of the DBMS definition file has
a value and the Ellipsis button beside the Event box in the trigger definition
page is available. If you click the Ellipsis button, the Multiple Events
Selection box appears. You can select several events and click OK, the
different events appear in the Event box, with the selected delimiter.
Time and event
Chapter 8 Triggers and Procedures
PDM User's Guide 395
Using variables in triggers
You can use variables in triggers, trigger templates, and template items. At
trigger generation, these variables are replaced by values for a specific model
or table.
For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
You can also use formatting variables that have a syntax that can force a
format on their values, as follows:
Force values to lower-case or upper-case characters
Truncate the length of values
For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
Creating triggers automatically
You can create triggers automatically for one or more tables in a model. The
triggers are created for references that have Trigger defined for referential
integrity implementation and for columns which values depend on a
sequence.
The Rebuild Triggers function automatically creates triggers for one or more
selected tables. The triggers based on a trigger template that have been
modified and become user-defined are not created by the Rebuild Triggers
function.
All other triggers created by Rebuild Triggers are built from trigger templates
defined in the DBMS and user-defined trigger templates defined in the
model. INSERT triggers are created for all selected tables. UPDATE and
DELETE triggers are created according to the trigger referential integrity
defined for the reference linking the table with a parent or child table.
Formatting
variables
Rebuild triggers
Using triggers
396 PowerDesigner
Triggers are rebuilt when a change in DBMS family is made
If you change the target DBMS family, for example from Sybase to Oracle
or IBM DB2, triggers are automatically rebuilt.
You can select one of two modes to create triggers:
Delete and Rebuild, which deletes triggers (except user-defined triggers)
and then rebuilds triggers based on referential integrity options and
sequence implementation for columns
Preserve, which preserves existing user-defined triggers and rebuilds and
creates other triggers based on referential integrity options and sequence
implementation for columns
For example, in a table containing an existing trigger, you create three new
triggers, using three different ways of defining triggers. The following table
summarizes what happens with these triggers when they are rebuilt with
either the Delete trigger or Preserve trigger options:
Trigger type Effect of Delete/Rebuild Effect of Preserve
User-defined Rebuilt, no modifications Preserved
Using user-defined
template
Rebuilt, no modifications Preserved
Using PD template Deleted Rebuilt
Existing trigger Deleted Rebuilt
Note that user-defined triggers are never deleted by a rebuild.
When a trigger based on a trigger template is modified, it becomes user-
defined. The Rebuild Triggers function does not create a trigger
corresponding to a trigger template attached to a user-defined trigger.
If you wish to recreate a trigger based on the same trigger template you can:
Click the User-defined button in the Definition page of the trigger
property sheet. This removes the changes performed on the trigger and
reapplies the trigger template
Select <None> in the trigger template dropdown listbox in the Definition
page 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
Delete and rebuild
or preserve triggers
User-defined
triggers
Chapter 8 Triggers and Procedures
PDM User's Guide 397
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 page 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 dropdown listbox in the Definition page of the trigger property
sheet. The 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.
The General page of the Rebuild Triggers dialog box shows the following
type of information organized hierarchically in a tree view:
All trigger types supported by the current DBMS
All trigger templates corresponding to the trigger types
All template items defined for each trigger template
You can select trigger types, trigger templates, and template items by
expanding the appropriate nodes and selecting or clearing the check boxes as
required.
The Rebuild Triggers General page for Sybase Adaptive Server Anywhere 6
is shown below. The node for the Before Insert Trigger is
expanded showing the BeforeInsertTrigger template that it is based
on, and the two template items InsertChildParentExist and
InsertTooManyChildren:
Selecting triggers,
trigger templates,
and template items
Using triggers
398 PowerDesigner
When you select a template item, it is included in the corresponding trigger
template. If a trigger is generated from the template, the template item is
generated in the trigger script if one of the following criteria applies:
Template item implements trigger referential integrity constraints that
apply to a reference or sequence for columns. A template item can
therefore be defined in a trigger template, but will only exist in the
generated trigger if it implements the referential integrity defined for a
reference or sequences for columns
Template item is user-defined. User-defined template items for a
generated trigger are generated independently of referential integrity
constraints or sequences for columns
Template items
Chapter 8 Triggers and Procedures
PDM User's Guide 399
You must select Trigger as the implementation option for referential integrity
for one or more of the references attached to the table. This is done on the
Integrity page for the relevant reference.
You can select Trigger as the implementation option for multiple references
by selecting Trigger from the Implementation dropdown list box for each
reference from the List of References.
For more information on selecting referential integrity options from the
Reference property sheet, see section Defining referential integrity in chapter
Building Physical Diagrams.
To create a trigger automatically:
1 Select ToolsRebuild ObjectsRebuild Triggers.
The Rebuild Triggers dialog box appears. The General page shows a tree
view containing the names of available triggers based on existing trigger
templates.
2 Select the Delete and Rebuild radio button if you want to delete all
existing triggers and rebuild using trigger templates.
or
Select the Preserve radio button if you want to keep all existing triggers
and create triggers using trigger templates.
Trigger as
referential integrity
option
Using triggers
400 PowerDesigner
Verify that Trigger is the referential integrity selection
Triggers are only created automatically for tables that have Trigger
selected as the referential integrity implementation option in property
sheets for one or more references attached to each table.
3 Select check boxes for triggers that you want to create.
or
Clear check boxes for triggers that you do not want to create.
4 Expand a selected trigger node.
The trigger template node appears. This is the trigger template which is
used to create the trigger.
5 Expand the trigger template node.
The template item nodes appear. These are the template items that are
contained in the trigger template definition.
6 Select template item check boxes for template items that you want to
include in the trigger definition.
or
Clear template item check boxes for template items that you do not want
to include in the trigger definition.
7 Expand other trigger nodes and select or clear check boxes for template
items as appropriate.
8 Click the Selection tab.
The Selection page appears. It lists all the tables in the model.
9 Select check boxes for tables for which you want to create a trigger.
or
Clear check boxes for tables for which you do not want to create a
trigger.
10 Click OK.
The rebuilding process is shown in the Output window. You can view
the triggers that have been created from the Triggers page of the table
property sheet, or from the List of Triggers. You can modify trigger
properties and its definition from the trigger property sheet.
For more information on modifying a trigger definition, see section
Modifying a trigger.
Chapter 8 Triggers and Procedures
PDM User's Guide 401
Creating a trigger manually
You can create a trigger manually from the table or view property sheet,
using a trigger template, or typing the trigger definition from scratch.
For more information on defining triggers on views, see section View
triggers, in chapter Building Physical Diagrams.
You must select Trigger as the implementation option for referential
integrity, for one or more of the references attached to the table. This can be
done on the Integrity page for the relevant reference.
To create a trigger manually:
1 Double-click a table symbol.
The table property sheet appears.
2 Click the Triggers tab.
The Triggers page appears. It lists the triggers defined for the table.
3 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the start of the line.
4 Type a trigger name and a trigger code.
Make sure that trigger names are unique within the table
When you name a trigger, you cannot use a name that has already
been used for another trigger attached to the same table. Each new
trigger must have a name that is unique in the list.
5 Click Apply.
The creation of the new trigger is committed.
6 Click the new trigger line.
An arrow appears at the start of the line.
7 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The property sheet for the new trigger opens to the General page.
Using triggers
402 PowerDesigner
8 Select the Generate check box.
or
Clear the Generate check box.
9 Click the Definition tab.
The Definition page appears.
10 Select a trigger template from the Template dropdown list box.
Not using an existing trigger template
You can choose not to use a trigger template to create a trigger, by
selecting <None> from the Template dropdown list, and typing the
definition from scratch in the definition text box.
The type of trigger that is defined by the template appears in the Type
dropdown list box, and the trigger definition appears in the text box.
11 Type modifications to the definition.
12 Select the order that you want the trigger to fire from the Order
dropdown list box.
Chapter 8 Triggers and Procedures
PDM User's Guide 403
Adding template items
You can also add template items to a trigger from the Definition page.
Template items are named reusable macros that can be inserted into
trigger scripts. They can be used for implementing referential
integrity constraints or doing any other work updating or modifying
tables in your database related to the trigger in which they are
inserted.
For more information on adding template items to a trigger, see
section Modifying a trigger.
13 Click OK in each of the dialog boxes.
Modifying a trigger
You can customize a trigger as follows:
Modifying its definition code directly. You can type changes to the
trigger definition, and also use editing tools to insert pre-defined
variables, operators, functions, and macros into the trigger definition
code
Inserting template items into the definition code to implement referential
integrity constraints, or do any work updating or modifying tables in the
database
Always add a terminator block at the end of a trigger definition
When you customize a trigger, you must add a terminator block at the end
of the definition.
Note: Sybase Adaptive Server Anywhere and Sybase Adaptive Server IQ
use a semicolon (;) as terminator.
You can modify a trigger from its property sheet. You can access a trigger
property sheet in several ways:
From the table property sheet click the Triggers tab, select a trigger from
the list of triggers that appears, and click the Properties tool
From the List of Triggers, select a trigger and click the Properties tool
From the Browser, right-click the trigger node under the appropriate
table node in the tree view, and select Properties from the contextual
menu
Accessing a trigger
property sheet
Using triggers
404 PowerDesigner
Modifying other trigger properties
You can modify a trigger name, code, comment, the table that it is
attached to, and whether or not the trigger is generated, from the General
page of the trigger property sheet. When you name a trigger, you cannot
use a name that has already been used for another trigger attached to the
same table. Each new trigger must have a name that is unique in the list.
You can modify a trigger definition by typing changes directly to the trigger
script. You can insert pre-defined operators, variables, functions and macros
into the trigger definition by clicking on the appropriate tool from the Insert
Script tool bar, and selecting an item from the menu that appears. The
selected script item is inserted at the cursor position in the definition code.
You can use the following tools to insert script items into the trigger
definition:
Tool Tooltip Description
Operators Provides logical operators to insert in the
trigger definition
Functions Provides group, number, string, date,
conversion and other functions to insert in
the trigger definition
Macros Provides macros to accelerate the creation
of a trigger definition
Variables Provides variables for use with operators
and functions
Edit with SQL Editor Opens the SQL Editor dialog box. Provides
object types and available objects to insert
in the trigger definition
SQL/XML Wizard Opens the SQL/XML Wizard to build a
SQL/XML query from a table or a view and
insert it in the trigger definition
Insert SQL/XML Macro Opens a dialog box to select a global
element in an XML model open in the
workspace with the SQL/XML extended
model definition. Inserts a SQL/XML
macro referencing the selected element in
the trigger definition
For more information on variables, see List of PowerDesigner variables
in chapter Variables in PowerDesigner.
For more information on macros, see Using macros.
Inserting script
items
Chapter 8 Triggers and Procedures
PDM User's Guide 405
For more information on the SQL/XML Wizard, see Using the
SQL/XML Wizard.
You can add a template item defined in the current model or defined in the
current DBMS to a trigger definition. A template item can call a macro to
implement referential integrity, or perform any other type of action on
database tables.
Use the following tools to add a template item in a trigger definition:
Tool Tooltip Description
Add Trigger Item From
Model
Opens a dialog box to select a user-
defined trigger template item from the
PDM and insert it in the trigger definition
Add Trigger Item From
DBMS
Opens a dialog box to select a trigger
template item from the targeted DBMS
and insert it in the trigger definition
For more information on creating and using template items, see section
Using template items.
To modify a trigger:
1 Click the Definition tab from the trigger property sheet.
The Definition page appears. It shows the definition code of the trigger
template selected for the trigger.
2 Type modifications to the trigger code.
or
Click in the trigger definition where you want to insert a script item.
Adding template
items
Using triggers
406 PowerDesigner
Click a script item tool.
Select a script item from the menu.
or
Click in the trigger definition where you want to insert a template item.
Click an Add Trigger Item tool.
Select a trigger item from the list that appears, and click OK.
3 Click OK in each of the dialog boxes.
Indicating trigger order
For a specified table, you can indicate the order that a trigger executes, or
fires, within a group of triggers of the same type.
To indicate trigger order:
1 Click the Definition tab from the trigger property sheet.
The Definition page appears.
2 Select a number from the Order dropdown list box.
This indicates the position in the firing order that the trigger fires.
3 Click OK in each of the dialog boxes.
Multiple triggers
Depending on the current DBMS, you can 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.
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
Example
Chapter 8 Triggers and Procedures
PDM User's Guide 407
declare user_defined_exception exception for
SQLSTATE '99999';
declare salary_out_of_range_exception exception for
SQLSTATE '99991';
declare minsal integer;
declare maxsal integer;
/* Test if the salary of the new employee is between the
minimum salary */
/* and the maximum salary of other employees working in
this function */
select min(EMPSAL), max(EMPSAL)
into minsal, maxsal
from EMPLOYEE
where EMPFUNC=new_ins.EMPFUNC;
if (minsal<>0 and maxsal<>0 and
(new_ins.EMPSAL>maxsal or new_ins.EMPSAL<minsal))
then
signal salary_out_of_range_exception
end if;
exception
when salary_out_of_range_exception then
message 'Error: Salary is out of range for the
function';
signal user_defined_exception;
when others then
message 'Exception in before insert
trigger(%TRIGGER%) of table %OWNERPREFIX%%TABLE%';
resignal;
end
create trigger tibTestSalry2 before insert order 2 on
EMPLOYEE
referencing new as new_ins for each row
begin
declare user_defined_exception exception for
SQLSTATE '99999';
declare higher_salary_than_manager_exception
exception for SQLSTATE '99992';
declare mansal integer;
/* Test if the salary of the new employee is superior to
the salary of*/
/* his or her future manager */
select EMPSAL
into mansal
from EMPLOYEE
where EMPNUM=new_ins.EMP_EMPNUM;
if mansal<>0 and new_ins.EMPSAL>mansal
then
signal higher_salary_than_manager_exception
end if;
exception
Using triggers
408 PowerDesigner
when higher_salary_than_manager_exception then
message 'Error: salary is higher than the manager's
salary';
signal user_defined_exception;
when others then
message 'Exception in before insert
trigger(%TRIGGER%) of table %OWNERPREFIX%%TABLE%';
resignal;
end
Previewing a trigger
You preview a trigger when you want to see the generated contents of a
trigger with instantiated variables. You can preview a trigger from the
Preview page of the trigger property sheet.
To preview a trigger:
1 Click the Preview tab from the trigger property sheet.
The Preview page appears. The trigger definition appears in the preview
text box.
2 Click OK in each of the dialog boxes.
Chapter 8 Triggers and Procedures
PDM User's Guide 409
Using trigger templates
You can create triggers based on trigger templates. You can create your own
trigger templates, or use the pre-defined trigger templates delivered with
PowerDesigner. Trigger templates exist for each type of trigger supported by
the DBMS.
Trigger templates can be used in two ways:
Template use Description
Automatic creation
of triggers
The Rebuild Triggers function uses all trigger templates
defined in the DBMS and current model to automatically
create triggers for selected tables. Triggers are created for
tables that have Trigger defined as the implementation for
referential integrity for one or more references attached to
the table and for tables containing columns linked to a
sequence
As a base for
creating a trigger
There are trigger templates for each trigger type (update,
delete, or insert). Using a template allows you to quickly
create an update, delete, or insert trigger for a table
DBMS trigger templates are defined in the current DBMS.
The availability of DBMS trigger templates to other models depends on where
the templates are stored:
Template stored in Available to
DBMS connected as Shared All models using the DBMS (.XDB file)
DBMS connected as Copy Current model only
For more information on the DBMS connections, see chapter Database
Creation and Modification.
You can create a trigger template in the DBMS. You can also use and modify
the pre-defined trigger templates delivered with PowerDesigner.
Modifying DBMS Link templates
By modifying a DBMS Link template, you modify the .XDB file which
contains the DBMS definition in the DBMS library. This definition is
shared by all models using the DBMS Link. You should only modify a
DBMS Link definition that is a copy of the DBMS shipped with
PowerDesigner.
Why use trigger
templates?
DBMS trigger
templates
Using trigger templates
410 PowerDesigner
The pre-defined DBMS templates that ship with PowerDesigner indicate
referential integrity constraints for one of three trigger types: insert, update,
and delete. Depending on the current DBMS, there is a before and after event
template for each trigger type.
You can modify the trigger definition in the PowerDesigner pre-defined
trigger templates, but they cannot be deleted or renamed.
For more information on the DBMS definition, see the DBMS
Reference Guide in the Advanced User Documentation.
A user-defined trigger template is any trigger template that has been created
in the model or in the current DBMS.
A model trigger template is a trigger template defined in a model. It cannot be
used by other models. Model trigger templates are always user-defined.
Identifying PowerDesigner pre-defined trigger template types
The types of pre-defined DBMS trigger templates that are shipped with
PowerDesigner depend on the current DBMS for the model.
The following templates types exist, but are not available for all DBMS:
Template type Generates trigger/procedure executing
InsertTrigger With insert
BeforeInsertTrigger Before insert
AfterInsertTrigger After insert
InsertProc When called by InsertTrigger
BeforeInsertProc When called by BeforeInsertTrigger
AfterInsertProc When called by AfterInsertTrigger
PowerDesigner
pre-defined DBMS
templates
User-defined
trigger templates
Model trigger
templates
Insert templates
Chapter 8 Triggers and Procedures
PDM User's Guide 411
Template type Generates trigger/procedure executing
UpdateTrigger With update
BeforeUpdateTrigger Before update
AfterUpdateTrigger After update
UpdateProc When called by UpdateTrigger
BeforeUpdateProc When called by BeforeUpdateTrigger
AfterUpdateProc When called by AfterUpdateTrigger
Template type Generates trigger/procedure executing
DeleteTrigger With delete
BeforeDeleteTrigger Before delete
AfterDeleteTrigger After delete
DeleteProc When called by DeleteTrigger
BeforeDeleteProc When called by BeforeDeleteTrigger
AfterDeleteProc When called by AfterDeleteTrigger
Update templates
Delete templates
Using trigger templates
412 PowerDesigner
Trigger template properties
Each trigger template definition includes the following properties:
Property Description
Name Name of the trigger template
Code Reference code of the trigger template. The code is generated
in trigger script
Comment Descriptive label for the trigger template
DBMS Current DBMS
Trigger time Time attribute of the trigger template. The dropdown listbox
displays the values defined in the trigger templates and
template items of the current DBMS
Trigger event Event attribute of the trigger template. The dropdown listbox
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 table
triggers or view
triggers
For those DBMS that support view triggers, it allows you to
define if the trigger template applies to table or view triggers
A trigger template definition also includes the following properties, each with
their respective property sheets:
Property Description
Definition Trigger template code
Template items Template items that are generated when the trigger is generated
The Template Item page, accessed from the trigger template property sheet,
lists 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 page 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 page, without having to
remove them from the trigger template definition.
Template items in
a trigger template
Chapter 8 Triggers and Procedures
PDM User's Guide 413
When you use Rebuild Triggers to automatically create triggers for selected
tables, the template items that are listed on this page 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
You can add any template item from the model or DBMS to the Trigger
template definition by clicking an Add Trigger Item tool from the Definition
page of the trigger template property sheet, and selecting a trigger item. It is
automatically added to the Template Items page.
Using variables in trigger templates
You can use variables in triggers, trigger templates, and template items. At
trigger generation these variables are replaced by values for a specific model
or table.
For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
You can also use formatting variables that have a syntax that can force a
format on their values, as follows:
Force values to lower-case or upper-case characters
Truncate the length of values
For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
Rebuild triggers
Adding template
items to trigger
template definition
Formatting
variables
Using trigger templates
414 PowerDesigner
Creating a trigger template
You can create two types of trigger templates:
Trigger template Created in current Available to
DBMS DBMS All models if created in a
Shared: DBMS
Current model if created in a
Copy: DBMS
Model Model Current model
There are two ways to create a trigger template:
Renaming and editing a copy of an existing trigger template
Creating a new template definition from scratch
You can associate a trigger name with a trigger template. It is recommended
that you follow trigger naming conventions when naming triggers. For
example, tib2_%TABLE%.This helps prevent duplicating a trigger for the
same table.
For information on trigger naming conventions, see section Trigger
naming conventions.
Associating a
trigger name with a
template
Chapter 8 Triggers and Procedures
PDM User's Guide 415
Creating a DBMS trigger template using an existing template
You create a DBMS Trigger Template in the Trigger Templates page from
the property sheet for the current DBMS.
To create a DBMS trigger template using an existing template:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Templates tab.
The Trigger Templates page appears.
3 Click the Create from DBMS trigger template tool.
A selection box appears.
Using trigger templates
416 PowerDesigner
It lists all the trigger templates available in the current DBMS.
4 Select a check box for the type of trigger template that you want to use
as the basis for your new template.
5 Click OK.
6 You return to the Trigger Templates page. The duplicate DBMS
template is listed.
7 Type a new name and code for the new template.
8 Click Apply.
The creation of the new template is committed.
9 Click the new template line.
An arrow appears at the beginning of the line.
10 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
Chapter 8 Triggers and Procedures
PDM User's Guide 417
The property sheet for the new trigger template appears.
11 Click the Definition tab.
The Definition page appears. It shows the definition of the template.
12 Type modifications to the template definition.
13 Click OK in each of the dialog boxes.
A confirmation box appears asking if you want to save the changes to the
DBMS.
14 Click Yes.
Using trigger templates
418 PowerDesigner
Creating a new DBMS trigger template
You create a new DBMS trigger template from the Trigger Templates page
in the property sheet for the current DBMS.
To create a new DBMS trigger template:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Templates tab.
The Trigger Templates page appears.
3 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type a Template name and code.
5 Click Apply.
The creation of the new template is committed.
6 Click the new template line.
An arrow appears at the beginning of the line.
7 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
8 Click the Definition tab.
The Definition page appears.
9 Type the template definition.
10 Click OK in each of the dialog boxes.
A confirmation box appears asking if you want to save the changes to the
DBMS.
11 Click Yes.
Chapter 8 Triggers and Procedures
PDM User's Guide 419
Creating a model trigger template using an existing template
To create a model trigger template using an existing template:
1 Select ModelTriggersTrigger Templates.
The List of User-Defined Trigger Templates appears.
2 Click the Create from DBMS trigger template tool.
A selection box appears. It lists all the trigger templates available in the
current DBMS.
3 Select a check box for the type of trigger template that you want to use
as the basis for your new template.
4 Click OK.
5 You return to the Trigger Templates page. The duplicate DBMS
template is listed.
6 Type a new name and code for the new template.
7 Click Apply.
The creation of the new template is committed.
8 Click the new template line.
An arrow appears at the beginning of the line.
Using trigger templates
420 PowerDesigner
9 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
10 Click the Definition tab.
The Definition page appears. It shows the definition of the template.
11 Type modifications to the template definition.
12 Click OK in each of the dialog boxes.
Creating a new model trigger template
To create a new model trigger template:
1 Select ModelTriggers Trigger Templates.
The List of User-defined Trigger Templates appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Chapter 8 Triggers and Procedures
PDM User's Guide 421
3 Type a Template name and code.
4 Click Apply.
The creation of the new template is committed.
5 Click the new template line.
An arrow appears at the beginning of the line.
6 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
7 Click the Definition tab.
The Definition page appears.
8 Type the template definition.
9 Click OK in each of the dialog boxes.
Modifying a trigger template
You can customize a trigger template as follows:
Modifying its definition code directly. You can type changes to the
trigger template definition, and also use editing tools to insert pre-
defined variables, operators, functions, and macros into the trigger
template definition code.
Inserting template items into the definition code to implement referential
integrity constraints, or do any work updating or modifying tables in the
database
.
Work on a copy of your DBMS definition file
By modifying the definition of a DBMS trigger template, you modify the
DBMS. If you modify a DBMS trigger template, you can not restore its
original value from the DBMS property sheet. You can use the Undo
function to return to previous modifications. It is recommended that you
only modify a copied version of a DBMS.
Using trigger templates
422 PowerDesigner
You can modify a trigger template definition by typing changes directly to
the template script. You can insert pre-defined operators; variables, functions
and macros into the trigger template definition, by clicking on the appropriate
tool from the Insert Script tool bar, and selecting an item from the menu that
appears. The selected script item is inserted at the cursor position in the
definition code.
You can use the following tools to insert script items into the trigger template
definition:
Tool Tooltip Description
Operators Provides logical operators
Functions Provides group, number, string, date, conversion and
other functions
Macros Provides macros to accelerate the creation of a trigger
template definition
Variables Provides variables for use with operators and functions
For more information on variables, see List of PowerDesigner variables
in chapter Variables in PowerDesigner.
For more information on macros, see Using macros.
You can use the following tools to add a template item to a trigger template
definition:
Tool Tooltip Description
Add Trigger
Item From
Model
Opens a dialog box to select a user-defined trigger
template item from the PDM and insert it in the
trigger template definition
Add Trigger
Item From
DBMS
Opens a dialog box to select a trigger template item
from the targeted DBMS and insert it in the trigger
template definition
A template item can call a macro to implement referential integrity, or
perform any other type of action on database tables.
If you add manually a template item in the trigger template definition, make
sure the name of the template item is preceded by a ".".
Inserting script
items
Adding template
items
Chapter 8 Triggers and Procedures
PDM User's Guide 423
To add a template item to a trigger template:
1 Create a trigger template item.
2 Open the property sheet of the trigger template you want to modify.
3 Click the Definition tab to display the Definition page.
4 Click the Add Trigger Item From Model tool and select the newly
created trigger template item.
5 Click OK.
Using trigger templates
424 PowerDesigner
The newly created trigger template item appears in the trigger template
definition.
6 Click OK.
For more information on creating and using template items, see section
Using template items.
Modifying a DBMS trigger template
To modify a DBMS trigger template:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Templates tab.
The Trigger Templates page appears. It lists all the trigger templates
defined in the current DBMS.
3 Click a trigger template name in the list.
An arrow appears at the start of the line.
4 Click the Properties tool.
or
Double-click the arrow at the start of the line.
Chapter 8 Triggers and Procedures
PDM User's Guide 425
The Trigger Template property sheet appears.
5 Click the Definition tab.
The Definition page appears.
6 Type modifications to the trigger code.
or
Click in the trigger template definition where you want to insert a script
item.
Click a script item tool.
Select a script item from the menu.
or
Click in the trigger template definition where you want to insert a
template item.
Click the Add Trigger Item From Model tool.
Select a trigger item from the list that appears, and click OK.
7 Click OK.
A confirmation box appears asking if you want to save the changes to the
DBMS.
8 Click Yes.
Modifying a model trigger template
To modify a model trigger template:
1 Select ModelTriggers Trigger Templates.
The List of User-defined Trigger Templates appears.
2 Click a trigger template name in the list.
An arrow appears at the start of the line.
3 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The Trigger Template property sheet appears.
Using trigger templates
426 PowerDesigner
4 Type modifications to the trigger template code.
or
Click in the trigger definition where you want to insert a script item.
Click a script item tool.
Select a script item from the menu.
or
Click in the trigger template definition where you want to insert a
template item.
Click an Add Trigger Item tool.
Select a trigger item from the list that appears, and click OK.
5 Click OK in each of the dialog boxes.
Trigger naming conventions
The pre-defined trigger templates that ship with PowerDesigner indicate
naming conventions for the trigger scripts that it generates. The naming
convention consists of a prefix indicating the trigger type followed by the
table code.
The default naming conventions include a variable (%L:TABLE). The name
of the resulting trigger script replaces this variable with a lower-case table
code. For example, a resulting trigger script may have the name ti_employee.
Changing trigger naming conventions
You can change the trigger naming convention in PowerDesigner pre-defined
DBMS trigger templates from the Trigger Templates page of the DBMS
property sheet.
To change trigger naming conventions in a DBMS trigger template:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Template tab.
The Trigger Templates page appears.
3 Click a trigger template line.
An arrow appears at the start of the line.
4 Click the Properties tool.
or
Double-click the arrow at the start of the line.
Chapter 8 Triggers and Procedures
PDM User's Guide 427
The Trigger Template property sheet appears.
5 Type a new trigger name in the Trigger Name text box at the bottom of
the page.
For example, mytempl_%TABLE%
6 Click OK in each of the dialog boxes.
Calling a related procedure in a trigger template
Some target databases do not accept code within a trigger statement. For
these databases, a trigger template can call a related procedure as a
parameter, which is defined in a procedure template. In these cases,
procedure templates are listed in the list of trigger templates.
Informix does not accept code in trigger templates. The template
InsertTrigger calls the procedure in the form of the variable %PROC%,
as follows:
-- Insert trigger "[%QUALIFIER%]%TRIGGER%" for table
"[%QUALIFIER%]%TABLE%"
create trigger [%QUALIFIER%]%TRIGGER% insert on
[%QUALIFIER%]%TABLE%
referencing new as new_ins
for each row (execute procedure
%PROC%(.FKCOLN("new_ins.%COLUMN%", "", ",", "));")
/
The template InsertProc defines the procedure, as follows:
-- Insert procedure "%PROC%" for table
"[%QUALIFIER%]%TABLE%"
create procedure %PROC%(.FKCOLN("new_%.14L:COLUMN%
%COLTYPE%", "", ",", ")")
.DeclInsertChildParentExist
.DeclInsertTooManyChildren
define errno integer;
define errmsg char(255);
define numrows integer;
.InsertChildParentExist
.InsertTooManyChildren
end procedure;
/
Example
Using template items
428 PowerDesigner
Using template items
Template items are named reusable blocks of script that can be inserted into
trigger templates or triggers.
In a generated trigger script, a template item calls a macro that implements a
trigger referential integrity constraint or does any other updating work on
tables in the database.
A trigger template for Sybase Adaptive Server Anywhere 6 contains the
.InsertChildParentExist template item, which corresponds to the
following definition:
.FOREACH_PARENT()
/* Parent "[%PQUALIFIER%]%PARENT%" must exist when
inserting a child in "[%CQUALIFIER%]%CHILD%" */
if (.JOIN("new_ins.%FK% is not null", "", " and", ")
then")
begin
set found = 0;
select 1
into found
from dummy
where exists (select 1
from [%PQUALIFIER%]%PARENT%
where .JOIN("%PK% = new_ins.%FK%",
"and ", "", ");")
if found <> 1 then
message 'Error: Trigger(%TRIGGER%) of table
[%QUALIFIER%]%TABLE%';
message ' Parent code must exist when
inserting a child!';
signal user_defined_exception;
end if;
end
end if;
.ENDFOR
Example
Chapter 8 Triggers and Procedures
PDM User's Guide 429
Template items are inserted in a trigger or trigger template definition using a
dot followed by the template item name. For example, the following script
contains two template items InsertChildParentExist and
InsertTooManyChildren:
/* Before insert trigger "%TRIGGER%" for table
"[%QUALIFIER%]%TABLE%" */
create trigger %TRIGGER% before insert order %ORDER% on
[%QUALIFIER%]%TABLE%
referencing new as new_ins for each row
begin
declare user_defined_exception exception for
SQLSTATE '99999';
declare found integer;
.InsertChildParentExist
.InsertTooManyChildren
end
/
Certain DBMS require that a cursor and variables be declared for each
template item before the template item name appears in the script. Use the
following format to declare a template item:
.Decl template item name.
For more information on declaring template items in a trigger or trigger
template, see section Declaring a template item in a trigger definition.
PowerDesigner ships pre-defined template items for each pre-defined trigger
template defined in the supported DBMS. The Rebuild Triggers function
uses both pre-defined and user-defined trigger templates to automatically
create triggers for selected tables.
In the pre-defined trigger templates, each pre-defined template item
corresponds to a referential integrity constraint. Although a pre-defined
template item is defined in a trigger template, it is only generated in a trigger
script if it implements the trigger referential integrity defined for a reference.
Template items have the following generation conditions:
Template item is listed in Template item is
Template Items page of trigger
property sheet
Available for generation
Template Items page of trigger
template property sheet
Generated
You can modify the definition of the PowerDesigner pre-defined template
items, but they cannot be deleted or renamed.
How are template
items inserted in a
trigger definition?
PowerDesigner
pre-defined
template items
Using template items
430 PowerDesigner
You can create template items in the model or current DBMS.
Unlike the PowerDesigner pre-defined template items, user-defined template
items are generated in triggers by Rebuild Triggers independently from
referential integrity constraints. If a user-defined template is listed on the
Template Items page of the trigger template property sheet, it will always be
generated in the trigger.
You can create a template item in the current DBMS. If the DBMS is
connected as Shared, then the template item is available to other models using
the same DBMS. If the DBMS is a Copy in the model, or if you create the
template item in the model, it is available only to the current model.
Modifying DBMS template items
By modifying a DBMS template item, you modify the template item
definition in the current DBMS. You should only modify a DBMS that is a
copy of the DBMS shipped with PowerDesigner.
For more information on creating and copying a DBMS, see chapter
The Resource Editor in the General Features Guide.
Identifying template items
The PowerDesigner pre-defined template items that are available depend on
the current DBMS.
The following pre-defined template items exist, but are not available for all
DBMS.
The template items below implement referential integrity in insert trigger
templates.
Template item
Integrity
constraint Description
DeclInsertChildParentExist
InsertChildParentExist
Mandatory parent Parent must exist
when inserting a
child
DeclInsertTooManyChildren
InsertTooManyChildren
Cannot exceed
maximum
cardinality
constraint
Cannot insert a
child if maximum
cardinality has
been reached
DeclInsertSequenceColumn
InsertSequenceColumn
Select value in
sequence list for
column
Select a value for
the column from a
list of sequences
User-defined
template items
Insert constraints
Chapter 8 Triggers and Procedures
PDM User's Guide 431
The template items below implement referential integrity in update trigger
templates.
Template item
Integrity
constraint Description
DeclUpdateChildParentExist
UpdateChildParentExist
Mandatory
parent
Parent must exist
when updating a
child
DeclUpdateChildChangeParent
UpdateChildChangeParent
Change parent
not allowed
Cannot modify
parent code in
child
DeclUpdateParentRestrict
UpdateParentRestrict
Restrict on
update
Cannot modify
parent if child
exists
DeclUpdateParentCascade
UpdateParentCascade
Cascade on
update
Modify parent
code in all
children
DeclUpdateChangeColumn
UpdateChangeColumn
Non-modifiable
column
Cannot modify
column
DeclUpdateParentSetNull
UpdateParentSetNull
Set null on
update
Set parent code to
null in all children
DeclUpdateParentSetDefault
UpdateParentSetDefault
Set default on
update
Set parent code to
default in all
children
DeclUpdateTooManyChildren
UpdateTooManyChildren
Cannot exceed
maximum
cardinality
constraint
Cannot update a
child if maximum
cardinality has
been reached
The template items below implement referential integrity in delete trigger
templates.
Template item
Integrity
constraint Description
DeclDeleteParentRestrict
DeleteParentRestrict
Restrict on
delete
Cannot delete
parent if child
exists
DeclDeleteParentCascade
DeleteParentCascade
Cascade on
delete
Delete parent code
in all children
DeclDeleteParentSetNull
DeleteParentSetNull
Set null on
delete
Delete in parent
sets child to null
Update constraints
Delete constraints
Using template items
432 PowerDesigner
Template item
Integrity
constraint Description
DeclDeleteParentSetDefault
DeleteParentSetDefault
Set default on
delete
Delete in parent
sets child to
default
You can insert the following template items in any trigger template. They
generate error messages that indicate the violation of an integrity constraint.
Template item Description
UseErrorMsgText Error handling without a message table
UseErrorMsgTable Error handling with a message table
Template item properties
Each template item definition includes the following properties:
Property Description
Name Name of template item
Code Reference code of template item. The code is generated in trigger
scripts
Comment Descriptive label for the template item
DBMS Current DBMS
A template item definition also includes the following properties, each with
their respective property sheets:
Property Description
Definition Template item code
Declaration Declaration for template item in trigger script
Using variables in template items
You can use variables in triggers, trigger templates, and template items. At
trigger generation these variables are replaced by values for a specific model
or table.
Constraint
messages
Chapter 8 Triggers and Procedures
PDM User's Guide 433
For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
You can also use formatting variables that have a syntax that can force a
format on their values, as follows:
Force values to lower-case or upper-case characters
Truncate the length of values
For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
Creating a template item
You usually create a template item when an existing template item is not
suitable, or to create a repeatable block of code to do updating work on tables
in the database.
You can create two types of template items:
Template item Created in Available to
DBMS Current DBMS All models if created in a Shared: DBMS
Current model if created in Copy: DBMS
Model Current Model Current model
There are two ways to create a template item:
Renaming and editing a copy of an existing DBMS template item
Creating a new template item definition from scratch
Creating a DBMS template item using an existing template item
To create a DBMS template item using an existing template item:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Template Items tab.
Formatting
variables
Using template items
434 PowerDesigner
The Trigger Template Items page appears.
3 Click the Create from DBMS trigger item tool.
A selection box appears. It lists all the trigger template items available in
the current DBMS.
4 Select a check box for the type of trigger template item that you want to
use as the basis for your new template item.
Chapter 8 Triggers and Procedures
PDM User's Guide 435
5 Click OK.
6 You return to the Trigger Template Items page. The duplicate DBMS
template item is listed.
7 Type a new name and code for the new template item.
8 Click Apply.
The creation of the new template item is committed.
9 Click the new template item line.
An arrow appears at the beginning of the line.
10 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new template item appears.
11 Click the Definition tab.
The Definition page appears. It shows the definition of the template item.
12 Type modifications to the template item definition.
13 Click OK in each of the dialog boxes.
A confirmation box appears asking if you want to save the changes to the
DBMS.
14 Click Yes.
Using template items
436 PowerDesigner
Creating a new DBMS template item
To create a new DBMS template item:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Template Items tab.
The Trigger Template Items page appears.
3 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
4 Type a template item name and code.
5 Click Apply.
The creation of the new template item is committed.
6 Click the new template item line.
An arrow appears at the beginning of the line.
7 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
8 Click the Definition tab.
The Definition page appears.
9 Type the template item definition.
10 Click OK in each of the dialog boxes.
A confirmation box appears asking if you want to save the changes to the
DBMS.
11 Click Yes.
Chapter 8 Triggers and Procedures
PDM User's Guide 437
Creating a model template item using an existing template item
To create a model template item using an existing template item:
1 Select ModelTriggers Trigger Template Items.
The List of User-Defined Trigger Template Items appears.
2 Click the Create From DBMS Trigger Item tool.
A selection box appears. It lists all the trigger template items available in
the current DBMS.
3 Select a check box for the type of trigger template item that you want to
use as the basis for your new template item.
4 Click OK.
5 You return to the List of User-Defined Trigger Template Items page.
The duplicate DBMS template item is listed.
6 Type a new name and code for the new template item.
7 Click Apply.
The creation of the new template item is committed.
8 Click the new template item line.
An arrow appears at the beginning of the line.
Using template items
438 PowerDesigner
9 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template item appears.
10 Click the Definition tab.
The Definition page appears. It shows the definition of the trigger
template item.
11 Type modifications to the trigger template item definition.
12 Click OK in each of the dialog boxes.
Creating a new model template item
To create a new model template item:
1 Select ModelTriggers Trigger Template Items.
The List of User-defined Trigger Template Items appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Chapter 8 Triggers and Procedures
PDM User's Guide 439
3 Type a template item name and code.
4 Click Apply.
The creation of the new template item is committed.
5 Click the new template line.
An arrow appears at the beginning of the line.
6 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
7 Click the Definition tab.
The Definition page appears.
8 Type the template item definition.
9 Click OK in each of the dialog boxes.
Modifying a template item
You can customize a template item by modifying its definition code directly.
You can type changes to the template item definition, and also use editing
tools to insert pre-defined variables, operators, functions, and macros into the
template item definition code.
.
No restore default value for trigger templates
By modifying the definition of a DBMS template item, you modify the
DBMS. If you modify a DBMS template item, you can not restore its
original value from the DBMS property sheet. You can use the Undo
function to return to previous modifications. It is recommended that you
only modify a copied version of a DBMS.
You can modify a template item definition by typing changes directly to the
template item script. You can insert pre-defined operators; variables,
functions and macros into the template item definition, by clicking on the
appropriate tool from the Insert Script tool bar, and selecting an item from
the menu that appears. The selected script item is inserted at the cursor
position in the definition code.
Inserting script
items
Using template items
440 PowerDesigner
You can use the following tools to insert script items into the template item
definition:
Tool Tooltip Description
Operators Provides logical operators
Functions Provides group, number, string, date, conversion and other
functions
Macros Provides macros to accelerate the creation of a template
item definition
Variables Provides variables for use with operators and functions
For more information on variables, see List of PowerDesigner variables
in chapter Variables in PowerDesigner.
For more information on macros, see Using macros.
Modifying a DBMS template item
To modify a DBMS template item:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet appears.
2 Click the Trigger Template Items tab.
The Trigger Template Items page appears. It lists all the template items
defined in the current DBMS.
3 Click a template item name in the list.
An arrow appears at the start of the line.
4 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The Trigger Template Item property sheet appears.
5 Click the Definition tab.
The Definition page appears.
6 Type modifications to the template item code.
or
Click in the trigger definition where you want to insert a script item.
Chapter 8 Triggers and Procedures
PDM User's Guide 441
Click a script item tool.
Select a script item from the menu.
7 Click OK.
A confirmation box appears asking if you want to save the changes to the
DBMS.
8 Click Yes.
Modifying a model template item
To modify a model template item:
1 Select ModelTriggers Trigger Template Items.
The List of User-defined Trigger Template Items appears.
2 Click a template item name in the list.
An arrow appears at the start of the line.
3 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The Trigger Template Item property sheet appears.
4 Type modifications to the template item code.
or
Click in the template item definition where you want to insert a script
item.
Click a script item tool.
Select a script item from the menu.
5 Click OK in each of the dialog boxes.
Declaring a template item in a trigger definition
Certain DBMS require that a cursor and variables are declared for each
template item before the template item name appears 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.
For example, the trigger definition for Oracle 8 contains the
.DeclInsertChildParentExist statement which declares the
following .InsertChildParentExist template item:
Using template items
442 PowerDesigner
-- Before insert trigger "[%QUALIFIER%]%TRIGGER%" for
table "[%QUALIFIER%]%TABLE%"
create trigger [%QUALIFIER%]%TRIGGER% before insert
on [%QUALIFIER%]%TABLE% for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
dummy integer;
found boolean;
.DeclInsertChildParentExist
begin
.InsertChildParentExist
-- Errors handling
exception
when integrity_error then
raise_application_error(errno, errmsg);
end;
/
In a generated trigger script, .DeclInsertChildExist corresponds to
the following definition:
.FOREACH_PARENT()
-- Declaration of InsertChildParentExist constraint for
the parent "[%PQUALIFIER%]%PARENT%"
.DEFINE "CURSOR" "cpk%REFNO%_%.25L:TABLE%"
cursor %CURSOR%(.JOIN("var_%.L26:FK% %.L:COLTYPE%", "",
",", ") is")
select 1
from [%PQUALIFIER%]%PARENT%
where .JOIN("%PK% = var_%.L26:FK%", "and ")
and .JOIN("var_%.L26:FK% is not null", "and ",
"", ";")
.ENDFOR
You define a declaration statement for a template item in the Declaration
page from the template item property sheet. The declaration statement is
automatically inserted in the trigger script when the trigger is generated.
You can use editing tools to insert script items into the template item
declaration.
For a description of the editing tools available to insert script items in a
definition, see section Modifying a template item.
Chapter 8 Triggers and Procedures
PDM User's Guide 443
Defining stored procedures and functions
You can define stored procedures and functions for any DBMS that supports
them.
A stored procedure is a precompiled collection of SQL statements stored
under a name and processed as a unit. Stored procedures are stored within a
database; can be executed with one call from an application; and allow user-
declared variables, conditional execution, and other programming features.
The use of stored procedures can be helpful in controlling access to data
(end-users may enter or change data but do not write procedures), preserving
data integrity (information is entered in a consistent manner), and improving
productivity (statements in a stored procedure only need to be written one
time).
A user-defined function is a form of procedure that returns a value to the
calling environment for use in queries and other SQL statements.
Defining templates for stored procedures and functions
Templates for the creation of stored procedures and functions are defined in
the current DBMS. You can modify these templates.
Modifying the DBMS
When you modify the templates for stored procedures and functions, you
modify the current DBMS. It is recommended that you only edit or modify
a copy of a DBMS that is shipped with PowerDesigner.
To define a template for stored procedures or functions:
1 Select DatabaseEdit Current DBMS.
The DBMS property sheet opens to the General page.
2 Expand the Script node in the DBMS tree view.
Expand the Objects node.
3 Expand the Procedure node.
4 Click the CustomProc entry to edit the stored procedure template.
or
Click the CustomFunc entry to edit the function template.
The Value textbox to the right of the tree view displays the template.
Defining stored procedures and functions
444 PowerDesigner
5 Type changes to the template.
6 Click OK.
Creating stored procedures and functions
You create stored procedures and functions using the structure of templates
defined in the current DBMS.
When you create or modify the definition for a stored procedure or function,
you can insert pre-defined operators, variables, functions and macros into the
procedure or function definition, by clicking on the appropriate tool from the
Insert Script tool bar, and selecting an item from the menu that appears. The
selected script item is inserted at the cursor position in the definition code.
You can use the following tools to insert script items into the procedure or
function definition:
Tool Tooltip Description
Operators Provides logical operators
Functions Provides group, number, string, date,
conversion and other functions
Macros Provides macros to accelerate the creation of
a procedure or function definition
Variables Provides variables for use with operators and
functions
Edit with SQL Editor Opens the SQL Editor dialog box. Provides
object types and available objects to insert in
the procedure or function definition
SQL/XML Wizard Opens the SQL/XML Wizard to build a
SQL/XML query from a table or a view and
insert it in the procedure or function
definition
Insert SQL/XML Macro Opens a dialog box to select a global element
in an XML model open in the workspace with
the SQL/XML extended model definition.
Inserts a SQL/XML macro referencing the
selected element in the procedure or function
definition
For more information on variables, see List of PowerDesigner variables
in chapter Variables in PowerDesigner.
Inserting script
items
Chapter 8 Triggers and Procedures
PDM User's Guide 445
For more information on macros, see Using macros.
For more information on the SQL/XML Wizard, see Using the
SQL/XML Wizard.
You can specify scripts generated before and after the stored procedure
creation statement. This can be done through the Script page of the stored
procedure property sheet. You can use the %PROC% and %FUNC%
variables in these scripts.
There are several ways to create a stored procedure:
From the physical diagram
From the list of procedures
Creating a stored procedure from the physical diagram
You can create a stored procedure or function from the physical diagram.
To create stored procedure from the diagram:
1 Click the Procedure tool.
2 Click an empty space in the diagram. The following symbol appears at
the click position:
3 Right-click the mouse button to release the Procedure tool.
4 Double-click the new procedure or function symbol in the diagram to
display the procedure or function property sheet.
Inserting begin and
end scripts
Defining stored procedures and functions
446 PowerDesigner
5 Type a name and a code for the procedure or function.
6 Click Apply.
The creation of the new procedure or function is committed.
7 Click the Definition tab.
The Definition page appears.
8 Select Procedure from the dropdown list box at the top of the page.
or
Select Function from the dropdown list box at the top of the page.
The template definition appears in the text box.
9 Type the procedure or function definition code in the text box.
Inserting script items
You can insert script items into the definition as follows:
Click in the definition where you want to insert a script item. Click a
script item tool.
Select a script item from the menu.
The script item appears at the click point.
10 <Optional> Click the Script tab.
Chapter 8 Triggers and Procedures
PDM User's Guide 447
The Script page appears. You can define begin and end script for the
procedure or function.
11 Click OK.
Creating a stored procedure from the list of stored procedures
When you create a stored procedure or function from the list, you can choose
to associate a symbol to the procedure or not. To do so you have to select the
check box in the Has Symbol column of the stored procedure or function.
To create a stored procedure or a function:
1 Select ModelProcedures.
The List of Procedures appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a procedure or function name and code.
4 Select or clear the check box in the Has Symbol column.
5 Click Apply.
The creation of the new procedure or function is committed.
6 Click the new procedure or function line.
An arrow appears at the start of the line.
7 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The property sheet for the new procedure or function opens to the
General page.
8 Click the Definition tab.
Defining stored procedures and functions
448 PowerDesigner
The Definition page appears.
9 Select Procedure from the dropdown list box at the top of the page.
or
Select Function from the dropdown list box at the top of the page.
The template definition appears in the text box.
10 Type the procedure or function definition code in the text box.
Inserting script items
You can insert script items into the definition as follows:
Click in the definition where you want to insert a script item. Click a
script item tool.
Select a script item from the menu.
The script item appears at the click point.
11 Click OK in each of the dialog boxes.
Modifying the procedure display preferences
You can modify the following display preferences for a procedure using the
ToolsDisplay Preferences command:
Text display preference When selected, what it displays
Owner Name of procedure owner
Stereotype Stereotype of the procedure
Chapter 8 Triggers and Procedures
PDM User's Guide 449
Attaching a stored procedure to a table
You can attach a stored procedure to a table when your current DBMS
supports stored procedures. This feature lets you update the table or retrieve
information from this table.
For example, the stored procedure TABLE_ADDROW can be attached to a
table in which you need to insert rows.
When you generate an OOM from a PDM, the procedures attached to a table
become operations with the <<procedure>> stereotype in the generated class.
By attaching procedures to tables, you are able to define class operations in
the generated OOM.
When you generate a PDM from an OOM, class operations with the
<<procedure>> stereotype become stored procedures attached to the
generated table. The operation body is generated as a comment in the
procedure definition.
You can attach a table to a procedure from the property sheet of a procedure
or the property sheet of a table.
To attach a stored procedure to a table:
1 Open the table property sheet.
2 Click the Procedures tab to display the Procedures page.
3 Click the Add Objects tool to display an object selection list.
4 Select the stored procedure you want to attach to the table and click OK.
Intermodel
generation
Defining stored procedures and functions
450 PowerDesigner
The stored procedure appears in the list of stored procedures.
5 Click OK.
Chapter 8 Triggers and Procedures
PDM User's Guide 451
Using macros
You can use predefined macros in trigger templates, template items, triggers,
and procedures. Macros perform specific functions.
AKCOLN
Repeats a statement for each alternate key in a table
.AKCOLN("statement","prefix","suffix","last_suffix", "condition")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
condition Alternate key code (if condition argument is left empty the macro
returns a statement for each alternate key in the table)
In a trigger for the table TITLEAUTHOR, the following macro:
message .AKCOLN("'%COLUMN% is an alternate key
column'","", "", "", "AKEY1")
generates the following trigger script:
message 'TA_ORDER is an alternate key column',
Column variable only
For columns, the macro AKCOLN only accepts the variable
%COLUMN%.
Description
Syntax
Example
Using macros
452 PowerDesigner
ALLCOL
Repeats a statement for each column in a table
.ALLCOL("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
In a trigger for the table AUTHOR, the following macro:
.ALLCOL("%COLUMN% %COLTYPE%","",",",";")
generates the following trigger script:
AU_ID char(12),
AU_LNAME varchar(40),
AU_FNAME varchar(40),
AU_BIOGRAPH long varchar,
AU_ADVANCE numeric(8,2),
AU_ADDRESS varchar(80),
CITY varchar(20),
STATE char(2),
POSTALCODE char(5),
AU_PHONE char(12);
DEFINE
Defines a variable and initializes its value.
.DEFINE "variable" "value"
Argument Description
variable Variable name (without % signs)
value Variable value (may include another variable surrounded by %
signs)
In a trigger for the table AUTHOR, the following macro:
.DEFINE "TRIGGER" "T_%TABLE%"
message 'Error: Trigger(%TRIGGER%) of table %TABLE%'
Description
Syntax
Example
Description
Syntax
Example
Chapter 8 Triggers and Procedures
PDM User's Guide 453
generates the following trigger script:
message 'Error: Trigger(T_AUTHOR) of table AUTHOR';
DEFINEIF
Defines a variable and initializes its value if the test value is not null
.DEFINEIF "test_value" "variable" "value"
Argument Description
test_value Value to test
variable Variable name (without % signs)
value Variable value (may include another variable surrounded by %
signs)
For example, to define a variable for a default data type:
%DEFAULT%
.DEFINEIF "%DEFAULT%" "_DEFLT"" "%DEFAULT%"
Add %COLUMN% %DATATYPE% %_DEFLT%
ERROR
Handles errors
.ERROR (errno, "errmsg")
Argument Description
errno Error number
errmsg Error message
.ERROR(-20001, "Parent does not exist, cannot insert
child")
Description
Syntax
Example
Description
Syntax
Example
Using macros
454 PowerDesigner
FKCOLN
Repeats a statement for each foreign key column in a table
.FKCOLN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
In a trigger for the table TITLEAUTHOR, the following macro:
message .FKCOLN("'%COLUMN% is a foreign key
column'","",",",";")
generates the following trigger script:
message 'AU_ID is a foreign key column,
TITLE_ISBN is a foreign key column;'
Column variable only
For columns, the macro FKCOLN only accepts the variable
%COLUMN%.
FOREACH_CHILD
Repeats a statement for each parent-to-child reference in the current table
fulfilling a condition
.FOREACH_CHILD ("condition")
"statement"
.ENDFOR
Argument Description
condition Reference condition (see below)
statement Statement to repeat
Condition Selects
UPDATE RESTRICT Restrict on update
Description
Syntax
Example
Description
Syntax
Chapter 8 Triggers and Procedures
PDM User's Guide 455
Condition Selects
UPDATE CASCADE Cascade on update
UPDATE SETNULL Set null on update
UPDATE SETDEFAULT Set default on update
DELETE RESTRICT Restrict on delete
DELETE CASCADE Cascade on delete
DELETE SETNULL Set null on delete
DELETE SETDEFAULT Set default on delete
In a trigger for the table TITLE, the following macro:
.FOREACH_CHILD("DELETE RESTRICT")
-- Cannot delete parent "%PARENT%" if children still
exist in "%CHILD%"
.ENDFOR
generates the following trigger script:
-- Cannot delete parent "TITLE" if children still exist
in "ROYSCHED"
-- Cannot delete parent "TITLE" if children still exist
in "SALE"
-- Cannot delete parent "TITLE" if children still exist
in "TITLEAUTHOR"
FOREACH_COLUMN
Repeats a statement for each column in the current table fulfilling a condition
.FOREACH_COLUMN ("condition")
"statement"
.ENDFOR
Argument Description
condition Column condition (see below)
statement Statement to repeat
Condition Selects
empty All columns
PKCOLN Primary key columns
FKCOLN Foreign key columns
Example
Description
Syntax
Using macros
456 PowerDesigner
Condition Selects
AKCOLN Alternate key columns
NMFCOL Non-modifiable columns (columns that have Cannot Modify
selected as a check parameter)
INCOLN Triggering columns (primary key columns, foreign key columns;
and non-modifiable columns)
In a trigger for the table TITLE, the following macro:
.FOREACH_COLUMN("NMFCOL")
-- "%COLUMN%" cannot be modified
.ENDFOR
generates the following trigger script:
-- "TITLE_ISBN" cannot be modified
-- "PUB_ID" cannot be modified
FOREACH_PARENT
Repeats a statement for each child-to-parent reference in the current table
fulfilling a condition
.FOREACH_PARENT ("condition")
"statement"
.ENDFOR
Argument Description
condition Reference condition (see below)
statement Statement to repeat
Condition Selects references defined with ...
empty All references
FKNULL Non-mandatory foreign keys
FKNOTNULL Mandatory foreign keys
FKCANTCHG Non-modifiable foreign keys
Example
Description
Syntax
Chapter 8 Triggers and Procedures
PDM User's Guide 457
In a trigger for the table SALE, the following macro:
.FOREACH_PARENT("FKCANTCHG")
-- Cannot modify parent code of "%PARENT%" in child
"%CHILD%"
.ENDFOR
generates the following trigger script:
-- Cannot modify parent code of "STORE" in child "SALE"
-- Cannot modify parent code of "TITLE" in child "SALE"
INCOLN
Repeats a statement for each primary key column, foreign key column,
alternate key column, or non-modifiable column in a table.
.INCOLN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
In a trigger for the table TITLE, the following macro:
.INCOLN("%COLUMN% %COLTYPE%","",",",";")
generates the following trigger script:
TITLE_ISBN char(12),
PUB_ID char(12);
Example
Description
Syntax
Example
Using macros
458 PowerDesigner
JOIN
Repeats a statement for column couple in a join.
.JOIN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
In a trigger for the table TITLE, the following macro:
where .JOIN("%PK%=%FK%", " and", "", ";")
message 'Reference %REFR% links table %PARENT% to
%CHILD%'
generates the following trigger script:
message 'Reference TITLE_PUB links table PUBLISHER to
TITLE
Primary key, alternate key, and foreign keys variables only
For columns, the macro JOIN only accepts the variables %PK%, %AK%,
and %FK%.
NMFCOL
Repeats a statement for each non-modifiable column in a table. Non-
modifiable columns have Cannot Modify selected as a check parameter.
.NMFCOL("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
Description
Syntax
Example
Description
Syntax
Chapter 8 Triggers and Procedures
PDM User's Guide 459
In a trigger for the table TITLE, the following macro:
.NMFCOL("%COLUMN% %COLTYPE%","",",",";")
generates the following trigger script:
TITLE_ISBN char(12),
PUB_ID char(12);
PKCOLN
Repeats a statement for each primary key column in a table
.PKCOLN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
In a trigger for the table TITLEAUTHOR, the following macro:
message .PKCOLN("'%COLUMN% is a primary key
column'","",",",";")
generates the following trigger script:
message 'AU_ID is a primary key column',
'TITLE_ISBN is a primary key column';
Column variable only
For columns, the macro PKCOLN only accepts the variable
%COLUMN%.
CLIENTEXPRESSION and SERVEREXPRESSION
Uses the client and/or server expression of a business rule in the trigger
template, template item, trigger, and procedure script.
.CLIENTEXPRESSION(code of the business rule)
.SERVEREXPRESSION(code of the business rule)
Example
Description
Syntax
Example
Description
Syntax
Using macros
460 PowerDesigner
The business rule ACTIVITY_DATE_CONTROL has the following server
expression:
activity.begindate < activity.enddate
In a trigger based on template AfterDeleteTrigger, you type the following
macro in the Definition page of the trigger:
.SERVEREXPRESSION(ACTIVITY_DATE_CONTROL)
This generates the following trigger script:
activity.begindate < activity.enddate
end
SQLXML
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
appears in the definition code, with the code of the XML model
(optional) and the code of the global element
Example
Description
Chapter 8 Triggers and Procedures
PDM User's Guide 461
The Macros tool, where you select .SQLXML( ) in the dropdown
listbox. The SQLXML macro appears 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
After generation, the SQLXML macro is replaced by the SQL/XML query of
the global element.
.SQLXML(code of an XML model::code of a global element)
Note: the code of an XML model is optional.
In a trigger for the table EMPLOYEE, the following macro:
.SQLXML(CorporateMembership::DEPARTMENT)
generates the following trigger script:
select XMLELEMENT( NAME "Department", XMLATTRIBUTES
(DEPNUM,DEPNAME),
(select XMLAGG ( XMLELEMENT( NAME "Employee",
XMLATTRIBUTES (DEPNUM,EMPID,FIRSTNAME,LASTNAME)) )
from EMPLOYEE
where DEPNUM = DEPNUM))
from DEPARTMENT
Syntax
Example
Using the SQL/XML Wizard
462 PowerDesigner
Using the SQL/XML Wizard
You can use the SQL/XML Wizard to insert a SQL/XML query in the
definition of a trigger, a stored procedure or a function. With the SQL/XML
Wizard, you select tables and views from a PDM to build a mapped XML
model. This silent XML model (it does not appear in the workspace) is used
to generate SQL/XML queries from global elements. These SQL/XML
queries allow you to store or retrieve data, in an XML format, from relational
databases supporting SQL/XML.
During the SQL/XML Wizard process, you can perform the following
actions:
Generate columns as elements or attributes
Generate tables and views as elements by drag and drop or the
contextual menu
Display tables, views or columns property sheets
Add Sequence, Choice or All group particles
Rename elements or attributes
Add new elements or attributes without mapping
Delete elements, attributes or group particles
To insert a SQL/XML query in the definition of a trigger:
1 In the trigger property sheet, select the Definition page and position the
cursor in the trigger definition where you want to insert the SQL/XML
query.
2 In the toolbar of the Definition page, click the SQL/XML Wizard tool.
3 Select tables and views and click Next.
4 Build an XML hierarchy and click Next.
5 In the Query page, click Finish.
These different actions are detailed in the following sections.
Note: The trigger used in the following sections is defined in project.pdm, a
PDM from the PowerDesigner Examples library.
Chapter 8 Triggers and Procedures
PDM User's Guide 463
Launching the SQL/XML Wizard
Double-click the trigger item in the Browser tree view to display its property
sheet.
Click the Definition tab to display the Definition page.
Using the SQL/XML Wizard
464 PowerDesigner
Click in the trigger definition and position the cursor where you want to
insert a SQL/XML query.
In the toolbar of the Definition page, click the SQL/XML Wizard tool.
Selecting tables and views
The SQL/XML Wizard opens to the Tables and Views Selection page.
Chapter 8 Triggers and Procedures
PDM User's Guide 465
All tables and views are selected by default. Click the Deselect All tool and
select the tables and views you want to generate into XML elements.
Click Next.
Building an XML hierarchy
In the XML Hierarchy Design page, you build the structure of an XML
model.
The XML model starts with the predefined Root element to which all first
generation elements must be linked.
In the Create column option, click the Element radio button if you want to
create columns as child elements, otherwise they are created as attributes.
Click a table name in the left panel and drag and drop it to the Root element
in the right panel.
Using the SQL/XML Wizard
466 PowerDesigner
An element appears in the right panel, linked to the Root element via a
sequence group particle, with the table name and the attributes or child
elements corresponding to the table columns.
For more information on building an XML hierarchy, see Generating an
XML model via the XML Builder Wizard, in chapter Generating from a
PDM.
Click Next.
Chapter 8 Triggers and Procedures
PDM User's Guide 467
Inserting the SQL/XML query in the trigger definition
The Query page displays the SQL/XML query.
Click Finish.
The SQL/XML query appears in the definition code at the cursor position.
Using the SQL/XML Wizard
468 PowerDesigner
<optional> Add code to complete the SQL/XML query.
Click OK.
The trigger definition is modified with the insertion of the SQL/XML query.
Chapter 8 Triggers and Procedures
PDM User's Guide 469
Generating triggers and procedures
You can create or modify database triggers and procedures directly using an
ODBC driver or indirectly using a script.
Generation parameters indicate the following:
Triggers and procedures to generate
Commands to generate in the trigger script
In both cases, the trigger generation commands are saved in a script file. You
must always provide the following information about the script file:
Parameter Description
DBMS Current DBMS
Directory Destination directory for the script file
File Name Destination filename for the script file
Generation Type Trigger generation by script or using ODBC
One File Only When selected creates one script file, instead of a separate
script file for each trigger
Generating triggers and procedures
470 PowerDesigner
Trigger and procedure creation parameters
The availability of generation parameters depends on the current DBMS.
Unavailable parameters display in gray and can not be selected.
The tables below indicate the generation that results from the selection of
generation parameters.
Parameter Resulting generation command
Create trigger Create trigger
Comment Generate the trigger comment
Drop trigger Drop trigger
For insert Generate insert triggers
For update Generate update triggers
For delete Generate delete triggers
Others Generate specific event triggers when the trigger supports
multiple events (all appropriate event check boxes need to be
selected)
Parameter Resulting generation command
Create procedure Create procedure
Begin script Generate begin script before procedure creation
End script Generate end script after procedure creation
Comment Generate the procedure comment
Permission Generate the permission statement for a given user during
procedure creation
Drop procedure Drop procedure
Generation script options
Script options indicate the format of generation scripts for triggers and
procedures.
Referential integrity options indicate whether to generate referential integrity
as a trigger or as a declarative statement.
Trigger creation
parameters
Procedure creation
parameters
Chapter 8 Triggers and Procedures
PDM User's Guide 471
The availability of these options depends on the current database.
Unavailable options display in gray and you cannot select them.
Option Result of selection
Windows (ANSI) Script uses ANSI character set
DOS (OEM) Script uses DOS character set
Uppercase Script contains all uppercase characters
Lowercase Script contains all lowercase characters
Mixed case Script contains lowercase and uppercase characters
No accent Non-accented characters replace accented characters in
script
Database prefix Table names in the script are prefixed by their database
names
Owner prefix Table names in the script are prefixed by their owner names.
For those DBMS that support sequence owners, this option
also allows you to prefix the sequence names by their owner
names
Title Each section of the script includes commentary in the form
of titles (for example, Database Name: TUTORIAL)
Check model Check the PDM before generating the database or script,
and stop generation if an error is found
Script preview Allows you to preview the generation script in the Execute
Query dialog box. In this dialog box, you can click Execute
to start ODBC generation, or Close to cancel generation.
This check box is available when the ODBC generation
radio button is selected
Automatic archive Model is automatically archived after each generation
Parameter Resulting generation command
Standard Generate standard error messages
User-defined Generate user-defined error messages
Error message
parameters
Generating triggers and procedures
472 PowerDesigner
Object selection parameters
You select tables for trigger generation, and procedures from the Selection
page.
You can display in the list, tables or procedures in the current model, or in
individual packages contained in the model.
If you select the Include Sub-packages tool, you can display in the list either
all tables and procedures in the current model, or in a selected package.
You have the following selection options:
Parent
object
Include Sub-
packages Displays
Model Selected All tables or procedures in model including all
those contained in packages and sub-packages
Model Not selected All tables or procedures in model except those
contained in packages and sub-packages
Package Selected All tables or procedures contained in package
including all those contained in sub-packages
Package Not selected All tables or procedures in package except those
contained in sub-packages
You can apply a filter to list only tables belonging to a particular owner. If
you select the Owner <NONE> you display all the tables belonging to all
owners for the selected model or package.
Objects graphically selected in diagram
Objects graphically selected in a diagram can be automatically selected for
generation by clicking the Use Graphical Selection button in the Selection
page tool bar.
Defining a generation order for stored procedures
You can use extended dependencies to define an order in the generation of
stored procedures.
Listing objects
contained in a
model or package
Listing objects for
an owner
Chapter 8 Triggers and Procedures
PDM User's Guide 473
Extended dependencies are free links between PDM objects. These links help
to make object relationships clearer between model objects. Usually, these
links are not interpreted and checked by PowerDesigner as they are meant to
be used for documentation purposes only. However, if you assign the
<<DBCreateAfter>> stereotype to an extended dependency between stored
procedures, it will be analyzed during generation.
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.
If you create a reflexive and/or circular set of extended dependencies with the
<<DBCreateAfter>> stereotype, an error message appears 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.
Circular extended
dependencies
Generating triggers and procedures
474 PowerDesigner
A publisher may decide to sell certain books at a reduced rate (15%) when a
customer's 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.
To define a generation order for stored procedures:
1 Select ModelProcedures to display the List of Stored Procedures.
2 Select a dependent stored procedure in the list and click the Properties
tool.
The property sheet of the stored procedure appears.
3 Click the Extended Dependencies tab to display the Extended
Dependencies page.
4 Click the Add Objects tool.
Example
Chapter 8 Triggers and Procedures
PDM User's Guide 475
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 dropdown
listbox.
8 Click OK.
The influent stored procedure appears 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 General Features Guide.
Generating triggers and procedures
476 PowerDesigner
Generating a trigger or procedure creation script
PowerDesigner generates trigger and procedure scripts that you can run in
your DBMS environment.
To generate a trigger and procedure script:
1 Select DatabaseGenerate Triggers and Procedures.
The Triggers and Procedures Generation dialog box appears.
2 Type a directory name in the Directory box.
3 Type a filename in the File Name box.
4 Select the Script Generation radio button.
5 Select generation parameters.
6 Click the Options tab.
The Options page appears.
7 Select script options.
Chapter 8 Triggers and Procedures
PDM User's Guide 477
8 Click the Selection tab.
The Selection page appears.
9 Select a model from the Model dropdown list.
10 If you want to generate a trigger script for tables owned by a particular
owner, select an owner from the Owner dropdown list.
or
If you want to generate a trigger script for tables owned by all owners in
the PDM, select None from the Owner dropdown list.
11 Click the Table or Procedure tab at the bottom of the page.
The Table or Procedure page appears listing the tables or procedures
available in the selected model or package.
12 Select check boxes for tables containing triggers or procedures to
generate.
or
Clear check boxes for tables containing triggers or procedures to
generate.
13 Click OK.
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 appears. It lists the file path of the generated script file.
14 Click the Close button to close the Result box.
or
If you want to edit the script, click the file path in the result box and
click the Edit button.
The script opens up in a text editor.
Generating triggers and procedures
478 PowerDesigner
Creating triggers directly in a database
PowerDesigner can generate triggers directly. To do so, you must connect to
a data source via an ODBC driver.
To create triggers directly in a database:
1 Select DatabaseGenerate Triggers and Procedures.
The Triggers and Procedures Generation dialog box appears.
2 Type a filename in the File Name box.
3 Type a directory name in the Directory box.
4 Select the ODBC Generation radio button.
5 Select generation parameters.
6 Click the Options tab.
The Options page appears.
7 Select script options. You can choose to preview the script in the
Execute Query dialog box by selecting the Script Preview check box.
8 Click the Selection tab.
The Selection page appears.
9 Select a model from the Model dropdown list.
10 If you want to generate a trigger script for tables owned by a particular
owner, select an owner from the Owner dropdown list.
or
If you want to generate a trigger script for tables owned by all owners in
the PDM, select None from the Owner dropdown list.
11 Click the Table or Procedure tab at the bottom of the page.
The Table or Procedure page appears listing the tables or procedures
available in the selected model or package.
12 Select check boxes for tables containing triggers or procedures to
generate.
or
Clear check boxes for tables containing triggers or procedures to
generate.
13 Click OK.
Chapter 8 Triggers and Procedures
PDM User's Guide 479
A dialog box asks you to identify a data source and connection
parameters.
14 Select a machine data source from the dropdown list box.
or
Select a file data source from the dropdown list box.
15 Type your user ID and password.
16 Click Connect. If prompted by your data source, enter additional
connection parameters.
A message window shows the progress of the generation process.
17 Click OK.
Creating and generating user-defined error messages
You can create user-defined error messages. The error messages are stored in
a message table which you need to create in your database. When you select
trigger generation parameters, you can choose to generate an error message
from this table.
In the generated trigger script, the message table is called in a SELECT
command. If an error number in the script corresponds to an error number
value in the table column, then the standard error message is replaced by the
message defined in the table.
Generating triggers and procedures
480 PowerDesigner
Creating a message table
You create a message table which stores error message information.
To create a message table:
1 Create a table with columns to store the following information:
Column to store Description
Error number Number of the error message that is referenced in
the trigger script
Message text Text of message
2 Generate the table in your database.
3 Select DatabaseExecute SQL.
A dialog box asks you to identify a data source and connection
parameters.
4 Select a data source and fill in connection parameters.
5 Click Connect.
An SQL query editor box appears.
6 Type an SQL statement to insert a message number and text in the
appropriate columns. You can use the following format for example:
insert into table values (error number,'error message')
insert into ERR_MSG values (1004,'The value that you are
trying to insert does not exist in the
referenced table')
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.
Chapter 8 Triggers and Procedures
PDM User's Guide 481
Generating a user-defined error message
You can choose to generate a user-defined error message from the trigger
generation parameters box.
To generate a user-defined error message:
1 Select ToolsRebuild ObjectsRebuild Triggers.
The Rebuild Triggers dialog box appears.
2 Click the Error Messages tab.
The Error Messages page appears.
3 Select the User-defined radio button.
4 Type the name of the table that contains the error message in the
Message Table Name 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.
7 Click the General tab and select the mode and triggers to create.
Generating triggers and procedures
482 PowerDesigner
8 Click the Selection tab and select the tables for which you want to create
triggers.
For more information on rebuilding triggers, see section Creating
triggers automatically.
9 Click OK.
The trigger rebuilding process is shown in the Output window.
Select DatabaseGenerate Triggers and Procedures.
The Trigger and Procedure Generation dialog box appears.
10 Select generation parameters as required.
11 Click OK.
For information on selecting trigger generation parameters, see
section Generating triggers and procedures.
PDM User's Guide 483
C H A P T E R 9
Web services in databases
This chapter describes how to create, generate and reverse engineer Web
services in the following databases:
Sybase Adaptive Server Anywhere 9
IBM DB2 v8.1
Topic Page
Defining Web services 484
Generating Web services 502
Reverse engineering Web services 516
About this chapter
Contents
Defining Web services
484 PowerDesigner
Defining Web services
Web services are applications stored on Web servers that you can access
remotely through standard Web protocols (HTTP, SOAP) and data formats
(HTML, XML), whatever the systems and programming languages.
Web services can be used to simplify access to databases. If you use Web
services to query databases, you no longer need drivers to communicate with
those databases.
In the following example, you can see the result of an HTTP request for a
database Web service:
Web services are made of a set of operations. Each operation contains a SQL
query for retrieving data from a database.
In SOAP requests, queries are encapsulated into services, whereas in HTTP
requests, operations are invoked directly. In PowerDesigner, you design Web
services for both protocols.
Web services in PowerDesigner
In PowerDesigner, Web services are made of Web operations which
themselves contain Web parameters and Result columns:
Web operations specify the SQL statements used to retrieve data from
databases
Chapter 9 Web services in databases
PDM User's Guide 485
Web parameters are the parameters which appear in the SQL
statements
Result columns are the columns in which the results are displayed
These objects have no symbol, but they appear in the Browser tree view.
This structure is compatible with the definition of Web services in Sybase
ASA 9 and IBM DB2 v8.1.
Web services in Sybase ASA 9
In Sybase ASA 9, there are five types of Web services:
Type of Web service Description
RAW The result set of the SQL statement or procedure is
sent to the client without any additional formatting
XML The result set of the SQL statement or procedure is
assumed to be XML. If it is not, then the result set is
converted to XML RAW format
HTML The result set of the SQL statement or procedure is
formatted as an HTML document with a table
containing the rows and columns
SOAP The request must be a valid SOAP (Simple Object
Access Protocol) request, and the result set is
formatted as a SOAP response
DISH A DISH service acts as a proxy for a group of SOAP
services and generates a WSDL (Web Services
Description Language) file for each of its SOAP
services.
When you create a DISH service, you must specify a
prefix name for all the SOAP services to which
the DISH service applies. In PowerDesigner, the
prefix name is defined in the Extended Attributes
page of a Web service property sheet
Web services
types
Defining Web services
486 PowerDesigner
In PowerDesigner, the type of Web service is defined in the Service Type
property of a Web Service property sheet (Only available with ASA 9).
Caution
The SOAP type is not available in the Service Type dropdown listbox.
SOAP Web services are handled in PowerDesigner as Web operations of
DISH Web services.
A Web service invoked in an HTTP request can have a RAW, HTML or
XML format.
When several Web services concern the same table in a database, their name
usually starts with the name of the table, followed by a slash and a specific
name identifying the query (e.g. Customer/List, Customer/Name). In that
case, the name of the table is called the local path. In PowerDesigner, the
local path is defined in the General page of a Web service property sheet.
Web services in ASA 9 with the same local path are considered in
PowerDesigner as Web operations of the same Web service with the local
path name.
A Web service invoked in a SOAP request can have a SOAP or a DISH
format.
A SOAP Web service in ASA 9 is considered as a Web operation of a DISH
Web service in PowerDesigner.
When you create a Web service in Sybase ASA 9, you must type a SQL
statement to select which data you want to retrieve from the database. For
DISH Web services, SQL statements are defined in the SOAP Web services
bearing their prefix name.
In PowerDesigner, you define the SQL statement of a Web service in the
Implementation page of its Web operation(s).
Web services in IBM DB2 v8.1
PowerDesigner supports Web services for IBM DB2 v8.1.
In IBM DB2, Web services are defined by Document Access Definition
Extension (DADX) files.
A DADX file specifies a Web service through a set of operations defined by
SQL statements or Document Access Definition (DAD) files.
A DAD file specifies the mapping between XML elements and DB2 tables.
HTTP Web
services
SOAP Web
services
Implementation
(SQL statement)
DADX files
Chapter 9 Web services in databases
PDM User's Guide 487
For more information on DAD files, see Generating a DAD file for
IBM DB2, in chapter Exchanging data with databases supporting XML, in
the XML Model Users Guide.
In PowerDesigner, you can define Web services for IBM DB2 and generate
their corresponding DADX file. (See Generating Web services for IBM DB2
v8.1)
There are five types of Web operations in IBM DB2:
Type of Web operation Description
call To invoke a stored procedure in a database
query To retrieve relational data using a SQL statement
retrieveXML To retrieve an XML document from relational
data
storeXML To store an XML document as relational data
update To execute a SQL statement with optional
parameters
For more information on Web operations types, see Web operation
general properties in Defining Web operations properties.
Defining Web services properties
To display a Web service property sheet, you can:
Double-click its name or icon in the Browser
Select ModelWeb Services, to display the List of Web Services.
or
Right-click the model name or icon in the Browser, and select List
ofWeb Services
Web operations
types
Defining Web services
488 PowerDesigner
The List of Web Services appears.
Double-click a line number in the list to display a Web service property
sheet.
Web service general properties
The General page of a Web service property sheet displays the following
properties:
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
Code Code of the Web service
Comment Descriptive label for the Web service
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
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
Chapter 9 Web services in databases
PDM User's Guide 489
Property Description
Service type Only available with ASA 9.
Select DISH if the Web service contains SOAP Web
operations.
Select HTML if you want the result of the SQL statement or
procedure to be formatted as an HTML document (with a
table containing rows and columns).
Select RAW if you want the result of the SQL statement or
procedure to be sent without any additional formatting.
Select XML if you want the result of the SQL statement or
procedure to be sent in XML. By default, the result is
converted into XML RAW format
Web service operations list
A Web operation is a child object of a Web service. It allows you to define a
SQL statement for a Web service and to display its parameters and result
columns.
The Operations page of a Web service property sheet displays a list of Web
operations with a set of properties.
From this list, you can create, delete or open the property sheet of a Web
operation, as well as type its SQL statement in the Implementation column.
Web service security properties
Only available with ASA 9.
The Security page of a Web service or a Web operation property sheet
displays the following properties:
Property Description
Secured connection If selected, only HTTPS connections are accepted. If
cleared, both HTTP and HTTPS connections are
accepted
Required authorization If selected, all users must provide a name and a
password. When cleared, a single user must be
identified
Connection User When authorization is required, you can select
<None> or a list of user names. When authorization is
not required, you must select a user name. Default
value is <None>, which means all users are granted
access
Defining Web services
490 PowerDesigner
Web service namespaces list
Only available with IBM DB2.
The Namespaces page of a Web service property sheet displays a list of
namespaces with their prefix and URI.
An XML Schema can then be specified where elements and data types used
in Web parameters and result columns are defined.
Creating a Web service
You can create a Web service:
From the Browser tree view
From the List of Web Services in the Model menu
Caution
Check that your PDM is targeted with Sybase AS Anywhere 9 or IBM
DB2 UDB 8.x Common Server.
Some properties are specific to the target DBMS.
The following procedure is set with ASA 9, but it also applies to IBM DB2.
To create a Web service from the List of Web Services:
1 In the menu bar, select ModelWeb Services.
The List of Web Services appears.
Chapter 9 Web services in databases
PDM User's Guide 491
2 Click the Add a Row tool to create a new line in the list of Web services.
3 Click Apply.
4 Click the Properties tool to display the Web service property sheet.
5 Type a name and a code for the Web service.
Defining Web services
492 PowerDesigner
6 <Only with ASA 9> Select a type for the Web service in the Service type
dropdown listbox.
7 Click OK in the Web service property sheet.
8 Click OK in the List of Web Services.
Defining Web operations properties
A Web operation is a child object of a Web service. It allows you to define
the SQL statement of a Web service and to display its parameters and result
columns.
To display a Web operation property sheet, you can:
Double-click its name or icon in the Browser
In the menu bar, select ModelWeb Operations, to display the List of
Web Operations.
or
Right-click the model name or icon in the Browser, and select List
ofWeb Operations
Chapter 9 Web services in databases
PDM User's Guide 493
The List of Web Operations appears.
Double-click a line number in the list to display a Web operation
property sheet.
Web operation general properties
The General page of a Web operation property sheet displays the following
properties:
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
Code Code of the Web operation
Comment Descriptive label for the Web operation
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Web Service Code of the Web service containing the Web operation.
You can click the Properties tool (beside the Web Service
box) to display the Web service property sheet
Defining Web services
494 PowerDesigner
Property Description
Operation Type Only available with IBM DB2.
Select call if you want to invoke a stored procedure with
parameters and result columns for the Web operation.
Select query if you want the Web operation to retrieve
relational data using the SQL select statement in the
Implementation page.
Select retrieveXML if you want the Web operation to
retrieve 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.
Select storeXML if you want the Web operation to store an
XML document as relational data. The mapping of
XML data to relational data is defined by a DAD file,
with RDB as MappingType.
Select update if you want the Web operation to execute the
SQL update statement with optional parameters.
Parameters can be created from the Parameters page in
the Web operation property sheet
Web operation parameters list
The Parameters page of a Web operation property sheet displays a list of
Web parameters with a set of properties.
For example:
Chapter 9 Web services in databases
PDM User's Guide 495
These parameters are part of the SQL statement defined in the
Implementation page of a Web operation property sheet. They can be created
from the grid, before generating a Web service, or reverse engineered from a
Web service (Only with ASA 9).
Click the Add a Row tool, or the Insert a Row tool, to customize the
parameters that will result from the generation of the Web service.
Click the Add Parameters from SQL Implementation tool to display the
parameters resulting from the reverse engineering of the Web service (Only
with ASA 9).
Web operation implementation property
The Implementation page of a Web operation property sheet allows you to
type a SQL statement for the Web service. You can use the following tools
to help you type the SQL statement:
Tool Tooltip Description
Operators Provides logical operators
Functions Provides group, number, string, date, conversion
and other functions
Macros Provides macros to accelerate the creation of a
SQL statement
Variables Provides variables for use with operators and
functions
Edit with SQL
Editor
Opens the SQL Editor dialog box. Provides object
types and available objects to insert in the SQL
statement
SQL/XML
Wizard
Opens the SQL/XML Wizard to build a
SQL/XML query from a table or a view, and
insert it in the SQL statement
Insert SQL/XML
Macro
Opens a dialog box to select a global element in
an XML model open in the workspace with the
SQL/XML extended model definition. Inserts a
SQLXML macro referencing the selected element
in the SQL statement
Defining Web services
496 PowerDesigner
For example:
Web operation result columns list
The Result Columns page of a Web operation property sheet displays a list of
columns with a set of properties.
For example:
Chapter 9 Web services in databases
PDM User's Guide 497
These columns are the columns in which the results are displayed.
Click the Add a Row tool, or the Insert a Row tool, to add or insert columns
that will result from the execution of the Web service.
Click the Add Result Columns from Executing SQL Statement tool to
display the columns resulting from the execution of the SQL statement in the
database.
Web operation security properties
Only available with ASA 9.
The Security page of a Web operation property sheet displays the following
properties:
Property Description
Secured connection If selected, only HTTPS connections are accepted. If
cleared, both HTTP and HTTPS connections are
accepted
Required authorization If selected, all users must provide a name and a
password. When cleared, a single user must be
identified
Connection User When authorization is required, you can select
<None> or a list of user names. When authorization is
not required, you must select a user name. Default
value is <None>, which means all users are granted
access
Creating a Web operation
A Web operation is a child object of a Web service. It can only be created
from a Web service in the Browser or from a Web service property sheet.
You cannot create a Web operation from the List of Web Operations in the
Model menu.
Caution
Check that your PDM is targeted with Sybase AS Anywhere 9 or IBM
DB2 UDB 8.x Common Server.
Some properties are specific to the target DBMS.
Defining Web services
498 PowerDesigner
The following procedure is set with IBM DB2, but it also applies to ASA 9.
To create a Web operation from the Browser:
1 Right-click a Web service in the Browser and select NewWeb
Operation in the contextual menu.
The Web operation property sheet appears.
2 Type a name and a code for the Web operation.
Chapter 9 Web services in databases
PDM User's Guide 499
3 <Only with IBM DB2> Select a type for the Web operation in the Operation
Type dropdown listbox.
4 Click the Implementation tab to display the Implementation page.
5 Type a SQL statement for the Web operation. You can use the tools from
the Insert Script toolbar.
Defining Web services
500 PowerDesigner
6 Click OK.
The new Web operation appears in the Browser under the selected Web
service.
Defining Web parameters general properties
Web parameters are child objects of Web operations. They are part of the
SQL statement defined in the Implementation page of a Web operation
property sheet. They are listed in the Parameters page of a Web operation
property sheet. (See Web operation parameters list)
To display a Web parameter property sheet, you can:
Double-click its name or icon in the Browser
Double-click a line number in the Parameters page of a Web operation
property sheet
The General page of a Web parameter property sheet displays the following
properties:
Property Description
Name Name of the Web parameter
Code Code of the Web parameter
Comment Descriptive label for the Web parameter
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Web Operation Name of the Web operation containing the Web parameter
Parameter Type Select in if you want the Web parameter to be an input
parameter. Select in/out if you want the Web parameter to
be both an input and output parameter. Select out if you
want the Web parameter to be an output parameter
Data Type Only available with IBM DB2.
Select an XML schema data type from the dropdown
listbox, 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 Only available with IBM DB2.
Checked and greyed when a global element is attached to a
Web parameter
Chapter 9 Web services in databases
PDM User's Guide 501
Defining result columns general properties
Result columns are sub-objects of Web operations. They are part of the SQL
statement defined in the Implementation page of a Web operation property
sheet. They belong to a table in the target database. They are listed in the
Result Columns page of a Web operation property sheet. (See Web operation
result columns list)
To display a result column property sheet, you can:
Double-click its name or icon in the Browser
Double-click a line number in the Result Columns page of a Web
operation property sheet
The General page of a result column property sheet displays the following
properties:
Property Description
Name Name of the result column
Code Code of the result column
Comment Descriptive label for the result column
Data Type Only available with IBM DB2.
Select an XML schema data type from the dropdown
listbox, 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 Only available with IBM DB2.
Checked and greyed when a global element is attached to a
result column
Generating Web services
502 PowerDesigner
Generating Web services
You generate Web services in order to implement them on target databases.
PowerDesigner allows you to generate Web services for Sybase ASA 9 and
IBM DB2 v8.1.
Generating Web services for Sybase ASA 9
You can create or modify Web services in Sybase ASA 9, directly using an
ODBC driver or indirectly using script files.
Generation parameters are set in the Web services page of the Triggers and
Procedures Generation dialog box:
Parameter Description
Create web service To create Web services
Comment To add the comments from the Web services property
sheet to the generated Web services
Drop web service To delete existing Web services and replace them with
generated Web services
Generating script files for Web services in ASA 9
You can generate script files to create or drop Web services in ASA 9.
The following procedure assumes you have at least one Web service defined
for ASA 9.
To generate script files for Web services in ASA 9:
1 In the menu bar, select DatabaseGenerate Triggers & Procedures.
Chapter 9 Web services in databases
PDM User's Guide 503
The Triggers and Procedures Generation dialog box appears.
2 Click the Select a Path button, beside the Directory box, to select a path
for the generated script files.
3 Type a file name in the File name box.
4 <optional> Clear the One file only check box if you want a script file for
each Web service.
5 Select the Script generation radio button.
6 Click the Web services tab.
Generating Web services
504 PowerDesigner
The Web services page appears.
7 Select the generation parameters.
8 Click the Options tab.
The Options page appears.
9 Select script options.
10 Click the Selection tab.
The Selection page appears.
11 Select a model from the Model dropdown listbox.
12 Click the Tables tab at the bottom of the page.
The Tables page appears listing the tables available in the selected
model.
13 Select the tables that need to be generated with the Web services.
14 Click the Web Services tab at the bottom of the page.
Chapter 9 Web services in databases
PDM User's Guide 505
The Web Services page appears with the list of Web services available
in the selected model.
15 Select the Web services for which you want to generate a script file.
16 Click OK.
The Result dialog box appears with the paths of the generated script
files.
Generating Web services
506 PowerDesigner
17 Select the path of a script file and click Edit.
The script file appears in the editor window.
18 Click Close in the Result dialog box.
You can now use the script files to create or modify Web services in ASA 9.
Generating Web services directly in ASA 9
You can generate Web services directly in ASA 9. To do so, you must
connect to a data source in ASA 9 via an ODBC driver.
The following procedure assumes you have at least one Web service defined
for ASA 9.
To generate Web services directly in ASA 9:
1 In the menu bar, select DatabaseGenerate Triggers & Procedures.
Chapter 9 Web services in databases
PDM User's Guide 507
The Triggers and Procedures Generation dialog box appears.
2 Click the Select a Path button, beside the Directory box, to select a path
for the script file.
3 Type a file name in the File name box.
4 Select the ODBC generation radio button.
5 Click the Web services tab.
Generating Web services
508 PowerDesigner
The Web services page appears.
6 Select the generation parameters.
7 Click the Options tab.
The Options page appears.
8 Select script options.
9 Click the Selection tab.
The Selection page appears.
10 Select a model from the Model dropdown listbox.
11 If you want to generate Web services for tables owned by a particular
owner, select an owner from the Owner dropdown listbox. Select
<None> for all owners.
12 Click the Tables tab at the bottom of the page.
The Tables page appears listing the tables available in the selected
model.
13 Select the tables that need to be generated with the Web services.
Chapter 9 Web services in databases
PDM User's Guide 509
14 Click the Web Services tab at the bottom of the page.
The Web Services page appears with the list of Web services available
in the selected model.
15 Select the Web services you want to generate in ASA 9.
16 Click OK.
Generating Web services
510 PowerDesigner
The Connect to an ODBC Data Source dialog box appears.
17 Select the Machine data source radio button, then a data source from
the dropdown listbox.
or
Select the File data source radio button, then click the Select a File
DSN button to browse to the directory containing the .DSN file.
18 Type your user ID and password.
19 Click Connect. If prompted by your data source, enter additional
connection parameters.
Chapter 9 Web services in databases
PDM User's Guide 511
The Execute SQL Query dialog box displays the Web services script file.
20 Click Run.
The SQL statements contained in the script file are executed. (See
bottom panel)
Generating Web services
512 PowerDesigner
21 Click Close.
The generated Web services appear in ASA 9. (Refresh the Web Services
folder if necessary)
Generating Web services for IBM DB2 v8.1
In IBM DB2, Web services are defined by Document Access Definition
Extension (DADX) files.
A PDM with the appropriate extended model definition allows you to
generate a DADX file for each Web service defined for IBM DB2.
You can attach the DADX extended model definition at model creation. In
the New dialog box, once you have selected Physical Data Model in the
Model type list, and IBM DB2 UDB 8.x Common Server in the DBMS
dropdown listbox, click the Extended Model Definitions tab and select
DADX.
If you have not selected the DADX extended model definition at model
creation, see the following procedure.
The following procedure assumes you have at least one Web service defined
for IBM DB2.
To generate DADX files for IBM DB2:
1 < If the DADX extended model definition is already attached to the
model, go to step 6 > In the menu bar, select ModelExtended Model
Definitions.
The List of Extended Model Definitions appears.
2 In the list toolbar, click the Import an Extended Model Definition tool.
The Extended Model Definition Selection dialog box appears.
3 Select DADX in the list of extended model definitions.
4 Click OK.
DADX appears in the List of Extended Model Definitions.
5 Click OK.
The DADX extended model definition appears attached to the model in
the Browser tree view.
6 In the menu bar, select ToolsExtended Generation.
Chapter 9 Web services in databases
PDM User's Guide 513
The Generation dialog box appears with DADX selected in the Targets
page.
7 Click the Select a Path button, beside the Directory box, to select a path
for the DADX files.
Generating Web services
514 PowerDesigner
8 In the Selection page, select the Web services for which you want to
generate a DADX file.
9 Click OK.
The Result dialog box appears with the paths of the DADX files.
10 Select the path of a DADX file and click Edit.
Chapter 9 Web services in databases
PDM User's Guide 515
The DADX file appears in the editor window.
11 Click Close in the Result dialog box.
You can now use the DADX files for SOAP requests in IBM DB2 UDB Web
services Object Runtime Framework (WORF).
Reverse engineering Web services
516 PowerDesigner
Reverse engineering Web services
You reverse engineer Web services from a database to a PDM, when you
want to reuse these Web services in the PDM. Once reverse engineered, you
can modify and generate them in the database.
You can only reverse engineer Web services from Sybase ASA 9.
ASA HTTP Web services with a common local path are grouped as
PowerDesigner Web operations of an HTTP Web service with the
specified local path:
Software
Web service
name Type
Web operation
name
ASA 9 Customers/Name HTML
PowerDesigner Customers HTML Name
ASA 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
name Type
Web operation
name
ASA 9 Customers HTML
PowerDesigner html HTML Customers
ASA SOAP Web services with a prefix name are considered as
PowerDesigner Web operations of a DISH Web service with the prefix
name:
Software
Web service
name Type
Web operation
name
ASA 9 DishPrefix/Name SOAP
PowerDesigner Customers (with
DishPrefix as
prefix)
DISH Name
Correspondences
between ASA 9
and
PowerDesigner
Chapter 9 Web services in databases
PDM User's Guide 517
ASA SOAP Web services without a prefix name are considered as
PowerDesigner Web operations of a DISH Web service without a prefix
name:
Software
Web service
name Type
Web operation
name
ASA 9 Customers SOAP
PowerDesigner WEBSERVICE_1 DISH Customers
ASA DISH Web services with or without a prefix name are considered
identically in PowerDesigner:
Software
Web service
name Type
Web operation
name
ASA 9 Customers DISH
PowerDesigner Customers (with
or without
DishPrefix as
prefix)
DISH
Reverse engineering Web services from Sybase ASA 9
You can reverse engineer Web services from Sybase ASA 9 into a new or an
existing PDM
To reverse engineer into Select
New PDM FileReverse EngineerDatabase
Existing PDM DatabaseReverse Engineer Database (See
next sections)
using an ODBC data source or script files.
Reverse engineering Web services using an ODBC data source
To reverse engineer Web services (into an existing PDM) using an
ODBC data source:
1 In the menu bar, select DatabaseReverse Engineer Database.
The Database Reverse Engineering dialog box appears.
Reverse engineering Web services
518 PowerDesigner
2 In the Selection page, select the Using an ODBC data source radio
button.
ODBC data source
An ODBC data source (previously used) might be predefined, or you
can type the name of an existing ODBC data source. In both cases,
when you click OK, a database connection dialog box appears, if you
need to specify additional connection parameters. Click Connect and
the ODBC Reverse Engineering dialog box appears. (Go to step 8)
Chapter 9 Web services in databases
PDM User's Guide 519
3 Click the Connect to an ODBC Data Source tool to display the
Connect to an ODBC Data Source dialog box.
4 Click the Machine data source radio button and select a data source
from the dropdown listbox.
or
Click the File data source radio button, then the Select a File DSN tool
to select a .DSN file from an appropriate directory.
5 Type a user ID and a password.
6 Click Connect.
Reverse engineering Web services
520 PowerDesigner
The selected ODBC data source appears in the Database Reverse
Engineering dialog box.
7 <optional> Check the Reverse using administrator's permissions
check box, if you want to select tables reserved to the database
administrator.
8 Click OK.
The ODBC Reverse Engineering dialog box appears with the user
objects. Only tables and triggers are selected by default.
Chapter 9 Web services in databases
PDM User's Guide 521
9 Click the Table tab and select the tables you want to reverse engineer
with the Web services.
In the lower part of the dialog box, select or clear option check boxes
specific to tables.
10 Click the Web Service tab and select the Web services you want to
reverse engineer.
11 Click OK.
Reverse engineering Web services
522 PowerDesigner
A message in the Output window indicates that the database has been
fully reverse engineered and the Merge Models window appears.
The reverse engineered tables and Web services appear checked in the
tree view of the existing PDM (right panel).
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
12 Click OK.
The reverse engineered tables and Web services appear in the existing
PDM.
Reverse engineering Web services using script files
To reverse engineer Web services (into an existing PDM) using
script files:
1 In the menu bar, select DatabaseReverse Engineer Database.
The Database Reverse Engineering dialog box appears.
Chapter 9 Web services in databases
PDM User's Guide 523
2 In the Selection page, select the Using script files radio button.
3 Click the Add Files button.
The Open dialog box appears.
4 Select a directory in the Look in dropdown listbox, select All files (*.*)
in the Files of type dropdown listbox, and select a file with a .trg
extension in the list of files.
5 Click Open.
Reverse engineering Web services
524 PowerDesigner
The path of the selected script file appears in the Selection page.
6 Click OK.
The Merge Models window appears.
The reverse engineered Web services appear checked in the tree view of
the existing PDM (right panel).
Chapter 9 Web services in databases
PDM User's Guide 525
For more information on comparing and merging two models, see
chapter Comparing and Merging Models in the General Features Guide.
7 Click OK.
The reverse engineered Web services appear in the existing PDM.
Reverse engineering Web services
526 PowerDesigner
PDM User's Guide 527
C H A P T E R 1 0
Database Creation and Modification
This chapter explains how to generate and modify databases using scripts and
via ODBC drivers.
Topic Page
Using the ODBC interface 528
Accessing a database 533
Configuring tablespace and storage 540
Estimating database size 546
Customizing scripts 552
Generating a database 559
Modifying a database 575
Using test data 586
About this chapter
Contents
Using the ODBC interface
528 PowerDesigner
Using the ODBC interface
The Open Database Connectivity (ODBC) interface allows PowerDesigner to
access information in different database management systems (DBMS) using
Structured Query Language (SQL) as a standard for accessing data.
An ODBC driver processes function calls and SQL requests coming from
PowerDesigner and sends them to a data source. It also returns request results
to PowerDesigner.
The data source provides all the required target database information: its
client operating system, DBMS, and network platform. While you can only
use one data source at a time, you can set more than one data source for the
driver.
There are three types of data sources:
Data source Description
Machine Data source is created on the client machine, and is available to
the user currently logged onto the system. Machine data sources
are stored in the part of the registry containing settings for the
current user.
System Data source is created on the client machine, and is available to
all users regardless of whether a user is logged onto the system or
not. System data sources are stored in the part of the registry
containing settings for the current machine.
File Data source is stored as a file. A file data source has the
extension .dsn. It can be used by different users if it is placed in
the default location for file data sources. File data sources are
usually managed by database administrators.
Chapter 10 Database Creation and Modification
PDM User's Guide 529
Defining an ODBC data source
You define data sources using the program ODBC Administrator.
PowerDesigner gives you direct access to this program.
To define an ODBC data source:
1 Select DatabaseConnect to display the data source connection dialog
box.
2 Select the Machine data source radio button
or
Select the File data source radio button.
3 Click the Add button to display the ODBC data source administration
dialog box.
4 Click the Setup button to display a list of available ODBC drivers.
5 Select a driver and click the Finish button.
A dialog box displays driver-dependent options.
6 Type or select information required by the DBMS.
7 Click OK in each dialog box.
Configuring an ODBC data source
You can use the ODBC administrator program to configure a data source.
Using the ODBC interface
530 PowerDesigner
To configure an ODBC data source:
1 Select DatabaseConnect to display the data source connection dialog
box.
2 Select the Machine data source radio button.
Select a data source from the dropdown listbox.
or
Select the File data source radio button.
Browse to the directory that contains the .DSN file.
Select the .DSN file.
3 Click the Setup button to display the driver-dependent options dialog
box. The ODBC configuration dialog box for Adaptive Server Anywhere
appears as follows:
4 Type or select information required by the DBMS.
5 Click OK in each dialog box.
Chapter 10 Database Creation and Modification
PDM User's Guide 531
Connecting to an ODBC data source
By connecting to a data source, you can send direct requests to a DBMS.
To connect to an ODBC data source:
1 Select DatabaseConnect to display the data source connection dialog
box.
2 Select the Machine data source radio button.
Select a data source from the dropdown listbox.
or
Select the File data source radio button.
Browse to the directory containing the .DSN file.
Select the .DSN file.
3 Type your user ID and password.
4 Click Connect and, if prompted by your data source, type additional
connection parameters.
Connection time
You stay connected until you disconnect or terminate the shell session.
Using the ODBC interface
532 PowerDesigner
Displaying information about a connected database
The extent of information available about a database depends on the DBMS
and the ODBC driver in use.
To display information about a connected database:
1 Connect to a data source.
2 Select DatabaseConnection Information.
Disconnecting from a data source
To disconnect from a data source:
Select DatabaseDisconnect.
Chapter 10 Database Creation and Modification
PDM User's Guide 533
Accessing a database
PowerDesigner allows you to change the target DBMS of your model,
display data from the database that corresponds to your model, and send SQL
queries to a connected data source.
Changing target DBMS
When you create a PDM, you select a target DBMS. If you change target
DBMS, the PDM may be altered to become compatible with the new DBMS.
Changing the DBMS of a PDM may affect the data types of the model. Each
DBMS family supports different sets of data types. When you change the
target DBMS of a PDM, and select a DBMS from another family, the
following process occurs:
First, all data types of the model are converted into conceptual data types
Then, the conceptual data types are automatically converted back into
physical data types according to the data type translation table defined in
the new target DBMS
For more information on data type conversions, see Extension
mechanism for ODBC reverse engineering queries in chapter DBMS
Reference Guide in the Advanced User Documentation.
Some objects exist only in certain DBMS. For example, sequences exist in
Oracle 8 but not in Sybase AS Enterprise, join indexes exist in Sybase AS IQ
but not in MS Access. The same occurs for triggers and stored procedures.
When you change the DBMS of a model containing such objects, and if the
new target DBMS does not support them, these objects are destroyed.
When you change DBMS, depending on which objects are supported by the
old and new target DBMS, you can choose to preserve, or to lose, the values
associated with the following database objects:
Triggers and stored procedures
Physical options on the databases, tables, indexes, primary and alternate
keys, default options, tablespaces, databases and storages
Database objects: databases, storages, tablespaces, abstract data types,
sequences
Extended attributes
Data type change
Non supported
objects
Preservation
options
Accessing a database
534 PowerDesigner
If a database object is not supported by the old or new target DBMS, the
preserve option for that object is grayed and cannot be selected. If the new
target DBMS does not support an object, you will lose the values associated
with that object when you change target DBMS.
Triggers are rebuilt when a change in DBMS family is made
If you change the target DBMS family, for example from Sybase to Oracle
or IBM DB2, triggers are automatically rebuilt.
When you change target DBMS there can be a syntax incompatibility
between physical options.
If there is a syntax incompatibility, you lose the values for the physical option
that is not recognized by the new target database, even if you have selected
the check box to preserve that physical option.
If you are using physical option in while using Sybase Adaptive Server
Anywhere, and you change target database to Oracle 7 which does not
recognize the option in, you will lose all the values associated with that
option in your model.
When you change the current DBMS, you can choose to connect to a target
DBMS in one of the following ways:
DBMS Description
Share Current DBMS for the PDM constantly refers to the DBMS
definition file stored in the DBMS library. Any modifications
made to the DBMS are shared by the PDM
Copy Current DBMS for the PDM is a unique copy of the DBMS
definition file stored in the DBMS library. The current DBMS is
independent of the original DBMS definition file so modifications
made to the DBMS definition file in the DBMS library are not
available to the PDM. The copied DBMS definition is saved with
the PDM and can not be used without it
Syntax
incompatibility
Example
Share and Copy to
the model DBMS
Chapter 10 Database Creation and Modification
PDM User's Guide 535
To change the target database for a PDM:
1 Select DatabaseChange Current DBMS.
The Change DBMS Target dialog box appears.
2 Select a target DBMS from the dropdown listbox in the New groupbox.
3 Select the Share: Use shared DBMS definition radio button.
or
Select the Copy: Create a copy of the DBMS definition in model radio
button.
4 Click the DBMS Preserve Options tab.
Accessing a database
536 PowerDesigner
The DBMS Preserve Options page appears. It displays options for
database objects that can be preserved or lost when the target DBMS is
changed.
5 Select check boxes for procedures and triggers, database objects, and
physical options that you want to preserve.
Preserve options selected by default
If you are changing target database within a database family, for
example between Sybase SQL Server 10 and Sybase SQL Server 11,
all preserve options available are selected by default. The check
boxes for database objects not supported by the old and new target
databases are disabled.
6 Clear check boxes for procedures and triggers, objects, and physical
options that you do not want to preserve.
7 Click OK.
A message box tells you the target database has been changed.
8 Click OK.
The name of the selected database appears in the status bar.
Chapter 10 Database Creation and Modification
PDM User's Guide 537
Displaying data from a database
If the database corresponding to the PDM already exists, you can display the
data that corresponds to a table, view, or reference in the PDM.
To display data from a connected database:
1 Right-click a table, view, or reference.
A contextual menu appears.
2 Select View Data from the contextual menu.
A dialog box asks you to identify a data source and connection
parameters.
3 Select the Machine data source radio button.
Select a data source from the dropdown listbox.
or
Select the File data source radio button.
Browse to the directory containing the .DSN file.
Select the .DSN file.
4 Type your user ID and password.
5 Click Connect and, if prompted by your data source, type additional
connection parameters.
A Query Results windows list all the database records corresponding to
the selected table, view, or reference.
6 Click the Close button.
Accessing a database
538 PowerDesigner
Executing SQL queries
You can send SQL queries to a connected data source and display the results.
In the Execute SQL Query dialog box, you can use the following tools and
accelerators from the Edit/Run Script editor toolbar:
Tool Description Accelerator
Open Editor Contextual menu
Note: When you use the Find feature, the
parameter "Regular expression" allows the
use of wildcards in the search expression.
For more information, see Visual Basic
documentation
SHIFT + F11
Edit With. Opens the previously defined
default editor or allows you to select
another editor if you click the down arrow
beside this tool
CTRL + E
Run. Executes the current script F5
For more information on defining a default editor, see section Defining
a text editor in chapter Using the PowerDesigner Interface in the General
Features Guide.
In the Edit/Run Script editor window, you can add and remove bookmarks at
specific points in the code and then navigate forwards or backwards from
bookmark to bookmark:
Accelerator Description
CTRL + F2 Adds a new bookmark. A blue bookmark box appears. If you
repeat this action from the same position, the bookmark is
deleted and the blue marker disappears
F2 Jumps to bookmark
SHIFT + F2 Jumps to previous bookmark
To execute SQL queries:
1 Select DatabaseExecute SQL.
A dialog box asks you to identify a data source and connection
parameters.
2 Select the Machine data source radio button.
Script bookmarks
Chapter 10 Database Creation and Modification
PDM User's Guide 539
Select a data source from the dropdown listbox.
or
Select the File data source radio button.
Browse to the directory containing the .DSN file.
Select the .DSN file.
3 Type your user ID and password.
4 Click Connect and, if prompted by your data source, type additional
connection parameters.
The Execute Query dialog box appears.
5 Type one or more SQL queries in the window.
The syntax of some SQL queries may be DBMS dependent.
6 Click the Run button.
A list displays the results of your queries.
7 Click Close to quit the Execute Query dialog box.
Configuring tablespace and storage
540 PowerDesigner
Configuring tablespace and storage
Tablespace and storage indicate the physical location of tables and indexes in
a database or storage device. The definition of tablespace and storage is
DBMS specific. Different DBMS can use different terms for tablespace and
storage.
The terms tablespace and storage both refer to a named partition that stores
tables and indexes. Tablespace refers to a partition in a database. Storage
refers to a partition on a storage device.
For some DBMS, a tablespace can use a declared storage in its definition.
Defining tablespace and storage
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.
To define tablespace and storage:
1 Select ModelTablespaces.
or
Select ModelStorages.
The List of Tablespaces or List of Storages appears.
Tablespace or storage not applicable
When tablespace or storage options are not applicable for a DBMS,
the corresponding Database menu item is grayed.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
Chapter 10 Database Creation and Modification
PDM User's Guide 541
3 Type a Tablespace name and tablespace code.
or
Type a Storage name and storage code.
4 Click the Properties tool.
A message requesting if you want to commit all changes appears.
5 Click Yes.
The Tablespace or Storage properties sheet opens to the General page.
6 Click the Options tab.
Configuring tablespace and storage
542 PowerDesigner
The Options page appears. The Syntax tabbed page in the left pane lists
the database options available for a tablespace or storage. These options
are DBMS specific, and not all DBMS support options for tablespaces
and storages.
7 Select an option from the Syntax tabbed page.
8 Click the >> button.
The name of the option appears as an item in the Items tabbed page.
9 Select the item from the Items tabbed page.
Chapter 10 Database Creation and Modification
PDM User's Guide 543
The option name appears with an equals sign next to a textbox at the
bottom of the dialog box. Depending on the type of value the option can
take, a dropdown listbox can appear instead of a textbox.
10 Type a value for the option in the textbox below the right pane
or
Select a value from the dropdown listbox below the right pane.
11 If you want to include more options in the tablespace or storage
definition, select other options and type or select their parameter values.
12 Click OK.
The selected options appear in Options column of the List of
Tablespaces or List of Storages.
Previewing tablespace and storage commands
You can preview tablespace and storage commands before you generate
them.
To preview tablespace and storage commands:
1 Select ModelTablespace.
or
Select ModelStorage.
Configuring tablespace and storage
544 PowerDesigner
The List of Tablespaces or List of Storages appears.
2 Click a tablespace or storage item in the list.
An arrow appears at the beginning of the line.
3 Double-click the arrow at the start of the line.
or
Click the Properties tool.
The Tablespace or Storage properties sheet opens to the General page.
4 Click the Preview tab.
The Preview page appears. It shows the corresponding command for the
target DBMS.
5 Click OK.
You return to the List of tablespaces or storage.
6 Click OK.
Chapter 10 Database Creation and Modification
PDM User's Guide 545
Sample tablespace and storage commands
The following table lists commands that implement PowerDesigner
tablespace and storage options in a selection of DBMS:
DBMS Tablespace Storage
DB2 CREATE
TABLESPACE
CREATE STOGROUP
DB2 C/S CREATE
TABLESPACE
Not applicable
Oracle CREATE
TABLESPACE
Storage structure (not
physical storage)
Sybase Adaptive
Server Enterprise
Not applicable SP/ADDSEGMENT
SQL Server Not applicable SP/ADDSEGMENT
Sybase Adaptive
Server Anywhere
CREATE DBSPACE Not applicable
Tablespace or storage not applicable
When tablespace or storage options are not applicable for a DBMS, the
corresponding model menu item is grayed.
Estimating database size
546 PowerDesigner
Estimating database size
You can estimate the size of a database for all the tables in the model or for
only selected tables throughout the model.
You obtain an estimate based on the following elements:
Estimated number of records in tables
Columns in each table
Indexes in the model
Tablespaces in the model
Database storage options
Estimation depends on parameters like DBMS type, physical options, column
data types, indexes and keys. The estimation formula used in this feature
proceeds from the DBMS documentation.
Records in tables
You indicate a number of records in each table in your model.
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
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.
Automatic index constraints
The automatic indexing of keys is DBMS specific. If the target database
supports the automatic indexing of keys, the resulting database size
estimation includes these indexes.
The size of a tablespace associated with a table is estimated by default, and is
displayed as a total of the following:
All tables in the tablespace
All indexes in the tablespace
For more information on how to associate a tablespace with an index or
table, see section Creating an Index in chapter Building Physical Diagrams.
Basis of calculation
Columns
Indexes
Tablespace size
Chapter 10 Database Creation and Modification
PDM User's Guide 547
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.
Indicating the number of records in a table
Before you estimate database size, you indicate the number of records in
each table that you generate.
To indicate the number of records in a table:
1 Select ModelTables.
The List of Tables appears.
2 Display the Test Number column.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. For details, see the General Features Guide.
Storage options
Estimating database size
548 PowerDesigner
3 Type a value in the Test Number column for the table that requires an
indication of the number of records.
4 Click OK.
Indicating average data type length
You can indicate the estimated average data type length for variable length
data types. This average length value is then used instead of the maximum
data type length when you estimate database size.
Average size must be carefully selected
The average length value is particularly important for strings or long
binary data types. A Binary Long OBject (BLOB) such as a picture can
represent the largest portion of the space actually taken by a table.
To indicate average data type length:
1 Select ModelTables.
The List of Tables appears.
2 Double-click a table name.
The Table Properties sheet opens to the General page.
3 Click the Columns tab.
The Columns page appears.
Chapter 10 Database Creation and Modification
PDM User's Guide 549
4 Double-click a column that uses a data type with variable length.
The Column Properties sheet opens to the General page.
5 Click the Detail tab.
The Detail page appears.
6 Type a value in the Average length box.
7 Click OK in each of the dialog boxes.
Estimating the database size of a model
You can estimate the database size of all the tables in the model.
To estimate the database size of all the tables in the model:
1 Select DatabaseEstimate Database Size.
The Database Size Estimation dialog box appears.
2 Click the Include Sub-Packages button.
Estimating database size
550 PowerDesigner
3 Select all the tables from the list.
4 Click OK.
The output list displays the estimated database size.
Estimating the database size of selected tables
You can estimate the database size of selected tables in the model.
To estimate the database size of selected tables in the model:
1 Select DatabaseEstimate Database Size.
The Database Size Estimation dialog box appears.
2 Select a package from the dropdown listbox.
The list of tables in the currently selected package appears.
Chapter 10 Database Creation and Modification
PDM User's Guide 551
3 Select one or more tables from the list.
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 appears 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.
Customizing scripts
552 PowerDesigner
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
Customizing a creation script allows you to add descriptive information about
a generated script, or manipulate the script in such a way that is not provided
by PowerDesigner.
If a development project archives all the database creation scripts that are
generated, a header script can be inserted before each creation script, which
may indicate the date, time, and any other information specific to the
generated script.
If an organization requires that generated scripts are filed using a naming
system which may be independent from a script name, a header script could
direct a generated script to be filed under a different name than the name
indicated in the creation script.
Access rights can be added as a footer to a table creation script.
Script toolbar properties
You can use the following tools and accelerator from the script toolbar:
Tool Description Accelerator
Editor context menu SHIFT + F11
Edit With. Opens the default editor you
previously defined
CTRL + E
For more information on defining a default editor, see section Defining a
text editor in the General Features Guide.
Inserting begin and end scripts for database creation
In a database creation script, you can insert the following scripts:
Script Where it is inserted
Begin script Before the command that creates the database
Examples
Chapter 10 Database Creation and Modification
PDM User's Guide 553
Script Where it is inserted
End script After the last command in the database creation script
You can use the following variables in these scripts:
Variable Description
%DATABASE% Name of the current PDM
%DATE% Date of script generation
%DBMSNAME% Name of the DBMS for the target database
%NAMESCRIPT% Filename of script file
%PATHSCRIPT% Filename and path of script file
%STARTCMD% Command that runs the script
%AUTHOR% Author of the current model
To insert begin and end scripts for database creation:
1 Select ModelModel Properties.
or
Right click the diagram background.
Select Properties from the contextual menu.
Customizing scripts
554 PowerDesigner
The model property sheet appears.
2 Click the Create tool next to the Database box.
A confirmation box appears asking you to commit the creation of the
database script object.
3 Click Yes.
Chapter 10 Database Creation and Modification
PDM User's Guide 555
The database property sheet appears.
4 Type a name and code for the database.
5 Click the Script tab.
The Script page opens to the Begin page.
6 Type the DBMS-specific commands to insert in the beginning of the
script.
7 Click the End tab at the bottom of the page.
8 Type the DBMS-specific commands to insert at the end of the script.
9 Click OK in each of the dialog boxes.
Customizing scripts
556 PowerDesigner
Inserting begin and end scripts for table creation
For each table, you have the option to insert the following scripts:
Script Where it is inserted
Begin script Immediately before the table creation command (after the table
title)
End script Immediately after the table creation command
These scripts can appear in database creation scripts and database
modification scripts.
You can use the following variables in these scripts:
Variable Description
%COLNLIST% Column list
%DATABASE% Code of the current PDM
%DATE% Date of script generation
%DBMSNAME% Code of the DBMS for the target database
%NAMESCRIPT% Filename of script file
%OWNER% Table owner
%OWNERPREFIX% Owner prefix of table owner
%PATHSCRIPT% Filename and path of script file
%STARTCMD% Command that runs the script
%TABLE% Name or code of current table (based on display
preferences)
%TCODE% Code of the current table
%TLABL% Label of the current table
%TNAME% Name of the current table
%AUTHOR% Author of the current model
To insert begin and end scripts for table creation:
1 Double-click a table symbol.
The table property sheet appears.
Chapter 10 Database Creation and Modification
PDM User's Guide 557
2 Click the Script tab.
The Script page opens to the Begin page.
3 Type the DBMS-specific commands to insert in the beginning of the
script.
4 Click the End tab at the bottom of the page.
5 Type the DBMS-specific commands to insert at the end of the script.
6 Click OK.
Inserting begin and end script for tablespace creation
For each tablespace, you have the option to insert the following scripts:
Script Where it is inserted
Begin script Immediately before the tablespace creation command (after the
table title)
End script Immediately after the tablespace creation command
These scripts can appear in database creation scripts and database
modification scripts.
You can use the following variables in these scripts:
Variable Description
%DATABASE% Code of the current PDM
%DATE% Date of script generation
%DBMSNAME% Code of the DBMS for the target database
%NAMESCRIPT% Filename of script file
%PATHSCRIPT% Filename and path of script file
%STARTCMD% Command that runs the script
%TABLESPACE% Code of the tablespace
%OPTIONS% Physical options of the tablespace
%AUTHOR% Author of the current model
Customizing scripts
558 PowerDesigner
To insert begin and end scripts for tablespace creation:
1 Double-click a tablespace in the list of tablespace.
The tablespace property sheet appears.
2 Click the Script tab.
The Script page opens to the Begin page.
3 Type the DBMS-specific commands to insert in the beginning of the
script.
4 Click the End tab at the bottom of the page.
5 Type the DBMS-specific commands to insert at the end of the script.
6 Click OK.
Formatting variables in customized scripts
Variables have a syntax that can force a format on their values in the
following ways:
Force values to lower-case or upper-case characters
Truncate the length of values
When a variable does not specify formatting, its values have the same format
as in the PDM. You can use the following formatting syntax with variables:
Format code Format of variable value in script
.L Lower-case characters
.T Removes blank spaces
.U Upper-case characters
.c Upper-case first letter and lower-case next letters
.n Maximum length where n is the number of characters
.nJ Justifies to fixed length where n is the number of characters
You embed formatting options in variable syntax as follows:
%.format:variable%
For example:
%.L:TABLE%
Chapter 10 Database Creation and Modification
PDM User's Guide 559
Generating a database
You can create or modify a database in two ways:
Directly execute a script on a connected data source using an ODBC
driver
Generate a script to be executed on a DBMS at a later time
In both cases, the database generation commands are saved in a script file.
You must always provide the following information about the script file:
Parameter Description
Directory Destination directory for the script file
File name Destination filename for the script file
One file only When selected creates one script file, instead of a separate script
file for each table
Generation
type
Database generation by script or using ODBC
The following characters need to be prefixed in order to be generated in the
code.
% has to be doubled (%%) to generate the % sign in the code
[ ] must be prefixed by \ to generate brackets in the code
Reserved
characters
Generating a database
560 PowerDesigner
Creation parameters for tables, columns, and views
Creation parameters indicate what to generate from the database structure
defined by the PDM.
The availability of these parameters depends on the target database.
Unavailable parameters display in gray and you cannot select them.
Parameter Result of selection
Create table Generate tables
Check Generate check parameters and validation rules for tables.
You can generate these check parameters inside or
outside the table creation command (see below)
Physical options Generate physical options for tables
Begin script Insert customized script before table creation
End script Insert customized script after table creation
Comment Generate table comments
Permission Generate the permission statement for a given user during
table creation
Drop table Delete an existing table, before creating a new table
If you select to generate checks for the tables, you can choose to generate
them:
Inside Table: in this case checks are generated during table creation
Outside: in this case checks are generated with a separate SQL
command, generally using an ALTER command after the creation of the
table
The generation of checks outside the table is possible if the AddTableCheck
entry exists in the Table category of the current DBMS.
Parameter Result of selection
User-defined type Generate user-defined data types
Default value Assign default value to column at creation
Check Generate check parameters and validation rules for column.
You can generate these check parameters inside or outside the
table creation command (see below)
Comment Generate column comments
Physical options Generate physical options for column
Table creation
parameters
Column creation
parameters
Chapter 10 Database Creation and Modification
PDM User's Guide 561
Parameter Result of selection
Permission Generate the permission statement for a given user during
column creation
If you select to generate checks for the columns, you can choose to generate
them:
Inside Table: in this case checks are generated during table creation
Outside: in this case checks are generated with a separate SQL
command, generally using an ALTER command after the creation of the
table
The generation of checks outside the table is possible if the ModifyColnChck
entry exists in the Column category of the current DBMS.
Parameter Result of selection
Create default Generate default object
Drop default Delete an existing default before creating a new default object
If the Create and Drop check boxes are selected, the default objects will be
created/dropped before domains and tables.
For more information on the default generation statement, see section
Default in chapter DBMS Reference Guide in the Advanced User
Documentation.
Parameter Result of selection
Create view Generate views
Comment Generate view comments
Begin script Insert customized script before view creation
End script Insert customized script after view creation
Permission Generate the permission statement for a given user during view
creation
Drop view Delete an existing view before creating a new view
Default creation
parameters
View creation
parameters
Generating a database
562 PowerDesigner
Creation parameters for keys, indexes, and join indexes
Creation parameters indicate what to generate from the database structure
defined by the PDM.
The availability of these parameters depends on the target database.
Unavailable parameters display in gray and you cannot select them.
Parameter Result of the selection
Create primary key Generate primary keys. You can generate the primary keys
inside or outside the table creation command (see below)
Physical options Generate physical options for primary keys
Comment Generate key comments
Drop primary key Delete an existing primary key, before creating a new
primary key
If you select to create primary keys, you can choose to generate them:
Inside Table: in this case primary keys are generated during table
creation
Outside: in this case 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.
Parameter Result of the selection
Create alternate key Generate alternate keys. You can generate the alternate keys
inside or outside the table creation command (see below)
Physical options Generate physical options for alternate keys
Comment Generate alternate key comments
Drop alternate key Delete an existing alternate key, before creating a new
alternate key
If you select to create alternate keys, you can choose to generate them:
Inside Table: in this case, alternate keys are generated during table
creation
Outside: in this case alternate keys are generated with a separate SQL
command, generally using an ALTER command after the creation of the
table
Primary key
creation
parameters
Alternate key
creation
parameters
Chapter 10 Database Creation and Modification
PDM User's Guide 563
The generation of alternate keys outside the table is possible if the Create
entry exists in the Key category of the current DBMS.
Parameter Result of selection
Create index Generate indexes
Physical options Generate physical options for indexes
Comment Generate index comments
Drop index Deletes an existing index before creating a new index
Parameter Result of selection
Primary key Generate primary key indexes
Foreign key Generate foreign key indexes
Alternate key Generate alternate key indexes
Cluster Generate cluster indexes
Others Generate indexes for all key columns with a defined index
Parameter Result of selection
Create foreign key Generate foreign keys. You can generate the foreign keys
inside or outside the table creation command (see below)
Decl. Integrity Generate declarative referential integrity for references that
have Declarative selected for referential integrity
implementation in the reference property sheet. When you
click the ellipsis button, a selection box appears which
allows you to define a filter to generate all or certain
references based on their defined referential integrity
constraints
Comment Generate foreign key comments
Drop foreign key Delete an existing foreign key , before creating a new
foreign key
If you select to create foreign keys, you can choose to generate them:
Inside Table: in this case, foreign keys are generated during table
creation
Index creation
parameters
Index filter
Foreign key
creation
parameters
Generating a database
564 PowerDesigner
Outside: in this case 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.
Parameter Result of selection
Create join index Generate join indexes
Physical options Generate physical options for join indexes for those DBMS
that support it
Comment Generate join index comments
Begin script Insert customized script before join index creation
End script Insert customized script after join index creation
Drop join index Delete an existing join index, before creating a new join
index
Database creation parameters
Creation parameters indicate what to generate from the database structure
defined by the PDM.
The availability of these parameters depends on the target database.
Unavailable parameters display in gray and you cannot select them.
For more information about the creation of extended attributes, see
chapter DBMS Reference Guide in the Advanced User Documentation.
Parameter Result of selection
Create database Generate database
Physical options Generate physical options for database
Begin script Insert customized script before database creation
End script Insert customized script after database creation
Open database Open database
Close database Close database
Drop database Delete an existing database, before creating new database
Join index
Database
parameters
Chapter 10 Database Creation and Modification
PDM User's Guide 565
Parameter Result of selection
Create sequence Generate sequence
Comment Generate sequence comments
Drop sequence Delete an existing sequence, before creating a new sequence
Permission Generate the permission statement for a given user during
sequence creation
Parameter Result of selection
Create storage Generate storages
Comment Generate storage comments
Drop storage Delete an existing storage, before creating a new storage
Create tablespace Generate tablespaces
Begin script Insert customized script before tablespace creation
End script Insert customized script after tablespace creation
Comment Generate tablespace comments
Drop tablespace Delete an existing tablespace, before creating a new
tablespace
Parameter Result of selection
Create rule Generate rules
Comment Generate rule comments
Drop rule Delete an existing rule, before creating a new rule
Parameter Result of selection
Create data type Generate user-defined data types
Default value Default value for data type
Check Generate check parameters and validation rules for user-define
data types
Comment Generate data type comments
Drop data type Delete an existing data type, before creating new data type
Sequence
parameters
Tablespace and
storage
parameters
Rules
User-defined data
type parameters
Generating a database
566 PowerDesigner
Parameter Result of selection
Create data type Define an abstract data type which is stored on a server
Comment Generate data type comments
Drop data type Delete an existing abstract data type, before defining a
abstract data type
Install JAVA class Install a Java class which is stored on a server
Remove JAVA class Delete an existing Java class, before installing a new Java
class
Permission Generate the permission statement for a given user during
data type creation
Generation script options
Script options indicate the format of database generation scripts.
The availability of these options depends on the target database. Unavailable
options display in gray and you cannot select them.
Option Result of selection
Database
prefix
Table and view names in the script are prefixed by their database
names
Owner
prefix
Table and view names in the script are prefixed by their owner
names. For those DBMS that support sequence owners, this option
also allows to prefix the sequence names by their owner names
Title Each section of the script includes commentary in the form of titles
(for example, Database Name: TUTORIAL)
Generate
name in
empty
comment
For those DBMS that support comments, this option allows to
generate the name in the comment when the comment box is empty.
This option applies to tables, columns, and views. The comment
generated using the object name will be reversed as a comment
Check
model
Check the PDM before generating the database or script, and stop
generation if an error is found
Script
preview
Allows to preview the generation script in the Execute Query dialog
box. In this dialog box, you can click Execute to start ODBC
generation, or Close to cancel generation. This check box is
available when the ODBC generation radio button is selected
Abstract data type
parameters
Script options
Chapter 10 Database Creation and Modification
PDM User's Guide 567
Option Result of selection
Automatic
archive
Model is automatically archived after each generation
Encoding Encoding format to use for generation. You should select the
encoding format that supports the language used in your model and
the database encoding format
Upper Script contains all uppercase characters
Lower Script contains all lowercase characters
Mixed Script contains lowercase and uppercase characters
No accent Non-accented characters replace accented characters in script
There are two ways to generate referential integrity in a database:
Option Result of selection
Trigger Generates a trigger
Declarative Generates a declarative statement in a script
You indicate referential integrity generation options from the Integrity page
of the reference property sheet.
You can define a filter to generate all or certain references based on their
defined referential integrity constraints, by clicking the ellipsis button next to
the Decl. Integrity option in the Database Generation dialog box, and
selecting or clearing the appropriate check boxes.
Object selection parameters
You select objects for generation from the Selection page.
You can display in the list, objects in the current model, or objects in
individual packages contained in the model.
If you select the Include Sub-packages tool, you can display in the list either
all objects in the current model, or all objects in a package.
Referential integrity
Listing objects
contained in a
model or package
Generating a database
568 PowerDesigner
You have the following selection options:
Parent object
Include Sub-
packages Displays
Model Selected All objects in model including all objects
contained in packages and sub-packages
Model Not selected All objects in model except objects
contained in packages and sub-packages
Package Selected All objects contained in package including
all objects contained in sub-packages
Package Not selected All objects in package except objects
contained in sub-packages
You can apply a filter to list only objects belonging to a particular owner. If
you select the Owner <NONE> you display all the objects belonging to all
owners for the selected model or package.
Graphically selected objects
Graphically selected objects in a diagram can be automatically selected for
generation by clicking the Use Graphical Selection button in the Selection
page tool bar.
You can select external shortcuts for generation as regular objects in the
database.
Listing objects for
an owner
Selecting external
shortcuts to
generate
Chapter 10 Database Creation and Modification
PDM User's Guide 569
To do so, you have to click the Include External Shortcut tool in the
Selection page to display external shortcuts in the list of objects to select for
generation.
You then have to select the check boxes of the external shortcuts you want to
generate. If the target model of the external shortcuts is closed, the external
shortcuts do not appear in the list of objects to select for generation.
External shortcuts are generated as objects in the database, where they are no
longer flagged as shortcuts. This implies that these objects are not reverse
engineered as shortcuts but as regular objets, thus breaking the round-trip
engineering process.
To recover shortcuts during reverse engineering, you have to be very careful
when selecting objects to reverse, and make sure the external shortcuts are
not reversed in the referencing model. Object selection is only possible in
ODBC reverse engineering.
Selecting objects for generation
When you generate a database you can select objects for generation from a
particular model. You can also apply a filter to limit the objects for
generation to those belonging to one or all owners in a PDM.
Generating a database
570 PowerDesigner
The Selection page is common to both the Database Generation and Database
Modification dialog boxes.
To select objects for database generation:
1 From the Database Generation or Database Modification dialog box,
select the Selection tab.
The Selection page appears. It displays objects for each object type in
the current model.
2 Select a model from the Model dropdown list.
3 If you want to generate a script for objects owned by a particular owner,
select an owner from the Owner dropdown list.
or
If you want to generate a script for all objects in the PDM, select None
from the owner dropdown list.
4 Click an object type tab at the bottom of the page.
Select or clear check boxes for objects to generate.
5 Select or clear object check boxes for each object type that you want to
generate.
Chapter 10 Database Creation and Modification
PDM User's Guide 571
Generating a database creation script
PowerDesigner can generate a database creation script that you can run in
your DBMS environment.
To generate a database creation script:
1 Select DatabaseGenerate Database.
The Database Generation dialog box appears. It lists generation
parameters for creating a database.
2 Type a destination directory for the script file in the Directory box.
3 Type a destination filename for the script file in the File Name box.
4 Select the Script radio button.
5 Select creation parameters for tables, columns, and views.
6 Click the Keys and Indexes tab.
The Keys and Indexes page appears. It lists creation parameters for
keys, foreign keys and indexes.
7 Select creation parameters for keys and indexes.
Generating a database
572 PowerDesigner
8 Click the Database tab.
The Database page appears. It lists creation parameters for the database,
storages, tablespaces, and user-defined data types.
9 Select database creation options.
10 Click the Options tab.
The Options page appears. It lists formatting, checking, and archiving
options for the generated script.
11 Select script options.
12 Click the Selection tab.
The Selection page appears.
13 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
For more information on selecting a model, owners, and PDM
objects, see section Selecting objects for generation.
14 Click OK.
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 appears. It lists the file path of the generated script file.
15 Click the Close button to close the Result box.
or
If you want to edit the script, click the file path in the result box and
click the Edit button.
The script opens up in a text editor.
Creating a database directly
PowerDesigner can generate database structure directly. To do so, you must
connect to a data source using an ODBC driver.
To create a database directly:
1 Select DatabaseGenerate Database.
The Database Generation dialog box appears.
2 Type a destination filename for the script file in the File Name box.
3 Type a destination directory for the script file in the Directory box.
4 Select the ODBC Generation radio button.
Chapter 10 Database Creation and Modification
PDM User's Guide 573
5 Select creation parameters for tables, columns, and views.
6 Click the Keys and Indexes tab.
The Keys and Indexes page appears.
7 Select creation parameters for keys and indexes.
8 Click the Database tab.
The Database page appears.
9 Select database creation options.
10 Click the Options tab.
The Options page appears.
11 Select Script options.
12 Click the Selection tab.
The Selection page appears.
13 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
For more information on selecting a model, owners, and PDM
objects see section Selecting objects for generation.
14 Click OK.
A dialog box asks you to identify a data source and connection
parameters.
15 Select a machine data source from the dropdown listbox.
or
Select a file data source from the dropdown listbox.
Generating a database
574 PowerDesigner
16 Type your user ID and password.
17 Click Connect and, if prompted by your data source, type additional
connection parameters.
A message window shows the progress of the generation process.
18 Click OK.
Generating a Microsoft Access 97 database
PowerDesigner and MS Access 97 use .DAT files to exchange information.
These files are created from the PDM files via the script generation. The
access.mdb database uses or creates .DAT files to generate or reverse Access
databases.
You can define the database generation parameters from the access.mdb
database window.
To generate an MS Access database from a PowerDesigner PDM:
1 Generate the database script from PowerDesigner.
2 Double-click access.mdb in the PowerDesigner \tools directory.
3 Select Generate Access Database from PowerDesigner Script File.
4 Type the destination database in the Select Database box.
5 Type the file created by PowerDesigner in the PowerDesigner File.
6 Click on the Create button.
Chapter 10 Database Creation and Modification
PDM User's Guide 575
Modifying a database
You can generate a database by synchronizing a modified PDM with one of
the following existing database schema:
Archived PDM
ODBC data source
Generation script file
The modified PDM and the existing database schema are merged using a
database synchronization window which displays an object tree view of the
modified PDM (source model) and the existing database schema (target
model). You can choose which objects are added, deleted, or updated in the
target database relative to the modified PDM.
Database generation synchronization parameters
You can select the following synchronization parameters:
Parameter Result of selection
Using an archive model Modified PDM is merged with an archived PDM
Using an ODBC data source Modified PDM is merged with a reverse
engineered database schema for an ODBC data
source
Using a script file Modified PDM script file is merged with an
existing database script file
Modifying a database
576 PowerDesigner
You can select the following database preservation parameters:
Backup
tables
Always use
create
statements
Use alter
statements when
possible
Drop temporary
tables
Use physical
options for
temporary
tables
Selected Creates temp
tables and inserts
data, drops old
tables, creates new
tables and inserts
data from temp.
Temp tables are
removed if Drop
temporary tables
check box is
selected
If alter is possible,
alters tables without
creating any temp table,
otherwise, creates temp
tables and inserts data,
drops old tables, creates
new tables and inserts
data from temp. Temp
tables are removed if
Drop temporary tables
check box is selected
Check box
available. If
selected, removes
temp tables after
script execution. If
deselected, temp
tables are
preserved and have
structure of tables
before running
script
Check box
available. If
selected,
generates
temporary tables
with their
physical options
Deselected Always drops old
tables and creates
new tables
If alter is possible,
alters tables without
creating any temp table,
otherwise, drops old
tables, and creates new
tables
Check box not
available since
temp tables are not
created
Check box not
available since
temp tables are
not created
Database modification script options
Script options indicate the format of database generation scripts.
The availability of these options depends on the current database.
Unavailable options display in gray and you cannot select them.
Option Result of selection
Database
prefix
Table and view names in the script are prefixed by their database
names
Owner
prefix
Table and view names in the script are prefixed by their owner
names. For those DBMS that support sequence owners, this option
also allows to prefix the sequence names by their owner names
Title Each section of the script includes commentary in the form of titles
(for example, Database Name: TUTORIAL)
Generate
name in
empty
comment
For those DBMS that support comments, this option allows to
generate the name in the comment when the comment box is empty.
This option applies to tables, columns, and views. The comment
generated using the object name will be reversed as a comment
Backup tables
Chapter 10 Database Creation and Modification
PDM User's Guide 577
Option Result of selection
Check
model
Check the PDM before generating the database or script, and stop
generation if an error is found
Script
preview
Allows to preview the generation script in the Execute Query dialog
box. In this dialog box, you can click Execute to start ODBC
generation, or Close to cancel generation. This check box is
available when the ODBC generation radio button is selected
Automatic
archive
Model is automatically archived after each generation
Encoding Encoding format to use for generation. You should select the
encoding format that supports the language used in your model and
the database encoding format
Upper Script contains all uppercase characters
Lower Script contains all lowercase characters
Mixed Script contains lowercase and uppercase characters
No accent Non-accented characters replace accented characters in script
Generating a modified database
You can generate a database creation script, or generate a database directly
by merging a modified PDM with one of the following existing database
schema:
Archived PDM
ODBC data source
Generation script file
Generating a database by synchronizing a PDM with an archived PDM
To generate a database by synchronizing a PDM with an archived
PDM:
1 Select DatabaseModify Database.
The Database Modification dialog box appears. It lists generation
parameters for creating a database.
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
Modifying a database
578 PowerDesigner
3 Select the Script Generation radio button.
or
Select the ODBC Generation radio button.
4 Select the Using an Archive Model radio button.
5 Type the file path of the archived file
or
Click the button at the end of the box to browse to the directory
containing the archived PDM.
Select the archived PDM file, and click Open.
6 Select the appropriate option in the Backup Tables groupbox.
7 Click the Options tab.
The Options page appears.
8 Select script options.
9 Click the Selection tab.
The Selection page appears. It displays objects for each object type in
the current model.
10 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
Chapter 10 Database Creation and Modification
PDM User's Guide 579
For more information on selecting a model, owners, and PDM
objects see section Selecting objects for generation.
11 Click OK.
The Database Synchronization window appears.
12 Select or clear check boxes in the target model for objects that you want
to include or remove from the model.
For more information on comparing and merging models, see
chapter Comparing and Merging Models in the General Features Guide.
13 Click OK.
If you are generating a creation script, at the end of generation a
result box appears listing the file path of the generated script file. To
edit the script, click the file path in the result box and click the Edit
button. The script opens up in a text editor. To close the Result box,
click the Close button
If you are generating a database directly, an ODBC Data Source
connection box appears. Type connection details and click the
Connect button. A message window shows the progress of the
generation process. At the end of generation click OK to close the
box
Generating a database by synchronizing a PDM with an ODBC data source
To generate a database by synchronizing a PDM with an ODBC data
source:
1 Select DatabaseModify Database.
The Database Modification dialog box appears. It lists generation
parameters for creating a database.
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
3 Select the Script Generation radio button.
or
Select the ODBC Generation radio button.
4 Select the Using an ODBC Data Source radio button.
Modifying a database
580 PowerDesigner
A dialog box asks you to identify a data source and connection
parameters.
5 Select a machine data source from the dropdown listbox.
or
Select a file data source from the dropdown listbox.
6 Type your user ID and password.
7 Click Connect and, if prompted by your data source, type additional
connection parameters.
Chapter 10 Database Creation and Modification
PDM User's Guide 581
You return to the Database Modification dialog box.
8 Select or clear check boxes in the Backup Tables groupbox.
9 Click the Options tab.
The Options page appears.
10 Select script options. If you selected the ODBC Generation radio button,
you can choose to preview the script in the Execute Query dialog box by
selecting the Script Preview check box.
11 Click the Selection tab.
The Selection page appears. It displays objects for each object type in
the current model.
12 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
For more information on selecting a model, owners, and PDM
objects see section Selecting objects for generation.
13 Click OK.
Modifying a database
582 PowerDesigner
The ODBC Reverse Engineering dialog box appears.
14 Indicate reverse engineering details and select or clear object check
boxes for each type of PDM object to reverse engineer.
The database schema that you reverse engineer is the schema that is
synchronized with the current PDM to generate a modified database.
For more information on reverse engineering a database, and
selecting objects to reverse engineer, see chapter Reverse Engineering.
15 Click OK.
A progress box shows the progress of the reverse engineering process.
The Database Synchronization window appears.
16 Select or clear check boxes in the target model for objects that you want
to include or remove from the model.
For more information on comparing and merging models, see
chapter Comparing and Merging Models in the General Features Guide.
17 Click OK.
If you are generating a creation script, at the end of generation, a
result box appears listing the file path of the generated script file. To
edit the script, click the file path in the result box and click the Edit
button. The script opens up in a text editor. To close the Result box,
click the Close button
Chapter 10 Database Creation and Modification
PDM User's Guide 583
If you are generating a database directly, an ODBC Data Source
connection box appears. Type connection details and click the
Connect button. A message window shows the progress of the
generation process. At the end of generation click OK to close the
box
Generating a database by synchronizing a PDM with a script file
To generate a database by synchronizing a PDM with a script file:
1 Select DatabaseModify Database.
The Database Modification dialog box appears. It lists generation
parameters for creating a database.
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
3 Select the Script Generation radio button.
or
Select the ODBC Generation radio button.
4 Select Using a Script File.
5 Type the file path of the script file
or
Click the button at the end of the box to browse to the directory
containing the script file.
Modifying a database
584 PowerDesigner
Select the script file, and click Open.
6 Select or clear check boxes in the Backup Tables groupbox.
7 Click the Options tab.
The Options page appears.
8 Select script options.
9 Click the Selection tab.
The Selection page appears. It displays objects for each object type in
the current model.
10 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
For more information on selecting a model, owners, and PDM
objects see section Selecting objects for generation.
11 Click OK.
The Database Synchronization window appears.
12 Select or clear check boxes in the target model for objects that you want
to include or remove from the model.
Chapter 10 Database Creation and Modification
PDM User's Guide 585
For more information on comparing and merging models, see
chapter Comparing and Merging Models in the General Features Guide.
13 Click OK.
If you are generating a creation script, at the generation end, a result
box appears listing the file path of the generated script file. To edit
the script, click the file path in the result box and click the Edit
button. The script opens up in a text editor. To close the Result box,
click the Close button
If you are generating a database directly, an ODBC Data Source
connection box appears. Type connection details and click the
Connect button. A message window shows the progress of the
generation process. At the end of generation click OK to close the
box
Using test data
586 PowerDesigner
Using test data
Test data is sample data that you can define and generate for one or more
tables in a PDM. When you generate test data, PowerDesigner automatically
generates rows of data in database tables.
You normally use test data to verify the performance of a database that is
being developed. You can use test data to do the following:
Verify the performance of the database when it is filled with large
amounts of data
Verify the performance of the database when it is accessed by different
applications or users
Verify the operational performance of the database when it is accessed
by different applications or users
Estimate the amount of memory space the database will take up
Examine data formatting in the database
You can generate test data for selected tables in a PDM, or for all the tables
in a PDM.
You can add test data to an empty database or to a database that already
contains data.
You generate test data for a table based on test data profiles. A test data
profile is a named class of data types that has a defined data generation
source. A test data profile can be assigned to one or more columns.
When you assign a test data profile to a column, it acts as a representative for
the data type of that column. Test data for the column is then generated using
the data profile and its defined data source.
You can also select a test data profile to apply to a domain. You can then
choose to have the profile automatically assigned to all columns that use that
domain.
A test data profile can use one of the following:
Number
Character
Date/Time
Test Data profile
Chapter 10 Database Creation and Modification
PDM User's Guide 587
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 for
Address. You can also assign it to other columns, such as Store Location, and
Client Address.
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.
The following objects are not taken into account when you generate test data:
Alternate keys
Foreign keys
Business and validation rules
Binary, sequential, OLE, text or image data types
Trigger contents
To set up a test data profile:
1 Create a test data profile for one or more columns.
2 Define a test data generation source for each data profile.
3 Define column fill parameters for columns that need to be populated
with data in a particular way.
4 Assign test data profiles to all relevant columns.
5 Use the test data profiles to generate test data.
Creating a test data profile
When you create a test data profile you need to define the following
properties:
Property Description
Name Name of the profile
Code Code of the data profile
Profile class You can assign one of the following data type classes:
Number
Character
Date/Time
Example
Default test data
profiles
Test data
restrictions
Using test data
588 PowerDesigner
When you define the profile class, make sure it reflects the DBMS
limitations, for example, some DBMS do not support dates prior to a certain
date.
You define a test data generation source for each data profile. You can use
the following test data generation sources:
Generation source Test data values are generated
Automatic By PowerDesigner
List From a list of test data values
ODBC From a target ODBC data source
File From a source file
Each data generation source has its own set of options for defining generation
parameters.
To create a test data profile:
1 Select ModelTest Data Profiles.
The List of Test Data Profiles appears.
2 Click a blank line in the list.
3 Type a test data Profile name and a profile code.
4 Select a data type class from the Profile Class dropdown listbox.
Generation source
Chapter 10 Database Creation and Modification
PDM User's Guide 589
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. For details, see the General Features Guide.
5 Click Apply.
6 Double-click the new profile to display its property sheet.
7 Define generation source parameters.
8 Click OK in each of the dialog boxes.
Automatic test data generation source parameters
There are different automatic test data generation source parameters for each
profile class.
Defining an automatic test data generation source for numbers
You have the following options to define generation source parameters for
the profile class Number:
Option Description
Random Indicates to generate random data
Sequential Indicates to generate sequential data
From/To Indicates the range for random or sequential data
Step Indicates interval between each sequential number step
Generate decimal
numbers
Generates decimal numbers
Decimal digits
number
Indicates the maximum number of decimal places to be
generated
To define an automatic data generation source:
1 Select ModelTest Data Profiles.
Using test data
590 PowerDesigner
The List of Test Data Profiles appears.
2 Double-click a test data profile using numbers.
The Profile properties sheet opens to the General page.
3 Select the Automatic radio button.
4 Click the Detail tab.
Chapter 10 Database Creation and Modification
PDM User's Guide 591
The Detail page appears.
5 Specify test data generation parameters.
6 Click OK in each of the dialog boxes.
Defining an automatic test data generation source for characters
You have the following options to define generation source parameters for
the profile class Character:
Option Parameter Description
Verify Valid characters List of authorized characters
All Accepts all characters
Invalid characters List of unauthorized characters
No accents Replaces accents with unaccented
characters
Mask String of mask characters.
Case Upper
First uppercase
Lower
Mixed
Indicates authorized letter cases
Length Exact You indicate exact character length
From/To You indicate character length range
Using test data
592 PowerDesigner
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.
Character set Syntax Example
Interval of characters Characters in single quotation
marks separated by a dash
'a'-'z'
Single character or
Character string
Characters in quotation marks "a" | "xyz"
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:
Mask
character Prompts to type
A Letter
9 Number
? Any character
To define an automatic data generation source:
1 Select ModelTest Data Profiles.
Character selection
Mask characters
Chapter 10 Database Creation and Modification
PDM User's Guide 593
The List of Test Data Profiles appears.
2 Double-click a test data profile using characters.
The Profile properties sheet opens to the General page.
3 Select the Automatic radio button.
4 Click the Detail tab.
Using test data
594 PowerDesigner
The Detail page appears.
5 Specify test data generation parameters.
6 Click OK in each of the dialog boxes.
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:
Value Parameter Description
Date range From/To Indicates range of date values
Time range From/To Indicates range of time values
Step Date/Time step Indicates date and time intervals for sequential
data values.
Values Random Indicates to generate random data
Sequential Indicates to generate sequential data
To define an automatic data generation source:
1 Select ModelTest Data Profiles.
Chapter 10 Database Creation and Modification
PDM User's Guide 595
The List of Test Data Profiles appears.
2 Double-click a data profile using date and time.
The Profile properties sheet opens to the General page.
3 Select the Automatic radio button.
4 Click the Detail tab.
Using test data
596 PowerDesigner
The Detail page appears.
5 Specify test data generation parameters.
6 Click OK in each of the dialog boxes.
Defining a list as a test data generation source
You can use information from a list to define a test data generation source for
a data profile.
To define a list as a test data generation source:
1 Select ModelTest Data Profiles.
The List of Test Data Profiles appears.
2 Double-click a data profile.
The Profile properties sheet opens to the General page.
3 Select the List radio button.
4 Click the Detail tab.
The Detail page appears.
5 Select a Value profile.
Chapter 10 Database Creation and Modification
PDM User's Guide 597
6 Type a value and label.
7 Click OK in each of the dialog boxes.
Defining an ODBC data source as a test data generation source
You can use information from an ODBC data source to define a test data
generation source for a data profile.
To define an ODBC data source as a test data generation source:
1 Select ModelTest Data Profiles.
The List of Test Data Profiles appears.
2 Double-click a data profile.
The Profile properties sheet opens to the General page.
3 Select the ODBC radio button.
4 Click the Detail tab.
The Detail page appears.
5 Click the Select an ODBC data source tool beside the Data source box
and select a machine or file data source.
6 Type the login and password corresponding to your data source.
7 Type the name of the table and column to query in the data source.
Using test data
598 PowerDesigner
The variables in the default query are replaced by the table and column
values.
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.
8 Click OK.
You return to the List of Test Data Profiles.
9 Click OK.
For more information on selecting an ODBC data source, see section
Selecting an ODBC data source.
Chapter 10 Database Creation and Modification
PDM User's Guide 599
Selecting an ODBC data source
The Select an ODBC Data Source dialog box lets you define the following
parameters:
Parameter Description
Machine data source This data source is created on the client machine, and is
available to the user currently logged onto the system.
Machine data sources are stored in the part of the registry
containing settings for the current user
File data source This data source is stored as a file. A file data source has
the extension .dsn. It can be used by different users if it is
placed in the default location for file data sources. File
data sources are usually managed by database
administrators
Setup Displays the ODBC Configuration dialog box for the
selected DBMS
Add Displays the ODBC Data Source Administrator dialog
box for creating a data source
Defining a file as a test data generation source
You can import a CSV file to define a data generation source for a data
profile. You can define the following generation source parameters for the
CSV file:
Value Parameter Description
Values Random Indicates to import file lines in random order
Sequential Indicates to import file lines sequentially
Each CSV file that you import for each data profile must come from the same
directory. If you have not previously used this directory as a CSV file test
data source, you will need to select the correct directory to define the file
path.
Example test data files
PowerDesigner provides example test data files in the \TESTDATA
directory.
CSV import
restriction
Using test data
600 PowerDesigner
To define a file as a test data generation source:
1 Select ModelTest Data Profiles.
The List of Test Data Profiles appears.
2 Double-click a data profile.
The Profile properties sheet opens to the General page.
3 Select the File radio button.
4 Click the Detail tab.
The Detail page appears.
A dialog box asks you to select a file.
Specifying the CSV directory
If you are importing a CSV file for the first time from a specific
directory, you need to select the appropriate directory.
5 Select a file and click Open.
You return to the Detail page.
6 Specify test generation parameters.
Chapter 10 Database Creation and Modification
PDM User's Guide 601
7 Click OK.
You return to the List of Test Data Profiles.
8 Click OK.
Defining column fill parameters
Fill parameters determine how a column is filled or populated with test data.
You can define column fill parameters when you assign a data profile to the
column, or as an independent procedure.
You can define the following fill parameters:
Value Description
Null values Percentage of column entries containing a null value
Distinct values Indication of the percentage of column rows that contain unique
entries. This is a maximum value, and can change automatically
depending on the referential integrity parameters of primary key
columns. Alternately, a specific value can be entered, without a
percentage sign, to indicate the exact number of column rows
that contain unique entries.
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.
The following column properties are indicated on the Columns sheet:
Indicator Property When selected, indicates that
M Mandatory Column must be assigned a value. The fill
parameter Null value is automatically defined as 0%
U Unique
column
Column is the only column in a primary key,
alternate key, or unique index. The fill parameters
Null Values and Distinct Values are automatically
defined as 0% and 100% respectively
F Foreign Column is a foreign key column. You cannot assign
a data profile to this column. It automatically takes
the data profile of the corresponding primary key
column in the parent table
Indicated column
properties
Using test data
602 PowerDesigner
To define column fill parameters:
1 Select ModelTables.
The List of tables appears.
2 Double-click a table from the list.
The Profile properties sheet opens to the General page.
3 Select the Columns tab.
The Columns page appears.
Chapter 10 Database Creation and Modification
PDM User's Guide 603
4 Double-click a column name.
The Column properties dialog box appears.
5 Select the Detail tab.
The Detail page appears.
6 Select or type Column fill parameters.
7 Select a profile from the test data parameters dropdown list box.
8 Click OK in each dialog box.
You return to the Columns page.
9 Click OK.
Assigning a data profile
When you assign a data profile to a column, the data profile defines the type
of test data that you generate for that column.
You can assign a data profile to each column in a table, except for the foreign
key columns. The data profiles for foreign keys are assigned by default.
When you assign a data profile to a column that contains check parameters,
the generated test data respects the column constraints.
Using test data
604 PowerDesigner
There are three approaches to assigning data profiles:
Assign a data profile from the list of tables
Assign a data profile from the list of columns
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.
Assigning a data profile from the list of tables
To assign a data profile from the list of tables:
1 Select ModelTables.
The List of tables appears.
2 Double-click a table in the list.
The table property sheet opens to the General page.
Chapter 10 Database Creation and Modification
PDM User's Guide 605
3 Select the Columns tab.
The Columns page appears.
4 Select a column in the list.
5 Select a test data profile from the dropdown list box.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. For details, see the General Features Guide.
6 Click OK.
Using test data
606 PowerDesigner
Assigning a data profile from the list of columns
To assign a data profile from the list of columns:
1 Select ModelColumns.
The List of Columns appears.
2 Select a column in the list.
3 Select a test data profile from the dropdown list box.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool. For details, see the General Features Guide.
4 Click OK.
Chapter 10 Database Creation and Modification
PDM User's Guide 607
Importing a data profile
You can import data profiles in XPF format from another PDM. The
imported profiles appear in the list of profiles.
To import a data profile:
1 Select ToolsTest Data ProfilesImport.
A standard Open dialog box appears.
2 Browse to the EXAMPLES/TUTORIAL directory.
3 Select or type a file name with the XPF extension.
4 Click Open.
Exporting a data profile
You can export data profiles to a XPF file. In another PDM, you can then
import the data profiles defined in this XPF file.
To export a data profile:
1 Select ToolsTest Data ProfilesExport.
A Selection dialog box appears.
2 Select one or more data profiles that you want to export.
Using test data
608 PowerDesigner
3 Click OK.
A dialog box appears.
4 Type a file name with the XPF extension.
5 Click Save.
Generating test data
You can generate test data for all the tables in a PDM, or for selected tables.
You can define the following test data generation parameters for a table:
Parameter Result of selection
Script generation Generates script in DBMS-specific syntax instead of
ODBC syntax
ODBC generation Generates script in ODBC syntax instead of DBMS-
specific syntax
Delete old data Deletes all existing test data
Default number of rows Indicates default number of rows for table
Default number profile Indicates default number profile for table
Default character profile Indicates default character profile for table
Default date profile Indicates default date profile for table
Test data
generation
Chapter 10 Database Creation and Modification
PDM User's Guide 609
You can indicate the number of rows of test data that are generated for each
table in the model:
List item Description
Name Tables in the database
Number Number of rows indicated for each table as defined in the
table property sheet
Test number Number of rows of test data for each table that you want to
generate. You can modify this value. The default number of
rows is the value defined for the tables in the Test Data
Generation tab. If you have not defined a default value, a
value is assigned automatically
You can define the following test data options for a table:
Option Result of selection
Auto Commit automatically during script generation
At end Commit at end of script generation
By packet Commit at defined intervals during script generation
Owner prefix Add owner prefix
Titles Each section of the script includes commentary in the form of
titles
CSV Format Generates script in CSV file format. The decimal and list
separators used in CSV file format are defined in the regional
settings configuration of your computer
Check model Check the PDM before generating the test database or script,
and stop generation if an error is found
Encoding Encoding format to use for test data generation. You should
select the encoding format that supports the language used in
your model and the database encoding format
Upper Script contains all uppercase characters
Lower Script contains all lowercase characters
Mixed Script contains both uppercase and lowercase characters
No accent Non-accented characters replace accented characters in script
Number of rows
Options
Using test data
610 PowerDesigner
You can generate data for either an empty database or for an existing
database.
Avoid generating triggers
Do not implement triggers if you generate a new database. It is also
recommended that you remove triggers from an existing test database.
Triggers can considerably increase the time required to generate the
database and can block insertions. In addition, they are not needed for the
type of test we are performing.
Generating test data for a script
To generate test data for a script:
1 Assign data profiles to the columns in each table that you want to
generate test data for.
Default values for data profiles
Test data generation is typically based on user-defined data profiles.
If you have no data profile definitions, you are automatically provided
with default values and the value <default> appears in each of the
following three default profile boxes.
2 Select DatabaseGenerate Test Data.
The Test Data Generation dialog box opens to the Test Data Generation
page.
Chapter 10 Database Creation and Modification
PDM User's Guide 611
3 Select the Script generation radio button.
4 Select or type the test data generation parameter values.
Using test data
612 PowerDesigner
5 Click the Number of Rows tab.
The Number of Rows page appears.
6 Select a table.
7 Type a Test Number for the table.
8 Repeat steps 6 and 7 for any other table, as required.
Chapter 10 Database Creation and Modification
PDM User's Guide 613
9 Click the Options tab.
The Options page appears.
10 Select or type the test data generation parameter values.
11 Click the Selection tab.
The Selection page appears.
12 Select one or more tables from the list.
13 Click OK to start the generation.
A Result dialog box asks you if you want to Edit or Close the newly
generated file.
Using test data
614 PowerDesigner
14 Click Edit to see and modify the newly generated data or Close.
Generating test data for ODBC
To generate test data for ODBC:
1 Assign data profiles to the columns in each table that you want to
generate test data for.
Default values for data profiles
Test data generation is typically based on user-defined data profiles.
If you have no data profile definitions, you are automatically provided
with default values. The default number of rows is set to 20 and the
value <default> appears in each of the following three default profile
boxes.
2 Select DatabaseGenerate Test Data.
The Test Data Generation dialog box opens to the Test Data Generation
parameters page.
Chapter 10 Database Creation and Modification
PDM User's Guide 615
3 Select the ODBC Generation radio button.
4 Select or type the test data generation parameter values.
5 Click the Number of Rows tab.
Using test data
616 PowerDesigner
The Number of Rows page appears.
6 Select a table and type a Test Number for the table.
7 Repeat the last step for any other table, as required.
Chapter 10 Database Creation and Modification
PDM User's Guide 617
8 Click the Options tab.
The Options page appears.
9 Select or type the Test Data Generation parameter values.
10 Click the Selection tab.
The Selection page appears.
11 Select one or more tables from the list.
12 Click OK to start the generation.
Using test data
618 PowerDesigner
A Connect to an ODBC Data Source dialog box appears.
13 Select the Machine data source radio button and select a data source in
the dropdown list box.
or
Select the File data source radio button and select a file.
14 Click Connect.
A message in the Output window indicates that the test data generation is
completed.
PDM User's Guide 619
C H A P T E R 1 1
Managing Database Access
This chapter explains how to manage access to the database using privileges
and permissions, and defining users, groups, roles, and object synonyms.
Topic Page
Understanding database access management 620
Managing database users 621
Managing system privileges 629
Managing object permissions 634
Generating privileges 644
Managing synonyms 648
About this chapter
Contents
Understanding database access management
620 PowerDesigner
Understanding database access management
In this manual, we call database access management the set of tools that let
the users of the database carry out their jobs effectively while preserving
privacy and integrity of information within the database.
Depending on the target DBMS, the setting up of a secure database
environment implies the following tasks:
Create users, groups, and roles
Define the privileges of users, groups, and roles
Define permissions over PDM objects
The Physical Data Model supports these concepts and lets you:
Recover database security items during reverse engineering
Design and generate database security items
During reverse engineering by script, make sure the permission and privilege
grant orders are in the same script as the user, group, or role creation orders
to be properly recovered in the model.
This does not apply to ODBC reverse engineering.
Reverse
engineering
Chapter 11 Managing Database Access
PDM User's Guide 621
Managing database users
People allowed to connect to the database are called users. Users may have a
role that specifies their responsibility as database users. Users can be
gathered in groups in order to factorize their rights.
This section explains how to define database users, roles and groups.
Note
Not all DBMS support the concepts of user, role and group. For example,
Sybase Adaptive Server Anywhere does not support roles whereas Sybase
Adaptive Server Enterprise does. For more information on which concept
is supported, see the documentation of your DBMS
Defining a user
User is a term that identifies a person working with objects in a PDM. In the
database, a user is a database object that identifies a person who can login or
connect to the database.
A user can own other objects in the PDM. You can create a user and then
attach the user to an object.
User vs owner
In the database The user who creates an object (table, view, stored
procedure and so on) owns this object and is automatically granted all
permissions on it.
For more information on object permissions, see section Managing
object permissions.
In the PDM You have to attach a user to an object in order to make it
become the owner of the object. Each object can only have one owner at a
time. For example, when you create a table, by default the object has no
owner. You can select a user name from a list of users, and attach it to the
table. This user then becomes the owner of the table.
Owners are used to manage object modifications in a PDM. In a model where
many users have access to the same objects, you can restrict object
modifications to the owner and define permissions for the other users.
Managing database users
622 PowerDesigner
Owners can also be used during generation: when you select to generate for a
selected owner, only the tables belonging to this owner are generated,
whereas when you generate as ADMIN, you generate all the tables on behalf
of all their owners.
Creating a user
You need to create a user before you can attach him/her to an object or define
his/her permissions. Users have the following properties:
Property Description
Name Name of the user
Code Code of the user used as identifier in the database
Comment Descriptive label for the user
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Password Password that may be used for database connection
A comprehensive definition of a user also includes privileges and
permissions over database objects; these topics are explained in sections
Managing system privileges and Managing object permissions.
To create a user:
1 Select ModelUsers and RolesUsers.
The List of Users appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Click Apply.
4 Click the Properties tool.
The user property sheet appears.
5 Type a user name and a user code.
Chapter 11 Managing Database Access
PDM User's Guide 623
6 Type a user password for further database connection.
7 Click OK.
Assigning an object owner
You can attach an object to a user in a PDM. When you attach an object to a
user, the user becomes the owner of that object. You can attach a user to
various types of PDM objects such as tables, views, sequences, or database
packages.
To attach an object to a user:
1 Double-click an object in the diagram.
or
Double-click an object in a list.
The object property sheet appears.
2 Click the down arrow at the end of the Owner dropdown listbox.
The list displays all the users defined in the model.
3 Select a user from the dropdown list.
Managing database users
624 PowerDesigner
The user name appears in the Owner box.
4 Click OK.
Defining a role
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.
Creating a role
A role is identified by a name and a code.
A comprehensive definition of a role also includes privileges and permissions
over database objects; these topics are explained in sections Managing
system privileges and Managing object permissions.
To create a role:
1 Select ModelUsers and Roles Roles.
The List of Roles appears.
Chapter 11 Managing Database Access
PDM User's Guide 625
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Click Apply.
4 Click the Properties tool.
The role property sheet appears.
5 Type a role name and code.
6 Click OK.
Assigning a role
You assign a role to a user, or another role from the role property sheet.
To assign a role to a user:
1 Double-click a role in the List of Roles to display the role property sheet.
2 Click the Users tab to display the Users page.
3 Click the Add Objects tool.
A user selection dialog box appears.
Managing database users
626 PowerDesigner
4 Select one or several users and click OK.
The user appears in the list of users to which the current role is assigned.
5 Click OK.
Defining a group
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.
Creating a group
Groups have the following properties:
Property Description
Name Name of the group
Code Code of the group used as identifier in the database
Comment Descriptive label for the group
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Chapter 11 Managing Database Access
PDM User's Guide 627
Property Description
Password Password that may be used for database connection
To create a group:
1 Select ModelUsers and Roles Groups.
The List of Groups appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Click Apply.
4 Click the Properties tool.
The group property sheet appears.
5 Type a group name and a group code.
6 Type a group password for further database connection.
7 Click OK.
Managing database users
628 PowerDesigner
Inserting a user into a group
Once you have defined the group, you can insert users into it. You insert
users into a group from the group property sheet.
To insert a user into a group:
1 Double-click a group in the List of Groups to display the group property
sheet.
2 Click the Users tab to display the Users page.
3 Click the Add Objects tool.
A user selection dialog box appears.
4 Select one or several users and click OK.
The user appears in the list of users belonging to the current group.
5 Click OK.
Chapter 11 Managing Database Access
PDM User's Guide 629
Managing system privileges
A system privilege is a set of rights assigned to a database user, group, or
role.
You have to define these privileges in order to complement the definition of
the different database actors. System privileges draw different user profiles
with more or less influence over the database content.
System privileges have to be associated with object permissions to evaluate
the rights of a user, group, or role. For example, if a user has the modify
privilege, he cannot modify an object on which he has no update permission.
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.
Analyzing system privileges
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, which means the user is authorized
to use a certain privilege. 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.
Defining system privileges
You define the privileges of a user, group, or role from the property sheet of
this object. The procedure for defining privileges is identical for users,
groups, and roles. In this section, we will use the user example, keeping in
mind that the procedure is identical for groups and roles.
Managing system privileges
630 PowerDesigner
When you define system privileges for a user you have to:
Select one or several privileges from a list of authorized privileges in the
DBMS
Define the way you grant the privilege
Adding a system privilege
You can add a system privilege to the list of available privileges from the
DBMS editor. To do so, select Database Edit Current DBMS, expand
categories Script\Objects\Privileges and type each new system privilege on
a new line at the end of the list of privileges in the Value box
The following tools are available:
Tool Description
Grant Privilege is assigned to user. By default, any selected
privilege is granted to the user and the Grant checkmark
appears in the Status column
Grant with admin
option
Extended privilege that allows the grantee to pass on the
privilege to other users; groups, or roles. For example, you
select the CREATE TABLE privilege for user Designer_1.
Then you click the Grant With Admin Option button. This
implies that Designer_1 is allowed to grant the CREATE
TABLE privilege to other users. This tool is not available in
all DBMS
Revoke The privilege inherited from a group or role is revoked to
the current user or group. Revoke is only available when
the user inherits a privilege from a group or a role
None To cancel any state and clean up the current cell
By default, a user belonging to a group or having a role inherits the group or
role privileges. Inherited privileges appear in the Privileges page of the user
property sheet.
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:
Privilege
combination Description
Privilege granted to user
Inherited privileges
Chapter 11 Managing Database Access
PDM User's Guide 631
Privilege
combination Description
Privilege inherited from group
Privilege inherited from group and revoked to user
Privilege inherited from group overloaded by "with admin
option"
To define system privileges for a user:
1 Open the property sheet of a user and click the Privileges tab.
The Privileges page appears.
2 Click the Add Objects tool.
A selection dialog box appears, to let you select one or several privileges
authorized in your current DBMS.
3 Select one or several privileges.
4 Click OK.
The privileges appear in the list of privileges of the current user. By
default, privileges are granted.
Managing system privileges
632 PowerDesigner
In the example below, the privileges in red are granted to the group to
which the user belongs.
5 Click inside the cell corresponding to the privilege state you want to
define.
or
Select several privileges and click inside one of the cells corresponding
to the privilege state you want to define.
A state automatically appears in the cell.
6 Click again in the cell until the desired state appears.
or
Select a state in the Privilege State groupbox in the lower part of the
dialog box.
Chapter 11 Managing Database Access
PDM User's Guide 633
You modify the status of the privilege.
7 Click Apply.
Managing object permissions
634 PowerDesigner
Managing object permissions
Object permissions are usage restrictions set on a particular database object
for a particular user, group or role.
In PowerDesigner, you can define permissions on tables, views, columns,
procedures, packages, and other objects depending on your DBMS.
Analyzing object permissions
Object permissions are restricted to certain PDM objects and vary according
to the DBMS you are using:
Permission Description
Select To observe information contained in object
Insert To insert rows into object
Alter To alter table with ALTER TABLE command
Delete To delete rows from object
References To create indexes in tables and foreign key referencing tables
Update To update row in object
Index To create an index with the CREATE INDEX command
Execute To execute procedure or function
For more information on the permissions allowed in your DBMS, see
your DBMS documentation.
The owner of an object automatically has permission to carry out any
operation on that object. These permissions do not appear in the Permissions
page of the object property sheet but they are implemented during generation
and reverse engineering.
Defining object permissions
You can define permissions from the property sheet of a user, group, or role
or from the object property sheet.
Object owner
Chapter 11 Managing Database Access
PDM User's Guide 635
Defining permissions for a user
You can define in the same way permissions for a user, a group, or a role. In
this section, we focus on the user case, but the process can be used with
groups and roles.
The Permissions page is divided in two zones:
The list in the upper part of the page contains columns corresponding to
selected objects and different permissions allowed in the current DBMS.
You can select multiple objects in this list
The Permission State groupbox contains buttons for selecting the state of
each permission for a given object
The following states are available:
Grant option Description
Grant Permission is assigned to user
Revoke Permission inherited from a group or role is revoked for
the current user. Revoke is only available when the user
inherits a privilege from a group or a role
Grant with grant option Grantee has the right to pass on the permission to other
users
Revoke with cascade User no longer has permission and the same occurs to
all users who were granted permissions by the grantee
None To cancel any state and clean up the current cell
When you define the permissions for a user you have to:
Select the objects on which the user will have permissions
Define the state of each permission for a given object
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 page:
Tool Action
Adds users that inherit permissions
Hides users that do not inherit permissions
Inherited
permissions
Managing object permissions
636 PowerDesigner
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
combination Description
Permission granted to user
Permission inherited from group
Permission granted to group and revoked to user
Permission granted to group and overloaded by "with admin
option"
Permission granted to group and revoked with cascade to user
To define permissions for a user:
1 Open the property sheet of a user and click the Permissions tab.
The Permissions page appears, it displays a list of permissions. The
different columns in the list correspond to permissions allowed for a
given type of object in the current DBMS. The different tabbed pages
correspond to objects supporting permissions in the current DBMS.
2 Click the Add Objects tool.
A selection dialog box appears with object of the same type.
3 Select one or several objects and click OK.
Chapter 11 Managing Database Access
PDM User's Guide 637
The selected objects appear in the list in the selected page. If the current
user belongs to a group with permissions on the selected objects, these
permissions appear in red in the list.
4 Click inside the cell corresponding to the permission state you want to
define.
or
Select several objects and click inside one of the cells corresponding to
the permission state you want to define for these objects.
A state automatically appears in the cell.
5 Click again in the cell until the desired state appears.
or
Select a state in the Permission State groupbox in the lower part of the
dialog box.
You define the state of the permission.
Managing object permissions
638 PowerDesigner
6 Repeat the previous step for each permission of a given object and for
each selected object.
7 Click OK.
Defining permissions from the object property sheet
The Permissions page is divided in two zones:
The list in the upper part of the page contains columns corresponding to
different users and the permissions allowed in the current DBMS
The Permission State groupbox contains buttons for selecting the status
of each permission for the current object
The following states are available:
Grant option Description
Grant Permission is assigned to user
Revoke Permission inherited from a group or role is revoked for
the current user. Revoke is only available when the user
inherits a privilege from a group or a role
Grant with grant option Grantee has the right to pass on the permission to other
users
Revoke with cascade User no longer has permission and the same occurs to
all users who were granted permissions by the grantee
Chapter 11 Managing Database Access
PDM User's Guide 639
Grant option Description
None To cancel any state and clean up the current cell
When you define the permissions for an object you have to:
Select the users, groups, or roles that will have permissions on the
current object. In this section, we shall use the example of a user
Define the state of each permission for a given user
For more information on inherited permissions, see section Defining
permissions for a user.
To define permissions from the object property sheet:
1 Open the property sheet of an object and click the Permissions tab.
The Permissions page appears, it displays a list of permissions. The
different columns in the list correspond to permissions allowed for the
current object in the DBMS. By default the User tab is selected.
2 Click the Add Objects tool.
A selection dialog box appears to let you select users.
3 Select one or several users and click OK.
Managing object permissions
640 PowerDesigner
The selected users appear in the list. The list displays in red already
defined permissions if the user belongs to a group with permissions.
4 Click inside the cell corresponding to the permission state you want to
define.
or
Select several objects and click inside one of the cells corresponding to
the permission state you want to define for these objects.
A state automatically appears in the cell.
5 Click again in the cell until the desired state appears.
or
Select a state in the Permission State groupbox in the lower part of the
dialog box.
You define the state of the permission.
Chapter 11 Managing Database Access
PDM User's Guide 641
6 Repeat the previous step for each permission.
7 Repeat the previous steps for each role and group.
8 Click OK.
Defining column permissions
You can fine tune the permissions on a table by defining column permissions
for a user, a group or a role. Available column permissions are specified in
the DBMS resource file.
For more information on the permissions available for columns, see
section Analyzing object permissions.
Column permissions are predefined for a given DBMS, any new or modified
permission may not be supported during generation or reverse.
Managing object permissions
642 PowerDesigner
To define column permissions:
1 Select a user, a group or a role in the Permissions page in the table
property sheet.
2 Click the Ellipsis button beside the Columns box in the lower part of the
dialog box.
The Column Permissions dialog box appears.
3 Click inside the cell corresponding to the permission state you want to
define.
A state automatically appears in the cell.
4 Click again in the cell until the desired state appears.
or
Select a state in the Permission State groupbox in the lower part of the
dialog box.
Chapter 11 Managing Database Access
PDM User's Guide 643
You define the permission state for each column.
5 Click OK in the Column Permissions dialog box.
In the Permissions page of the object property sheet, the cells
corresponding to selected column permissions appear with ellipsis
buttons.
6 Click OK.
Generating privileges
644 PowerDesigner
Generating privileges
You can generate database privileges in two ways:
Directly execute a script on a connected data source using an ODBC
driver
Generate a script to be executed on a DBMS at a later time
In both cases, the generation commands are saved in a script file. You must
always provide the following information about the script file:
Parameter Description
Directory Destination directory for the script file
File name Destination filename for the script file
One file only When selected creates one script file, instead of a separate script
file for each table
Generation
type
Privilege generation by script or using ODBC
The Options tab lets you access the script options for script formatting.
For more information on script options, see section Generation script
options in chapter Database Creation and Modification.
The Selection tab lets you select objects for generation from a particular
model.
For more information on object selection, see section Selecting objects
for generation in chapter Database Creation and Modification.
Creation parameters for users, groups and roles
Creation parameters indicate what to generate from the privileges defined in
the PDM.
The availability of these privileges depends on the target DBMS. Unavailable
parameters display in gray and you cannot select them.
Parameter Result of selection
Create user Generate user
Privileges Generate the user privileges
Drop user Delete an existing user, before creating a new user
User creation
parameters
Chapter 11 Managing Database Access
PDM User's Guide 645
Parameter Result of selection
Create group Generate group
Privileges Generate the group privileges
Drop group Delete an existing group, before creating a new group
Parameter Result of selection
Create role Generate role
Privileges Generate the role privileges
Drop role Delete an existing role, before creating a new role
Group creation
parameters
Role creation
parameters
Generating privileges
646 PowerDesigner
Generating privileges
PowerDesigner lets you generate privileges directly or using a script.
To generate privileges:
1 Select DatabaseGenerate Privileges.
The Privilege Generation dialog box appears. It lists generation
parameters for users, groups, and roles.
2 Type a destination directory for the script file in the Directory box.
3 Type a destination filename for the script file in the File Name box.
4 Select the Script generation radio button.
or
Select the ODBC generation radio button.
5 Select creation parameters for users, groups, and roles.
6 Click the Options tab.
The Options page appears. It lists formatting, checking, and archiving
options for the generated script.
Chapter 11 Managing Database Access
PDM User's Guide 647
7 Select script options.
8 Click the Selection tab.
The Selection page appears.
9 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
10 Click OK.
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 appears. It lists the file path of the generated script file.
11 Click the Close button to close the Result box.
or
If you want to edit the script, click the file path in the result box and
click the Edit button.
The script opens up in a text editor.
Managing synonyms
648 PowerDesigner
Managing synonyms
A synonym is an alternative name for various types of objects (table, view,
sequence, procedure, function, synonym or database package). Most of the
time, synonyms are created by a database administrator as they can be used
to:
Mask the name and owner of an object
Provide location transparency for remote objects of a distributed
database
Simplify SQL statements for database users
For example, table SALES_DATA is owned by user JWARD. A standard
select statement on this table would be:
SELECT * FROM jward.sales_data
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
Defining a synonym
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 page of the base
object property sheet.
If you delete the base object of a synonym, the synonym is deleted as well.
Synonyms have the following properties:
Property Description
Name Name of the synonym (usually corresponding to a simplified
name of the base object)
Code Code of the synonym
Comment Additional information about the synonym
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Example
Chapter 11 Managing Database Access
PDM User's Guide 649
Property Description
Owner Name of the synonym owner. You choose an owner from a list of
users. A synonym can only have one owner at a time
Base Object Name of the object origin of the synonym. The Ellipsis button
displays a selection dialog box that lets you select objects among
all the models opened in the current workspace and belonging to
the same DBMS family as the current DBMS
Visibility Allows to define a synonym as public (accessible to all database
users) or private (available to a specific user)
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
For more information on aliases, see the DB2 documentation.
Creating a synonym
Synonyms do not have symbols; you have to create them from the Browser or
the List of Synonyms.
In the List of Synonyms, the Create Synonyms tool displays a selection
dialog box in which you can select base objects for the synonyms you want to
create. You can also use the Add a Row tool, but in this case, you should not
forget to define the synonym base object from the synonym property sheet.
To create a synonym:
1 Select ModelSynonyms.
The List of Synonyms appears.
2 Click the Create Synonyms tool.
Managing synonyms
650 PowerDesigner
A Selection dialog box appears, it displays different pages corresponding
to the available objects in the model.
3 Select one or several objects in the different tabbed pages and click OK.
The synonyms of the selected objects appear in the list. By default, a
synonym has the same name as its base object. If you want to display the
base object column in the list, select the Customize Columns and Filter
tool and select Base Object in the list.
4 Click Apply.
5 Select a synonym in the list and click the Properties tool to display the
synonym property sheet.
6 Define the synonym properties.
Chapter 11 Managing Database Access
PDM User's Guide 651
Modify base object
You can click the Ellipsis button beside the base object box to select
another base object to assign to the current synonym. The selection
dialog box lets you select objects among all the models opened in the
current workspace and belonging to the same DBMS family as the
current DBMS
7 Click OK.
8 Repeat steps 5 to 7 for each new synonym.
9 Click OK in each of the dialog boxes.
Creating a view for a synonym
You can create views for synonyms in the same way as you create views for
tables. The view query displays the content of the object used for the
synonym. For example, table ORDERS_PROD_DEPT has a synonym
ORDERS:
Managing synonyms
652 PowerDesigner
If you create a view for synonym ORDERS, the view query displays the
select order of the table content:
To create a view from a synonym:
1 Make sure there is no symbol selected in the diagram and select
ToolsCreate View.
A Selection dialog box appears.
2 Click the Synonyms tab to display the list of synonyms of tables or views
to select.
3 Select one or several synonyms and click OK.
The view is created with a symbol in the current diagram.
Generating synonyms
You can generate synonyms in two ways:
Directly execute a script on a connected data source using an ODBC
driver
Generate a script to be executed on a DBMS at a later time
Chapter 11 Managing Database Access
PDM User's Guide 653
In both cases, the generation commands are saved in a script file. You must
always provide the following information about the script file:
Parameter Description
Directory Destination directory for the script file
File name Destination filename for the script file
One file only When selected creates one script file, instead of a separate script
file for each table
Generation
type
Synonym generation by script or using ODBC
The Options tab lets you access the script options for script formatting.
For more information on script options, see section Generation script
options in chapter Database Creation and Modification.
The Selection tab lets you select objects for generation from a particular
model.
For more information on object selection, see section Selecting objects
for generation in chapter Database Creation and Modification.
Creation parameters indicate what to generate from the synonyms defined in
the PDM.
Parameter Result of selection
Create synonym Generate synonyms
Drop synonym Delete an existing synonym, before creating a new synonym
The Selection page in the Synonym Generation dialog box displays all
synonyms in a single list, whatever the type of their base objects. You can
generate synonyms for a selected type of base object.
For example, you select several synonyms in the Selection page. You can
choose to generate only synonyms for tables by selecting the Table check box
in the Synonyms page. If you do so, the selection in the Selection page is not
modified, but only table synonyms will be generated.
Creation
parameters for
synonyms
Generating for a
base object type
Managing synonyms
654 PowerDesigner
PowerDesigner lets you generate synonyms directly or using a script.
To generate synonyms:
1 Select DatabaseGenerate Synonyms.
The Synonym Generation dialog box appears. It lists generation
parameters.
2 Type a destination directory for the script file in the Directory box.
3 Type a destination filename for the script file in the File Name box.
4 Select the Script generation radio button.
or
Select the ODBC generation radio button.
5 Select creation parameters for synonyms.
6 Click the Options tab.
The Options page appears. It lists formatting, checking, and archiving
options for the generated script.
7 Select script options.
Generating
synonyms
Chapter 11 Managing Database Access
PDM User's Guide 655
8 Click the Selection tab.
The Selection page appears.
9 Indicate selection details and select or clear object check boxes for each
type of PDM object to generate.
10 Click OK.
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 appears. It lists the file path of the generated script file.
11 Click the Close button to close the Result box.
or
If you want to edit the script, click the file path in the result box and
click the Edit button.
The script opens up in a text editor.
Reverse engineering synonyms
PowerDesigner supports the reverse engineering of synonyms.
When you reverse engineer synonyms, the link with the base object is
preserved if both objects are reverse engineered and if the base object
appears before the synonym in the script.
You can reverse a synonym without its base object; in this case you should
not forget to define a base object for the synonym.
Managing synonyms
656 PowerDesigner
PDM User's Guide 657
C H A P T E R 1 2
Generating from a Physical Data Model
This chapter describes how to generate a PDM, a CDM, an OOM, and an
XML model from a Physical Data Model.
Topic Page
Generation basics 658
Generating a Physical Data Model from a Physical Data Model 661
Generating a Conceptual Data Model from a Physical Data Model 671
Generating an Object-Oriented Model from a Physical Data Model 683
Generating an XML Model from a Physical Data Model 693
About this chapter
Contents
Generation basics
658 PowerDesigner
Generation basics
When you generate from a Physical Data Model you can generate to a PDM,
a CDM, or an OOM. You can generate a model from a global PDM or from a
package within the model. Limiting model generation to a single package is
useful when different designers own packages of the same PDM. Designers
can generate their packages independently from others. Generating a package
results in an independent model.
You can generate from a PDM in two ways:
Generate Description
New model Creates a new model containing the objects translated from the
PDM
Updated model Creates a default model with the objects translated from the
PDM that is merged with an existing model. You can update,
delete, or add objects in the existing model (model to be
merged in the right pane) based on modifications made in the
default model (in the left pane)
For more information on merging two models, see chapter Comparing
and Merging Models in the General Features Guide.
Target models parameters
An external shortcut depends on a target object in a different model. External
shortcuts allow you to share objects between different models.
When you generate models into other models, you can preserve the link
between an external shortcut and its target model through generation.
You can use the Target Models tab to select generated models to retrieve the
corresponding target objects of external shortcuts. External shortcuts can then
be correctly linked to target objects in the correct target model.
The Target Models page displays the following columns:
Column Description
Target Models
Original target model of the shortcut (not editable)
Generated Models
Lets you select the model that will be used as the target for
the generated shortcut
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 659
The model generation process allows you to define the target object of a
shortcut in a generated model.
For example, here is the proper sequence of events for external shortcuts
generation:
Model 1 is the target model of a shortcut in Model 2
Model 1 is generated to Model 1.1
Model 2 is prepared for generation to Model 2.2 by associating
appropriate parameters in the Target Models page:
If Model 1 is still opened in the workspace The Target Model
column displays the original target model (Model 1), and its path. The
Generated Models column displays the last generated model the first time
you generate Model 1; the next time you generate Model 1, the Generated
Models column displays the last model selected. You can click the arrow
in the Generated Models column to modify the model selection in order to
allow the creation of a correctly linked shortcut.
If Model 1 is closed in the workspace The Target Model column
displays the original target model (Model 1), and its path. The Generated
Models column displays <none>. When you click into the Generated
Models column, the original target model Model 1 is automatically
opened in the workspace in order to find the models generated from
Model 1. You can use the arrow to select Model 1.1, the new target that
will allow the creation of a correctly linked shortcut in Model 2.2.
The external shortcut in Model 2.2 is correctly generated with a link to
its target object in Model 1.1.
For more information on shortcuts, see chapter Managing Shortcuts in
the General Features Guide.
You can also preserve the link between an external replication and its target
model through generation.
Generation basics
660 PowerDesigner
For more information on the generation of object replications, see
section Generating replications in chapter Managing Object Replications in
the General Features Guide.
Object selection parameters
You select objects for model generation from the Selection page.
You can display in the list, objects in the current model, or objects in
individual packages contained in the model. If you select the Include Sub-
packages tool, you can display either all objects in the current model, or all
objects in a package.
You have the following selection options:
Parent object
Include Sub-packages
tool selected
Include Sub-packages
tool not selected
Model All objects in the model
including all objects contained
in packages and sub-packages
All objects in the model
except objects contained in
packages and sub-packages
Package All objects contained in the
package including all objects
contained in sub-packages
All objects in the package
except objects contained in
sub-packages
Listing objects
contained in a
model or package
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 661
Generating a Physical Data Model from a
Physical Data Model
This section explains how to generate a Physical Data Model from a Physical
Data Model.
Why generate a PDM into a PDM?
You can generate a PDM into a PDM when you need to keep two models
synchronized during the design process.
This kind of generation allows you to create a copy of a given model and
define generation links between objects in the source PDM and their
equivalent in the generated PDM. When changes are made to the source
model, they can then be easily propagated to the generated models using the
Update Existing Model generation mode.
The generated model is the one that usually contains more information.
If you are working in a multi DBMS environment, you can use the PDM to
PDM generation to avoid generating a CDM into different PDM based on
different DBMS. You generate a PDM from the CDM, this PDM uses the
<logical model> DBMS. Then you can use this PDM to generate different
PDM for the different DBMS required as shown in the following figure:
Multi DBMS
environment
Generating a Physical Data Model from a Physical Data Model
662 PowerDesigner
<logical model> DBMS
This DBMS does not support database generation
Generating and updating a PDM
To generate a PDM, you must choose between one of the following methods:
Generate new Physical Data Model
Update existing Physical Data Model
You must indicate the following parameters when you generate a new PDM:
Parameter Description
DBMS Database Management System definition for the resulting PDM
Share The resulting PDM uses a shared DBMS definition file stored
in the DBMS library
Copy The resulting PDM uses a copy of the DBMS definition file in
the model
Name File name for the resulting PDM
Code Reference code for the resulting PDM
Configure
Model Options
Lets you define the model options for the new PDM
For more information on model options when generating a PDM from a
PDM, see section Defining PDM options in chapter Physical Data Model
Basics.
You can generate a PDM into an existing PDM.
In the Update Existing Model groupbox, the Select Model dropdown listbox
contains all the models already generated from the current model. You can
use the tooltip in the dropdown listbox to verify the workspace location and
physical path of the generated models.
Generate new
Physical Data
Model
Update existing
Physical Data
Model
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 663
When the current model has never been generated or when the generation
link is broken, the Select Model dropdown listbox is empty. You can click
the Ellipsis button beside the Select Model dropdown listbox to display a
Select Model dialog box. This dialog box lets you select a model of the
correct type to update among models available in the workspace (either open
or closed). You can use the Workspace Location and Physical Path columns
in the Select Model dialog to select the model to update.
To update an existing PDM, you must indicate the following parameters:
Parameter Description
Select Model Existing model already generated from the current model.
Current model and selected generated model are merged to
create an updated model.
The dropdown listbox displays all the models already generated
from the current model.
The Ellipsis button lets you select models available in the
workspace (either open or closed)
Preserve
Modifications
Allows a comparison and merge of the newly generated PDM
(default PDM) with the currently selected PDM
Clearing the Preserve Modifications check box
If the Preserve Modifications check box is not selected, PowerDesigner
automatically replaces the existing PDM with the newly generated PDM.
If you want to choose which objects to add or delete from the existing
PDM, you must select Preserve Modifications to compare and merge the
two PDM.
Defining DBMS preserve options
If you generate a PDM into a PDM with a different DBMS, depending on
which objects are supported by the old and new target DBMS, you can
choose to preserve or lose, the values associated with the following database
objects:
Triggers and stored procedures
Physical options for: databases, tables, indexes, primary and alternate
keys, default options, tablespaces, and storages
Database objects: databases, storages, tablespaces, abstract data types,
sequences
Extended attributes
Generating a Physical Data Model from a Physical Data Model
664 PowerDesigner
If a database object is not supported by the old or new target DBMS, the
preserve option for that object is grayed and cannot be selected. If the new
target DBMS does not support an object, you will lose the values associated
with that object when you change target DBMS.
Triggers are rebuilt when a change in DBMS family is made
If you change the target DBMS family, for example from Sybase to Oracle
or IBM DB2, triggers are automatically rebuilt
Defining PDM generation options
You can set the following general generation options from the Detail page:
Option Description
Check Model When selected, verifies the model before generating the PDM,
and stops generation if an error is found
Save Generation
Dependencies
When selected, PowerDesigner keeps track of the identity of
each generated object. It is useful when merging two PDM
which have been generated from the same PDM. Objects can
be compared and recognized as the same object, even if the
object has been modified in the merged PDM
Enable
transformations
This button is used to activate transformations during
generation.
When you click this button, the Pre-generation tab appears if
the source model contains transformations. You can select
the transformations to execute before generation.
The Extended Model Definitions tab also appears for you to
select extended model definition files to attach to the
generated model. These files may contain post-generation
transformations, in this case, the Post-Generation tab
appears to let you select the transformations you want to be
executed in the generated model. If the generation is an
update, and the generated model contains extended model
definitions with post-generation transformations, the Post-
generation tab automatically appears as soon as you click
the Enable Transformations button
Check model before generation
If you select the Check Model option, the procedure to generate a PDM
starts by checking the validity of the source PDM. A PDM results when no
errors are found. You can set check options by selecting ToolsCheck
Model.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 665
Generating a new PDM from a PDM
You can generate a PDM from a PDM or from a package in a PDM.
PowerDesigner creates a new PDM containing all the objects that you
selected to generate in the source PDM. The newly created PDM appears in
the browser and the corresponding diagram opens in the work area.
You can only generate a PDM from the active PDM diagram.
To generate a new PDM from a PDM:
1 Select ToolsGenerate Physical Data Model to display the Generate
Physical Data Model dialog box.
2 Select the Generate New Physical Data Model radio button.
3 Select a DBMS in the DBMS dropdown listbox.
4 Type a new name and code.
5 <optional> Click the Configure Model Options button to define the
options of the generated model.
Generating a Physical Data Model from a Physical Data Model
666 PowerDesigner
6 Click the DBMS Preserve Options tab to define preserve options for the
target DBMS.
7 Click the Detail tab to define options and generation parameters.
8 Click the Target Models tab to select the target models of shortcuts in
the current model.
9 Click the Selection tab to display the Selection page.
10 Select the name of a PDM from the Select Location dropdown listbox.
Generating a PDM from a package
To generate a PDM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate a PDM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
11 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
12 Click OK.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 667
The Output window shows the progress of the generation process. The
diagram of the new PDM appears in the work area.
Updating an existing PDM
There are two ways to update an existing PDM depending on whether the
Preserve Modifications option is selected or not:
Preserve
Modifications Result
Selected You can manually compare and merge an existing PDM
(right pane) with the newly generated PDM (left pane)
Not selected The existing PDM is automatically replaced by the newly
generated PDM
You can only generate a PDM from the active PDM diagram window.
To update an existing PDM by generating from a PDM:
1 Select ToolsGenerate Physical Data Model to display the Generate
Physical Data Model dialog box.
2 Select the Update Existing Physical Data Model radio button.
Generating a Physical Data Model from a Physical Data Model
668 PowerDesigner
3 Select a model from the Select Model dropdown listbox if the current
model has already been generated.
or
Click the Ellipsis button beside the Select Model dropdown listbox and
select a model available in the workspace in the Select a Model dialog
box.
Preserve modifications
If you want to preserve objects in the PDM, then the Preserve
Modification check box must be selected. If you clear this check box,
all existing objects in the target PDM will be removed from the
model, leaving only the objects generated from the source PDM.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 669
4 Click the DBMS Preserve Options tab to define preserve options for the
target DBMS.
5 Click the Detail tab to define options and generation parameters.
6 Click the Target Models tab to select the target models of shortcuts in
the current model.
7 Click the Selection tab to display the Selection page.
8 Select the name of a PDM from the Select Location dropdown listbox.
The default PDM is generated from this PDM.
Generating a PDM from a package
To generate a PDM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate a PDM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
9 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
10 Click OK.
Generating a Physical Data Model from a Physical Data Model
670 PowerDesigner
If you selected the Preserve Modifications check box, the Merge Models
window appears.
If you cleared the Preserve Modifications check box, the updated PDM
diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated PDM in
the left pane, and the existing PDM in the right pane. You can select
or clear object check boxes in the right pane for PDM objects that
you want to include or delete in the model to be merged.
For more information on merging models, see chapter Comparing
and Merging Models in the General Features Guide.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 671
Generating a Conceptual Data Model from a
Physical Data Model
This section explains how to generate a Conceptual Data Model from a
Physical Data Model.
Generating CDM objects
When you generate a Conceptual Data Model (CDM) from a PDM,
PowerDesigner translates physical objects to conceptual objects as follows:
Object in a PDM Generated object in a CDM
Table Entity
Table column Entity attribute
Primary key Primary identifier
Alternate key Identifier
Reference Relationship
When a CDM is generated from a PDM, the data type of a table column
attached to a sequence is translated to a serial data type in the new model.
The resulting CDM serial data type for an entity property has the format
NO%n, where %n is a number indicating the length of the data type.
For more information on sequences, see sections on Oracle and
Interbase in chapter DBMS-specific Features.
Translating PDM to CDM data types
PowerDesigner supports both physical and conceptual data types. The
following table lists the physical data types to which PowerDesigner assigns
translations:
Translation
example for SQL
Anywhere
Code in
DBMS What it stores
Conceptual
data type
integer I 32-bit integer Integer
smallint SI 16-bit integer Short Integer
Oracle 8 and
Interbase
sequence
translation
Numeric data types
Generating a Conceptual Data Model from a Physical Data Model
672 PowerDesigner
Translation
example for SQL
Anywhere
Code in
DBMS What it stores
Conceptual
data type
integer LI 32-bit integer Long Integer
smallint BT 256 values Byte
numeric N Numbers with a fixed
decimal point
Number
decimal DC Numbers with a fixed
decimal point
Decimal
float F 32-bit floating decimal
numbers
Float
real SF Less than 32-bit
floating decimal
number
Short Float
double LF 64-bit floating decimal
numbers
Long Float
numeric MN Numbers with a fixed
decimal point
Money
numeric NO Automatically
incremented numbers
Serial
numeric(1) BL Two opposing values
(true/false; yes/no; 1/0)
Boolean
Translation
example for SQL
Anywhere DBMS What it stores Conceptual data type
char A Character strings Characters
varchar VA Character strings Variable Characters
varchar LA Character strings Long Characters
long varchar LVA Character strings Long Var Characters
long varchar TXT Character strings Text
char MB Multibyte
character strings
Multibyte
varchar VMB Multibyte
character strings
Variable Multibyte
Character data
types
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 673
Translation
example for
SQL Anywhere DBMS What it stores
Conceptual data
type
Date D Day, month, year date
Time T Hour, minute, and
second
time
Date & Time DT Date and time timestamp
Timestamp TS System date and time timestamp
Translation
example for SQL
Anywhere DBMS What it stores
Conceptual data
type
binary BIN Binary strings Binary
long binary LBIN Binary strings Long Binary
long binary PIC Images Image
long binary BMP Images in bitmap
format (BMP)
Bitmap
long binary OLE OLE links OLE
char(10) * User-defined data
type
Other
<undefined> <UNDEF> Not yet defined
data type
Undefined
Generating and updating a CDM
To generate a CDM, you must choose between one of the following methods:
Generate new Conceptual Data Model
Update existing Conceptual Data Model
You must indicate the following parameters when you generate a new CDM:
Parameter Description
Name File name for the resulting CDM
Code Reference code for the resulting CDM
Time data types
Other data types
Generate new
Conceptual Data
Model
Generating a Conceptual Data Model from a Physical Data Model
674 PowerDesigner
Parameter Description
Configure Model
Options
Lets you define the model options for the new CDM
For more information on model options when generating a CDM from a
PDM, see Defining CDM generation options.
You can generate a PDM into an existing CDM.
In the Update Existing Model groupbox, the Select Model dropdown listbox
contains all the models already generated from the current model. You can
use the tooltip in the dropdown listbox to verify the workspace location and
physical path of the generated models.
When the current model has never been generated or when the generation
link is broken, the Select Model dropdown listbox is empty. You can click
the Ellipsis button beside the Select Model dropdown listbox to display a
Select Model dialog box. This dialog box lets you select a model of the
correct type to update among models available in the workspace (either open
or closed). You can use the Workspace Location and Physical Path columns
in the Select Model dialog to select the model to update.
To update an existing CDM, you must indicate the following parameters:
Parameter Description
Select Model Existing model already generated from the current model.
Current model and selected generated model are merged to
create an updated model.
The dropdown listbox displays all the models already generated
from the current model.
The Ellipsis button lets you select models available in the
workspace (either open or closed)
Preserve
Modifications
Allows a comparison and merge of the newly generated CDM
(default CDM) with the currently selected CDM
Update existing
Conceptual Data
Model
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 675
Clearing the Preserve Modifications check box
If the Preserve Modifications check box is not selected, PowerDesigner
automatically replaces the existing CDM with the newly generated CDM.
If you want to choose which objects to add or delete from the existing
CDM, you must select Preserve Modifications to compare and merge the
two CDM.
Configuring the generated model options
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 options are model options found in both models. The Enforce
non-divergence option exists in both PDM and CDM.
PDM option CDM option Result in generated CDM
Enforce non-
divergence
Enforce non-divergence in model
according to PDM options. Data items
and attributes attached to the domain
cannot have divergent definitions
Enforce non-
divergence
Enforce non-divergence in model
according to CDM options defined using
the Configure Model Options feature
Unique Code for relationships is not selected by default in the CDM options.
However, if you select Unique Code for relationships in the CDM options,
relationships are renamed during the generation of a PDM to a CDM.
Options with no equivalent, like Enforce Profile in the PDM without any
corresponding option in a CDM, are generated using default values found in
the registry.
Defining CDM generation options
You can set the following general generation options:
Option Description
Check Model When selected, verifies the model before generating the CDM,
and stops generation if an error is found
Relationships
unique code
Generating a Conceptual Data Model from a Physical Data Model
676 PowerDesigner
Option Description
Save Generation
Dependencies
When selected, PowerDesigner keeps track of the identity of
each generated object. It is useful when merging two CDM
which have been generated from the same PDM. Objects can
be compared and recognized as the same object, even if the
object has been modified in the merged CDM
Convert Names
into Codes
When selected, object codes are generated from names using
the corresponding conversion script. This is useful when
generating models with very different naming conventions.
With this option selected, objects will have their codes
generated from their names. If you do not select this option,
generated object codes will be copied from original object
codes
Enable
transformations
This button is used to activate transformations during
generation.
When you click this button, the Pre-generation tab appears if
the source model contains transformations. You can select
the transformations to execute before generation.
The Extended Model Definitions tab also appears for you to
select extended model definition files to attach to the
generated model. These files may contain post-generation
transformations, in this case, the Post-Generation tab appears
to let you select the transformations you want to be executed
in the generated model. If the generation is an update, and the
generated model contains extended model definitions with
post-generation transformations, the Post-generation tab
automatically appears as soon as you click the Enable
Transformations button
For more information on conversion scripts, see chapter Managing
models in the General Features Guide.
Check model before generation
If you select the Check Model option, the procedure to generate a CDM
starts by checking the validity of the PDM A CDM results when no errors
are found. You can set check options by selecting ToolsCheck Model.
Generating a new CDM from a PDM
You can generate a CDM from a PDM or from a package in a PDM.
PowerDesigner creates a new CDM containing all the objects that you
selected to generate in the PDM. The newly created CDM appears in the
browser and the corresponding diagram opens in the work area.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 677
You can only generate a CDM from the active PDM diagram.
To generate a new CDM from a PDM:
1 Select ToolsGenerate Conceptual Data Model to display the CDM
Generation Options dialog box.
2 Select the Generate New Conceptual Data Model radio button.
3 Type a new name and code, otherwise the CDM will have the same name
and code as the PDM.
4 <optional> Click Configure Model Options to define the options of the
generated CDM.
5 Click the Detail tab to define options and generation parameters.
6 Click the Target Models tab to select the target models of shortcuts in
the current model.
7 Click the Selection tab to display the Selection page.
8 Select the name of a PDM from the Select Location dropdown listbox.
Generating a Conceptual Data Model from a Physical Data Model
678 PowerDesigner
Generating a CDM from a package
To generate a CDM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate a CDM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
9 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
10 Click OK.
The Output window shows the progress of the generation process. The
new CDM diagram appears in the work area.
Updating an existing CDM
There are two ways to update an existing CDM depending on whether the
Preserve Modifications option is selected or not:
Preserve
Modifications Result
Selected You can manually compare and merge an existing CDM
(right pane) with the newly generated CDM (left pane)
Not selected The existing CDM is automatically replaced by the newly
generated CDM
If the Preserve Modifications check box is selected, the Merge Models
window appears after the new CDM has been successfully generated. You
can use the Merge window to select objects to be updated, deleted, or added
to the model to be merged. The model must be open in the workspace to be
merged with a source model.
If the Preserve Modifications check box is not selected, the existing model is
replaced.
You can only generate a CDM from the active PDM diagram window.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 679
To update an existing CDM by generating from a PDM:
1 Select ToolsGenerate Conceptual Data Model to display the CDM
Generation Options dialog box.
If you do not have an CDM in the current workspace, the Update
Existing Conceptual Data Model option is not available.
2 Select the Update Existing Conceptual Data Model radio button.
3 Select a model from the Select Model dropdown listbox if the current
model has already been generated.
or
Click the Ellipsis button beside the Select Model dropdown listbox and
select a model available in the workspace in the Select a Model dialog
box.
Preserve modifications
If you want to preserve objects in the CDM, then the Preserve
Modification check box must be selected. If you clear this check box,
all existing objects in the CDM will be removed from the model,
leaving only the objects generated from the PDM.
4 Click the Detail tab to define options and generation parameters.
Generating a Conceptual Data Model from a Physical Data Model
680 PowerDesigner
5 Click the Target Models tab to select the target models of shortcuts in
the current model.
6 Click the Selection tab to display the Selection page.
7 Select the name of a PDM from the Select Location dropdown listbox.
The default CDM is generated from this PDM.
Generating a CDM from a package
To generate a CDM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate a CDM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
8 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
9 Click OK.
If you selected the Preserve Modifications check box, the Merge Models
window appears.
If you cleared the Preserve Modifications check box, the updated CDM
diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated CDM in
the left pane, and the existing CDM in the right pane. You can select
or clear object check boxes in the right pane for CDM objects that
you want to include or delete in the model to be merged.
For more information on merging models, see chapter Comparing
and Merging Models in the General Features Guide.
Migrating models from version 6
When migrating a version 6 CDM and its corresponding generated PDM to
current version, PowerDesigner automatically preserves the generation link
between the CDM and the PDM during the import process. So that if you
have modified the migrated CDM and PDM and want to regenerate the PDM
from the CDM in current version, with the Preserve Modifications option
selected, the modifications you made in the PDM are preserved.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 681
The synchronization of your models through migration is guaranteed as you
import the version 6 CDM and its corresponding version 6 PDM at once.
The migration process begins with the import of the Conceptual Model then
the import of the corresponding Physical Models.
There can be several generated PDMs for a given CDM. Note that if you fail
to select one of the corresponding PDMs to import and wish later to import it
in PowerDesigner current version, you must import again the version 6 CDM
and select again its corresponding version 6 PDMs that you want to import.
This operation is mandatory, otherwise the CDM and the previously imported
PDMs are no longer synchronized.
When migrating a version 6 PDM, you can open:
Archived models (*.apm): you avoid losing constraint names because
archived models store all constraint names without making a difference
between user defined and calculated constraints. Importing an archived
model allows you to recover all the constraint names of your version 6
PDM, which is recommended
Standard models (*.pdm): you may lose constraint names because
standard PDM do not store calculated constraint names
To migrate version 6 models to current version and keep them
synchronized:
1 Select FileImportV6 Synchronized Models.
The Import V6 Synchronized Models dialog box appears.
2 Click the Add CDM File tool in the Conceptual Data Model to import
groupbox to select the CDM to import.
Migration
procedure
Generating a Conceptual Data Model from a Physical Data Model
682 PowerDesigner
3 Click the Add PDM Files tool in the Physical Data Models to import
groupbox to select the PDMs to import.
4 Click OK.
The name of the CDM first appears in the Browser followed by the
names of the PDMs you selected for import. The CDM diagram also
appears in the diagram window.
5 Save the CDM in current version.
6 Save the PDMs in current version.
7 Save the workspace displaying the linked CDM and PDMs under a
meaningful workspace name.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 683
Generating an Object-Oriented Model from a
Physical Data Model
This chapter describes how you can generate an Object-Oriented Model
(OOM) from a Physical Data Model (PDM).
Generating OOM Objects
When you generate an Object-Oriented Model (OOM) from a PDM,
PowerDesigner translates PDM objects into specified object language objects
as follows:
PDM Object Generated object in an OOM
Domain Domain
Table Class. The cardinality of a class is translated from the
number of estimated records in a table
Table with migrated
keys from only two
other tables
Class linked with an association class between the two
classes generated by the two parent tables
Column Attribute
Key Identifier
Primary key Primary identifier
Stored-Procedures
and stored functions
attached to selected
table
If the parent table is generated as a class, the stored
procedure or the stored function is generated as an
operation attached to the class
Reference Association
OOM naming conventions
If the code of the generated OOM objects does not correspond to the
target language naming conventions, you can define a code naming
convention script to convert object names into codes. For more
information on conversion scripts, see section .convert_name &
.convert_code macros in chapter Managing Models in the General
Features Guide.
Generating an Object-Oriented Model from a Physical Data Model
684 PowerDesigner
When an OOM is generated from a PDM, the data type of a table column
attached to a sequence is translated to a serial data type in the new model.
The resulting OOM serial data type for a class attribute has the format NO%n,
where %n is a number indicating the length of the data type.
For more information on sequences, see sections on Oracle and
Interbase in chapter DBMS-specific Features.
Translating PDM to OOM data types
PowerDesigner supports both physical and object language data types.
The following table lists the physical data types to which the object language
definition assigns translations:
Physical
data type
Code in
PDM What it stores
Translation
example with
Java
Char A Character strings char
Numeric(1) BL Two opposing values
(true/false; yes/no; 1/0)
boolean
Smallint BT 256 values byte
Integer SI 16-bit integer short
Integer LI 32 bit integer integer
Integer I 32 bit integer long
Float F 32 floating point numbers float
Numeric N Numbers with a fixed
decimal point
double
Long varchar TXT Character strings String
Generating and updating an OOM
To generate an OOM, you must choose between one of the following
methods:
Generate a new Object-Oriented Model
Update an existing Object-Oriented Model
Oracle 8 and
Interbase
sequence
translation
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 685
You must indicate the following parameters when you generate a new OOM:
Parameter Description
Object Language Target object language
Share Object language for the resulting OOM uses a shared
Object language definition file stored in the Object
language library
Copy Object language for the resulting OOM uses a copy of
the Object language definition file stored in the
Object language library
Name File name for the resulting OOM
Code Reference code for the resulting OOM
Configure Model
Options
Lets you define the model options for the new OOM,
you can select the naming conventions corresponding
to the target language for example
For more information on model options when generating an OOM from
a PDM, see Defining OOM generation options.
You can generate a PDM into an existing OOM.
In the Update Existing Model groupbox, the Select Model dropdown listbox
contains all the models already generated from the current model. You can
use the tooltip in the dropdown listbox to verify the workspace location and
physical path of the generated models.
When the current model has never been generated or when the generation
link is broken, the Select Model dropdown listbox is empty. You can click
the Ellipsis button beside the Select Model dropdown listbox to display a
Select Model dialog box. This dialog box lets you select a model of the
correct type to update among models available in the workspace (either open
or closed). You can use the Workspace Location and Physical Path columns
in the Select Model dialog to select the model to update.
Generate new
Object-Oriented
Model
Update existing
Object-Oriented
Model
Generating an Object-Oriented Model from a Physical Data Model
686 PowerDesigner
To update an existing OOM, you must indicate the following parameters:
Parameter Description
Select Model Existing model already generated from the current
model. Current model and selected generated model
are merged to create an updated model.
The dropdown listbox displays all the models already
generated from the current model.
The Ellipsis button lets you select models available in
the workspace (either open or closed)
Object Language Current object language definition for the OOM
Preserve Modifications Allows a comparison and merge of the newly generated
OOM (default OOM) with the currently selected OOM
Clearing the Preserve Modifications check box
If the Preserve Modifications check box is not selected, PowerDesigner
automatically replaces the existing OOM with the newly generated OOM.
If you want to choose which objects to add or delete from the model to be
merged, you must select Preserve Modifications to compare and merge the
two OOM.
Configuring the generated model options
When you configure the options of an OOM to generate, you may define
options diverging from the PDM options.
To avoid conflicts, PowerDesigner applies the following rule for default
values of OOM options: an option defined for the generated OOM should
respect the equivalent option of the PDM.
Equivalent options are model options found in both models. The Enforce
non-divergence option exists in both OOM and PDM.
PDM option OOM option Result in generated OOM
Enforce non-
divergence
Enforce non-divergence in model
according to PDM options
Enforce non-
divergence
Enforce non-divergence in model
according to OOM options defined using
the Configure Model Options feature
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 687
Options with no equivalent, like Enforce Profile in the PDM without any
corresponding option in an OOM, are generated using default values found in
the registry.
Defining OOM generation options
You can set the following general generation options:
Option Description
Check Model When selected, verifies the model before generating the OOM,
and stops generation if an error is found
Save Generation
Dependencies
When selected, PowerDesigner keeps track of the identity of
each generated object. It is useful when merging two OOM
which have been generated from the same PDM. Objects can
be compared and recognized as the same object, even if the
object has been modified in the merged OOM
Class Prefix Prefix for a class. It can help identify a class in a model
O/R Mapping When selected, allows to define the current PDM as the data
source of the generated OOM and to create object
correspondence between PDM and OOM
Convert Names
into Codes
When selected, object codes are generated from names using
the corresponding conversion script. This is useful when
generating models with very different naming conventions
since conversion macros are used to modify codes. For
example a Java class attribute code may be "customerName"
whereas a PDM table column may be "CUSTOMER_NAME".
With this option selected, both objects will have their codes
generated from their names. If you do not select this option,
generated object codes will be copied from original object
codes
Options with no
equivalent in the
models
Generating an Object-Oriented Model from a Physical Data Model
688 PowerDesigner
Option Description
Enable
transformations
This button is used to activate transformations during
generation.
When you click this button, the Pre-generation tab appears if
the source model contains transformations. You can select
the transformations to execute before generation.
The Extended Model Definitions tab also appears for you to
select extended model definition files to attach to the
generated model. These files may contain post-generation
transformations, in this case, the Post-Generation tab
appears to let you select the transformations you want to be
executed in the generated model. If the generation is an
update, and the generated model contains extended model
definitions with post-generation transformations, the Post-
generation tab automatically appears as soon as you click
the Enable Transformations button
For more information on conversion scripts, see chapter Managing
models in the General Features Guide.
When you reverse engineer a database into a PDM and then generate an
OOM with the corresponding O/R mapping, you can use the Add Package
Hierarchy feature to create the appropriate packages in the OOM. You select
the Add Package Hierarchy command from the object model contextual
menu. For more information see chapter Generating for a language in the
OOM User's Guide.
Check model before generation
If you select the Check Model option, the procedure to generate an OOM
starts by checking the validity of the PDM . An OOM results when no
errors are found. You can set check options by selecting ToolsCheck
Model.
Generating a new OOM from a PDM
You can generate an OOM from a PDM or from a package in a PDM.
PowerDesigner creates a new OOM containing all the objects that you
selected to generate in the OOM. The newly created OOM appears in the
browser and the corresponding diagram opens in the work area.
Add package
hierarchy
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 689
You can only generate an OOM from the active PDM diagram.
To generate a new OOM from a PDM:
1 Select ToolsGenerate Object-Oriented Model to display OOM
Generation Options dialog box.
2 Select Generate New Object-Oriented Model radio button.
3 Type a new name and code, otherwise the OOM will have the same
name and code as the PDM.
4 <optional> Click Configure Model Options to define the options of the
generated OOM.
5 Click the Detail tab to define options and generation parameters.
6 Click the Target Models tab to select the target models of shortcuts in
the current model.
7 Click the Selection tab to display the Selection page.
8 Select the name of an PDM from the Select Location dropdown listbox.
Generating an Object-Oriented Model from a Physical Data Model
690 PowerDesigner
Generating an OOM from a package
To generate an OOM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate an OOM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
9 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
10 Click OK.
The Output window shows the progress of the generation process. The
new OOM diagram appears in the work area.
Updating an existing OOM
There are two ways to update an existing OOM depending on whether the
Preserve Modifications option is selected or not:
Preserve Modifications Result
Selected You can manually compare and merge the existing
OOM (right pane) with the newly generated OOM
(left pane)
Not selected The existing OOM is automatically replaced by the
newly generated OOM
If the Preserve Modifications check box is selected, the Merge Models
window appears after the new OOM has been successfully generated. You
can use the Merge window to select objects to be updated, deleted, or added
to the model to be merged. The model must be open in the workspace to be
merged with a source model.
If the Preserve Modifications check box is not selected, the existing model is
replaced.
You can only generate an OOM from the active PDM diagram window.
To update an existing OOM by generating from a PDM:
1 Select ToolsGenerate Object-Oriented Model to display the OOM
Generation Options dialog box.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 691
If you do not have an OOM in the current workspace, the Update
Existing Object-Oriented Model option is not available.
2 Select the Update Existing Object-Oriented Model radio button.
3 Select a model from the Select model dropdown listbox. This is the
existing model that you want to update.
or
Click the Ellipsis button beside the Select Model dropdown listbox and
select a model available in the workspace in the Select a Model dialog
box.
Preserve modifications
If you want to preserve objects in the OOM, then the Preserve
Modification check box must be selected. If you clear this check box,
all existing objects in the OOM will be removed from the model,
leaving only the objects generated from the PDM.
Generating an Object-Oriented Model from a Physical Data Model
692 PowerDesigner
4 Click the Detail tab to define options and generation parameters.
5 Click the Target Models tab to select the target models of shortcuts in
the current model.
6 Click the Selection tab to display the Selection page.
7 Select the name of a PDM from the Select Location dropdown listbox.
The default OOM is generated from this PDM.
Generating an OOM from a package
To generate an OOM from a package, select the package name from
the dropdown listbox in the upper left corner of the dialog box. To
generate an OOM from a sub-package, select a sub-package from the
dropdown listbox in the upper left corner of the dialog box, or select a
package name and click the Include Sub-packages tool next to this
dropdown listbox.
8 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
9 Click OK.
If you selected the Preserve Modifications check box, the Merge Models
window appears.
If you cleared the Preserve Modifications check box, the updated OOM
diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated OOM in
the left pane, and the existing OOM in the right pane. You can select
or clear object check boxes in the right pane for OOM objects that
you want to include or delete in the model to be merged.
For more information on merging models, see Comparing and
Merging Models in the General Features Guide.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 693
Generating an XML Model from a Physical Data
Model
This section explains how to generate an XML Model from a Physical Data
Model.
Generating XML Model objects
When you generate an XML model from a PDM, PowerDesigner translates
PDM objects into specified XML model objects as follows:
PDM Object Generated object in an XML model
Domain Simple Type
Table Element
Column Attribute or element (see generation options)
View Element
View column Attribute
Key Key
Index Unique
Abstract data type Complex Type
XML model naming conventions
If the code of the generated XML model objects does not correspond to
the target language naming conventions, you can define a code naming
convention script to convert object names into codes.
For more information on conversion scripts, see section .convert_name &
.convert_code macros in chapter Managing Models of the General
Features Guide.
Generating and updating an XML Model
To generate an XML Model, you must choose between one of the following
methods:
Generate new XML Model
Generating an XML Model from a Physical Data Model
694 PowerDesigner
Update existing XML Model
Generate new XML Model
You must indicate the following parameters when you generate a new XML
model:
Parameter Description
Schema language Target schema language
Share Schema language for the resulting XML model. It
uses a shared schema language definition file stored
in the XML Languages library
Copy Schema language for the resulting XML model. It
uses a copy of the schema language definition file
stored in the XML Languages library
Name File name for the resulting XML model
Code Reference code for the resulting XML model
Configure Model
Options
It lets you define the model options for the new XML
model. You can select the naming conventions
corresponding to the target language for example
For more information on model options when generating an XML
Model from a PDM, see Defining XML Model generation options.
Update existing XML Model
You can generate a PDM into an existing XML model.
In the Update Existing Model groupbox, the Select Model dropdown listbox
contains all the models already generated from the current model. You can
use the tooltip in the dropdown listbox to verify the workspace location and
physical path of the generated models.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 695
When the current model has never been generated or when the generation
link is broken, the Select Model dropdown listbox is empty. You can click
the Ellipsis button beside the Select Model dropdown listbox to display a
Select Model dialog box. This dialog box lets you select a model of the
correct type to update among models available in the workspace (either open
or closed). You can use the Workspace Location and Physical Path columns
in the Select Model dialog to select the model to update.
To update an existing XML model, you must indicate the following
parameters:
Parameter Description
Select model Existing model already generated from the current
model. Current model and selected generated model
are merged to create an updated model. The dropdown
listbox displays all the models already generated from
the current model. The Ellipsis button lets you select
models available in the workspace (either open or
closed)
Schema language Current schema language definition for the XML
model
Preserve modifications Allows a comparison and merge of the newly generated
XML model (default XML model) with the currently
selected XML model
Clearing the Preserve modifications check box
If the Preserve modifications check box is not selected, PowerDesigner
automatically replaces the existing XML model with the newly generated
XML model.
If you want to choose which objects to add or delete from the model to be
merged, you must select Preserve modifications to compare and merge the
two XML models.
Defining XML Model generation options
The Detail page of the XML Model Generation Options dialog box displays
the following options:
Option Description
Check model When selected, it verifies the model before generating the
XML model, and stops generation if an error is found
Generating an XML Model from a Physical Data Model
696 PowerDesigner
Option Description
Save generation
dependencies
When selected, PowerDesigner keeps track of the identity of
each generated object. It is useful when merging two XML
models which have been generated from the same PDM.
Objects can be compared and recognized as the same object,
even if the object has been modified in the merged XML
model
Convert names
into codes
When selected, object codes are generated from names using
the corresponding conversion script. This is useful when
generating models with very different naming conventions.
With this option selected, both objects will have their codes
generated from their names. If you do not select this option,
generated object codes will be copied from original object
codes
Generate
mapping
When selected, allows to define the current PDM as the data
source of the generated XML model and to create object
correspondence between PDM and XML model
Enable
transformations
This button is used to activate transformations during
generation. When you click this button, the Pre-generation tab
appears if the source model contains transformations. You can
select the transformations to execute before generation. The
Extended Model Definitions tab also appears for you to select
extended model definition files to attach to the generated
model. These files may contain post-generation
transformations, in this case, the Post-Generation tab appears
to let you select the transformations you want to be executed
in the generated model. If the generation is an update, and the
generated model contains extended model definitions with
post-generation transformations, the Post-generation tab
automatically appears as soon as you click the Enable
Transformations button
Generate
columns as
elements
When selected, columns in the PDM tables are generated as
child elements (instead of attributes) in the XML model. You
can then set attributes to these child elements
For more information on conversion scripts, see chapter Managing
Models in the General Features Guide.
Check model before generation
If you select the Check model option, the procedure to generate an XML
model starts by checking the validity of the PDM. An XML model results
when no errors are found. You can set check options by selecting
ToolsCheck Model.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 697
Generating a new XML model from a PDM
You can generate an XML model from a PDM or from a package in a PDM.
PowerDesigner creates a new XML model containing all the objects that you
selected to generate in the XML model. The newly created XML model
appears in the browser and the corresponding diagram opens in the work
area.
You can only generate an XML model from the active PDM diagram.
To generate a new XML model from a PDM:
1 Select ToolsGenerate XML Schema Model to display the XML Model
Generation Options dialog box.
2 Select Generate new XML Model radio button.
3 Type a name and a code for the new XML model, otherwise it will have
the same name and code as the PDM.
4 <optional> Click Configure Model Options to define the options of the
generated XML model.
Generating an XML Model from a Physical Data Model
698 PowerDesigner
5 Click the Detail tab to define options and generation parameters.
6 Click the Target Models tab to select the target models of shortcuts in
the current model.
7 Click the Selection tab to display the Selection page.
8 Select the name of a PDM from the Select Location dropdown listbox.
Generating an XML model from a package
To generate an XML model from a package, select the package name
from the dropdown listbox in the upper left corner of the dialog box.
To generate an XML model from a sub-package, select a sub-package
from the dropdown listbox in the upper left corner of the dialog box,
or select a package name and click the Include Sub-packages tool
next to this dropdown listbox.
9 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
10 Click OK.
The Output window shows the progress of the generation process. The
new XML model diagram appears in the work area.
Updating an existing XML model
There are two ways to update an existing XML model, depending on whether
the Preserve modifications option is selected or not:
Preserve modifications Result
Selected You can manually compare and merge the existing
XML model (right pane) with the newly generated
XML model (left pane)
Not selected The existing XML model is automatically replaced
by the newly generated XML model
If the Preserve modifications check box is selected, the Merge Models
window appears after the new XML model has been successfully generated.
You can use the Merge window to select objects to be updated, deleted, or
added to the model to be merged. The model must be open in the workspace
to be merged with a source model.
If the Preserve modifications check box is not selected, the existing model is
replaced.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 699
You can only generate an XML model from the active PDM diagram
window.
To update an existing XML model by generating from a PDM:
1 Select ToolsGenerate XML Schema Model to display the XML Model
Generation Options dialog box.
If you do not have an XML model in the current workspace, the Update
existing XML Model option is not available.
2 Select the Update existing XML Model radio button.
3 Select a model from the Select model dropdown listbox. This is the
existing model that you want to update.
or
Click the Ellipsis button beside the Select model dropdown listbox and
select a model available in the workspace in the Select a model dialog
box.
Generating an XML Model from a Physical Data Model
700 PowerDesigner
Preserve modifications
Select the Preserve modifications check box if you want to preserve
objects in the XML model.
If you clear this check box, all existing objects in the XML model
will be removed from the model, leaving only the objects generated
from the PDM.
4 Click the Detail tab to define options and generation parameters.
5 Click the Target Models tab to select the target models of shortcuts in
the current model.
6 Click the Selection tab to display the Selection page.
7 Select the name of a PDM from the Select Location dropdown listbox.
The default XML model is generated from this PDM.
Generating an XML model from a package
To generate an XML model from a package, select the package name
from the dropdown listbox in the upper left corner of the dialog box.
To generate an XML model from a sub-package, select a sub-package
from the dropdown listbox in the upper left corner of the dialog box,
or select a package name and click the Include Sub-Objects tool next
to this dropdown listbox.
8 Select the check boxes for the objects you want to generate, and clear the
check boxes for the objects you do not want to generate.
9 Click OK.
If you selected the Preserve modifications check box, the Merge Models
window appears.
If you cleared the Preserve modifications check box, the updated XML
model diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated XML
model in the left pane, and the existing XML model in the right pane.
You can select or clear object check boxes in the right pane for XML
model objects that you want to include or delete in the model to be
merged.
For more information on merging models, see Comparing and
Merging Models in the General Features Guide.
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 701
Generating an XML model via the XML Builder Wizard
The XML Builder Wizard helps you build an XML model that will be used
to generate SQL/XML queries for retrieving data from databases. Unlike the
standard PDM to XML model generation, the XML Builder Wizard
facilitates the next operations:
You can build your own hierarchy of elements and attributes from tables,
views and columns
A SQL/XML extended model definition is automatically attached to the
generated XML model, therefore you can generate SQL/XML queries
from global elements, to retrieve data from relational databases
supporting SQL/XML (See Generating SQL/XML queries)
The generated XML model is automatically mapped to the PDM. By
attaching the appropriate extended model definition to the generated
XML model, you can generate an annotated schema to store or retrieve
data in an XML format, from relational databases supporting XML (See
Generating annotated schemas)
During the XML Builder Wizard process, you can perform the following
actions:
Generate columns as elements or attributes
Generate tables and views as elements by drag and drop or using the
contextual menu
Display tables, views or columns property sheets
Add Sequence, Choice or All group particles
Rename elements or attributes
Add new elements or attributes without mapping
Delete elements, attributes or group particles
To generate an XML model via the XML Builder Wizard:
1 Select ToolsXML Builder Wizard.
2 Select generation options and click Next in each page of the wizard.
3 Click Finish.
The different actions of the wizard are detailed in the following sections.
Generating an XML Model from a Physical Data Model
702 PowerDesigner
Caution
The following sections assume you have a PDM open in the workspace. If
you choose to work with an existing XML model, it must also be open in
the workspace.
Defining the XML model to generate
In the Model Selection page, you select one of the following options:
The new model option. Type a name and a code for the new model, and
select a language in the XML language dropdown listbox
The existing model option. Select a model in the XML Model dropdown
listbox
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 703
Selecting tables and views
In the Tables and Views Selection page, you select tables and views to
generate in the XML model.
All tables and views are selected by default. Click the Deselect All tool and
select the tables and views you want to generate into XML elements.
Generating an XML Model from a Physical Data Model
704 PowerDesigner
Building an XML hierarchy
In the XML Hierarchy Design page, you build the structure of the XML
model.
The XML structure starts with the predefined Root element to which all first
generation elements should be linked, if you want your XML structure to be
strictly valid. For internal use, you can delete the Root element and start the
XML structure from the Elements folder.
To build an XML structure, you perform the following actions:
Select the columns option
Convert tables into elements
Create an XML hierarchy
If you click the Element radio button, columns are created as elements,
otherwise they are created as attributes.
In the left panel, expand a table node and its Columns folder.
Click the table name and drag and drop it to the Root element, the Elements
folder or a parent element in the right panel.
or
Click the Root element, the Elements folder or a parent element in the right
panel, right-click the table name in the left panel, and select Add in the
contextual menu.
Selecting the
columns option
Converting tables
into elements
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 705
If you chose the Create column as Attribute option, an element with the
table name appears in the right panel, linked to the Root element (via a
sequence group particle), the Elements folder or a parent element, with an
attribute for each column of the table.
If you chose the Create column as Element option, an element with the
table name appears in the right panel, linked to the Root element (via a
sequence group particle), the Elements folder or a parent element, with a
child element for each column of the table.
Generating an XML Model from a Physical Data Model
706 PowerDesigner
Caution
You cannot create an XML hierarchy between two elements if there is no
reference between their corresponding tables.
The XML hierarchy respects the PDM hierarchy: A parent table cannot
be the child element of an element corresponding to a child table.
Click a child table in the left panel and drag and drop it to the element
corresponding to its parent table in the right panel.
or
Click an element corresponding to a parent table in the right panel, right-
click its child table in the left panel, and select Add in the contextual menu.
The child table appears as a child element linked to its parent element via a
sequence group particle.
Creating an XML
hierarchy
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 707
Note: You could also have created a group particle from the parent element
in the right panel, and then drag and drop or add the child table to this group
particle. To create a group particle, right-click an element in the right panel
and select NewSequence (Choice or All) in the contextual menu.
The following actions are also available in the XML Hierarchy Design page:
Action Description
Open tables and columns
property sheets
Double-click or right-click a table or a
column name and select Properties in the
contextual menu
Rename elements or attributes Click an element or an attribute name and
type a new name
Add new elements or attributes
without mapping
Right-click the Elements folder or an
Attributes folder and select New in the
contextual menu. Right-click a group particle
and select NewElement (Sequence, Choice
or All) in the contextual menu
Delete elements, attributes or
group particles
Right-click an element name, an attribute
name or folder, a group particle name and
select Delete in the contextual menu
When you click Finish, the new XML model appears in the diagram window
and the Browser tree view (not expanded). Expand the model in the Browser
tree view to reveal all its generated elements and attributes (or child
elements).
Generating an XML Model from a Physical Data Model
708 PowerDesigner
In the case of an existing XML model, the generated elements appear next to
the existing elements.
The XML Builder Wizard attaches the SQL/XML extended model definition
to the new or existing XML model to generate SQL/XML queries from
global elements. (See next section)
Generating SQL/XML queries
SQL/XML is an XML extension of the Structured Query Language. It allows
you to retrieve data from a relational database, and to present the query
results in an XML format.
As the XML Builder Wizard attaches the SQL/XML extended model
definition to the generated XML model, SQL/XML queries can be
automatically generated for global elements.
For more information on generating SQL/XML queries, see Generating
SQL/XML queries, in chapter Exchanging data with databases supporting
XML, in the XML Model Users Guide.
Generating annotated schemas
Annotated schemas are XML-coded files, targeted with an XML language
and tagged with specific DBMS annotations, that allow you to store or
retrieve data in an XML format, from relational databases supporting XML.
You can generate annotated schemas from XML models mapped or not with
PDMs and linked with the appropriate DBMS extended model definition
(XEM file). When a mapping is needed, you should use the XML Builder
Wizard.
The following table lists the DBMS for which you can generate annotated
schemas:
Targeted DBMS
Mapping with
XML Builder
Wizard
Targeted XML
language
Required XEM
file
Microsoft SQL
Server 2000
Yes XSD or XDR Microsoft SQL
Server
Oracle 9i2 No XSD Oracle 9i2
IBM DB2 v8.1 Yes DTD IBM DB2 DAD
Chapter 12 Generating from a Physical Data Model
PDM User's Guide 709
For more information on generating annotated schemas, see chapter
Exchanging data with databases supporting XML, in the XML Model Users
Guide.
Generating an XML Model from a Physical Data Model
710 PowerDesigner
PDM User's Guide 711
C H A P T E R 1 3
DBMS-specific Features
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
Reference Guide in the Advanced User Documentation.
Topic Page
Logical 712
IBM DB 2 716
MS Access 725
Support for Oracle 727
Support for Sybase Adaptive Server IQ 754
Sybase Adaptive Server Enterprise 773
Sybase Adaptive Server Anywhere 775
Interbase extended attributes 776
MS SQL Server 777
NonStop SQL extended attributes 788
PostgreSQL extended attributes 789
Informix extended attributes 790
MySQL extended attributes 791
About this chapter
Contents
Logical
712 PowerDesigner
Logical
You can design a logical model using a PDM with the <Logical Model>
DBMS.
The logical model allows you to design the database structure and perform
some database denormalization actions. This model is independent from any
DBMS physical requirement.
Why build a logical model?
The logical PDM is a physical model with standard objects, and without
DBMS specific physical options and generation capabilities.
In the database design process, you use a logical model as an intermediary
step between conceptual and physical design:
Start with a CDM containing entities, attributes, relationships, domains,
data items and business rules
Generate a logical model (PDM with the <Logical Model> DBMS).
Create indexes and specify FK column names and other common
features
Generate a set of PDMs, each targeted to a specific DBMS
implementation. Define physical options and other DBMS specific
features
This design process allows you to keep everything consistent in a large
development effort.
For more information on PDM generation, see chapter Generating from
a Physical Data Model.
Inheritance in the logical PDM
The logical PDM contains only standard PDM objects and no DBMS specific
objects. The logical PDM also allows you to display inheritance links.
Displaying inheritance links in a PDM
You can display inheritance links in a logical PDM. An inheritance link is a
reference with a special symbol and with the IsInheritance extended
attribute set to True. Inheritance links proceed from inheritance and
generalization links in a source CDM or OOM.
Chapter 13 DBMS-specific Features
PDM User's Guide 713
Inheritance links support different model notations as shown in the following
table:
Relational / Conceptual IDEF1X
To display an inheritance link in a PDM:
1 Double-click a reference link to display its property sheet.
2 Click the Extended Attributes tab to display the corresponding page.
3 Select True in the Value dropdown listbox of the IsInheritance extended
attribute.
4 Click OK.
You can view the inheritance symbol on the reference.
Logical
714 PowerDesigner
Generating inheritance links
When you generate a logical PDM from a CDM or an OOM, you can recover
inheritance or generalization links and display them in the PDM diagram. To
do so, you need to enable a post generation transformation that will convert
all inheritance and generalization links into PDM inheritance links.
For more information on transformations used during model generation,
see chapter Generating from a Physical Data Model.
If you do not enable transformations during generation, you can still use the
Apply Transformations feature to apply the inheritance symbol to all
references proceeding from inheritance or generalization links.
For more information on how to apply transformations and retrieve
inheritance symbols, see section Applying transformations to retrieve
inheritance symbols.
To generate inheritance links:
1 Select ToolsGenerate Physical Data Model from a CDM or an OOM.
Make sure the DBMS of the target PDM is <Logical Model>.
2 Click the Details tab to display the corresponding page.
3 Click the Enable Transformations button.
The Post-generation page appears and displays a transformation profile
with a transformation designed to convert inheritance and generalization
objects into references with a specific symbol.
4 Click OK in the generation dialog box.
The inheritance links are created in the generated PDM.
Applying transformations to retrieve inheritance symbols
In case you forgot to enable transformations during generation, you can still
use the Apply Transformations feature to apply the inheritance symbol to all
references proceeding from inheritance or generalization links. Note that this
feature only applies to generated PDMs; furthermore the source CDM or
OOM must be open in the workspace.
To apply transformations to retrieve inheritance symbols:
1 Select ToolsApply Transformations.
Chapter 13 DBMS-specific Features
PDM User's Guide 715
The Apply Transformations dialog box appears. The profile
corresponding to the source model of the generated PDM is selected
together with the corresponding transformation.
2 Click OK.
Inheritance symbols appears on references proceeding from inheritance
and generalization links.
IBM DB 2
716 PowerDesigner
IBM DB 2
PowerDesigner supports the following specific features in IBM DB2:
Indexes
Tablespace prefix
Multiple databases
Extended attributes
Bind package
IBM DB 2 indexes
The IBM DB2 DBMS provides an index option.
The keywords Default= and/or List= can also be used with the composite=,
separator= and parenthesis= keywords.
The keyword Category= can be used with the three keywords of a complex
option.
The DB2 index options contain the following composite option:
<using_block> : composite=yes
{
using vcat %s
using stogroup %s : category=storage, composite=yes
{
priqty %d : default=12
secqty %d
erase %s : default=no, list=yes | no
}
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.
Example
Chapter 13 DBMS-specific Features
PDM User's Guide 717
To support this feature, the Options entry in the Table category contains the
item enabledbprefix.
By default, this item is set to yes which means that the tablespace name will
be systematically prefixed by the database name. You declare a tablespace in
a database from the Options page of the tablespace property sheet.
IBM DB 2
718 PowerDesigner
In the following example, tablespace TBSP1 is declared in database MyBase:
If you select TBSP1 in the table physical options, you can view that the
tablespace name is prefixed by the name of the database.
If the tablespace is not declared in any database, then the tablespace is not
prefixed by any database name.
Chapter 13 DBMS-specific Features
PDM User's Guide 719
When you preview the table creation code, you can verify that the tablespace
is prefixed by the name of the database.
Multiple databases in a model
In DB2, a database is a collection of tablespaces, and the objects contained
within them.
You can define several databases in a PDM for DB2 OS/390. This feature is
enabled by the EnableManyDatabases entry in the Database category of the
DBMS.
For more information on DBMS definition, see chapter DBMS
reference guide in the Advanced User Documentation.
When you allow multiple databases in the model, a list of databases appears
in the Model menu, and the Database box disappears from the model
property sheet. A Database category also appears in the physical options of
your database objects.
Creating a database in a model
In DB2, you can create as many databases as you need in you model, the
databases appear in a list of objects, available from the Model menu. In other
DBMS, you create one database per model from the model property sheet.
IBM DB 2
720 PowerDesigner
To create a database in a model:
1 Select ModelDatabases to display the List of Databases.
2 Click the Add a row tool to insert a new database in the list.
3 Click Apply.
4 Click the Properties tool to display the database property sheet.
5 Type a new name and code for the database in the General page.
6 <optional> Define the database physical options in the Options page.
7 <optional> Type a database begin and end script in the Script page.
8 Click OK.
Using a database in a physical option
The databases can be used as a physical option for the tables, columns, views,
keys, and indexes of your model.
When you use the in [<tablespace>] physical option, you can manually
associate a predefined tablespace with a database using the following syntax:
DBname.TBSPCname
Chapter 13 DBMS-specific Features
PDM User's Guide 721
For example, tablespace CUST_DATA belongs to database myBase. In the
following example, table Customer will be created in tablespace
CUST_DATA:
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 page displays the list of objects that use the
current database in their physical options.
To use a database in a physical option:
1 Open the property sheet of an object with physical options.
2 Click the Options tab to display the Options page.
3 Select the in database (...) option and click the >> button.
The database option appears as an item in the Items page.
4 Select a database from the dropdown listbox below the right pane.
5 Click OK.
IBM DB 2
722 PowerDesigner
Database check
A model cannot contain two databases with identical name and/or code.
Manual correction Automatic correction
Modify the duplicated database
name/code
Modifies the user name/code of a selected
object by appending a number to its current
name
The database you have created is not used in the model.
Manual correction Automatic 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 page of the object
property sheet)

IBM DB 2 extended attributes


Object type Extended attribute Use
Index WhereNotNull Specifies that the uniqueness
constraint does not apply to the key
value if any column of the key is null.
This applies when the index is a
primary key
Column ExtData Specifies a subtype for a character
string column (column with a
CHAR,VARCHAR,or LONG
VARCHAR data type). The subtype
can proceed from the list defined in
extended attribute type T_ForData
ExtFieldProcName Defines the procedure that will be used
as generator/cryptor of values
Database name
and code
uniqueness
Unused database
Chapter 13 DBMS-specific Features
PDM User's Guide 723
Object type Extended attribute Use
ExtGeneratedAs Indicates that DB2 generates values for
the 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
ExtSubtypeData Specifies a subtype for a character
string column
ExtGenAlways When set to True (generated always),
indicates that DB2 will always
generate a value for the column
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
ExtGenExpr Specifies that the definition of the
column is based on an expression
ExtLobOption Specifies options for LOB data type
columns
ExtForBitData 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
Tablespace ExtTablespaceType Specifies the tablespace type, as
defined in the extended attribute type
ExtTablespaceTypeList
Domain ExtSubtypeData Specifies a subtype for a character
string column
Table ExtTablePctFree Indicates what percentage of each page
to leave as free space during load or
reorganization
IBM DB 2
724 PowerDesigner
Bind package
This applies only if you are using the DataDirect drivers delivered with
PowerDesigner.
When you create the first ODBC data source on a DB2 server for your own
account, you will have to create the DataDirect bind packages on the server,
unless your ADMIN has already performed this task for all accounts.
To do so, during the setup of an ODBC data source, you have to click the
Create Package button in the Bind page of the ODBC DB2 Wire Protocol
Driver Setup dialog box.
Chapter 13 DBMS-specific Features
PDM User's Guide 725
MS Access
PowerDesigner supports the following specific features in MS Access:
Specific reverse engineering
Extended attributes
Reverse Engineering a MS Access 97 Database
PowerDesigner and MS Access 97 use .DAT files to exchange information.
These files are reversed into the PDM. The access.mdb database uses or
creates .DAT files to reverse Access databases.
You can define the database reverse parameters from the access.mdb
database window.
To reverse engineer a MS Access database into a PowerDesigner
PDM:
1 Double-click access.mdb in the PowerDesigner \tools directory.
2 Select Reverse Engineer Access Database File to PowerDesigner Script.
3 Type the Access database name in the Select Database box.
4 Type the .DAT file to create in the PowerDesigner File.
5 Click on the Create button.
6 Select DBMSReverse Engineering Databases in PowerDesigner.
7 Select the newly generated script file to reverse.
8 Click OK.
MS Access
726 PowerDesigner
MS Access extended attributes
Object type Extended attribute Use
Column ExtAllowZeroLength Specifies whether a zero-length
string ("") is a valid entry in a
table column.
Note: The AllowZeroLength
property applies only to Text,
Memo, and Hyperlink table
fields
Chapter 13 DBMS-specific Features
PDM User's Guide 727
Support for Oracle
PowerDesigner supports the following specific features in Oracle:
Variables for triggers
Object data types
SQLJ object data types
Bitmap join indexes
Reverse engineering tablespace physical options
Reverse engineering ASC/DESC indexes
Dimensions management
Extended attributes
ODBC Drivers
If you are using the Oracle DBMS, it is recommended to use the ODBC
drivers delivered with PowerDesigner
Special variables for triggers
You can use the following variables with Oracle:
TRGBODY
TRGDESC
For more information, see appendix Variables in PowerDesigner.
Object (or SQLJ object) data types
If you select Oracle 8 (or higher) as the target DBMS, the table property
sheet displays the box Based On.
DBMS Oracle 8 (or
higher)
Support for Oracle
728 PowerDesigner
You can assign object (or SQLJ object) abstract data types to tables in
Oracle. Object (or SQLJ object) ADT are data types of the type Object (or
SQLJ Object). When you assign an object (or SQLJ object) ADT to a table,
the table uses the properties of the ADT and the ADT attributes become table
columns.
For more information on Oracle 8 abstract data types, see the
corresponding Oracle 8 documentation.
To create an object (or SQLJ object) data type and use it in a table:
1 Select ModelAbstract Data Types to display the List of Abstract Data
Types.
2 Click a new line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type an abstract data type name and code.
4 Click Apply to commit the creation of the new abstract data type.
5 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
Chapter 13 DBMS-specific Features
PDM User's Guide 729
The abstract data type property sheet opens to the General page.
6 Select OBJECT (or SQLJ_OBJECT) from the Type dropdown list box.
The Attributes and Procedures tabs appear in the abstract data type
property sheet.
7 Click the Attributes tab to display the Attributes page.
8 Click a blank line in the list.
9 Type an attribute Name and Code.
10 Select a data type class from the Data Type dropdown list box.
Display the column you need
If you do not see the column you need, display it with the Customize
Columns and Filter tool.
11 Repeat steps 8 to 10 for every object (or SQLJ object) attribute you want
to define.
Support for Oracle
730 PowerDesigner
12 Click OK in each of the dialog boxes.
13 Double-click a table in the model to display its property sheet.
14 Select the new object (or SQLJ object) data type from the Based on
dropdown list box.
15 Click OK.
Bitmap join indexes
A bitmap join index is a bitmap index described through a join query. It
stores the rowids from one base table along with the indexed columns from
the joined tables.
A bitmap join index must be defined on a single table, called base table.
For more information on bitmap join indexes, see Oracle
documentation.
You can design a bitmap join index:
Automatically, by creating bitmap join indexes from all references linked
to a fact table. This can be done using the Rebuild join index feature
Manually, by creating a bitmap join index in the list of join indexes or
from the table property sheet
Chapter 13 DBMS-specific Features
PDM User's Guide 731
The bitmap join index concept is very close to the concept of join indexes as
they are defined in Sybase AS IQ. The only difference is that you can define
columns on the bitmap join indexes.
For more information on join indexes in Sybase AS IQ, see section
Support for Sybase Adaptive Server IQ.
Bitmap join index properties
A bitmap join index has the following properties:
Property Description
Name Name of the bitmap join index
Code Reference name of the bitmap join index
Comment Additional information about the bitmap join index
Stereotype Sub-classification among bitmap join indexes
Owner Name of the user who created the bitmap join index
Base table Name of the table that stores the bitmap join index
The bitmap join index stores information about the columns used for the
index. These columns are displayed in the Columns page of the bitmap join
index property sheet.
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 page of the Generation
dialog box.
Rebuild bitmap join indexes for all references linked to a fact table
You can automatically generate a bitmap join index for each fact table and
the dimension tables that it references. Each automatically 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.
Columns page
Options page
Support for Oracle
732 PowerDesigner
Parameter Result of selection
Delete and Rebuild When selected, all existing indexes are deleted before
join index rebuild
Preserve When selected, preserves all existing join indexes in the
PDM
To rebuild bitmap join indexes for all references linked to a fact
table:
1 Select ToolsRebuild ObjectsRebuild Join Indexes.
The Rebuild Join Indexes dialog box appears.
2 Click the Selection tab.
The Selection page appears.
3 Select one or more fact tables from the list.
4 Click OK.
A confirmation box asks if you want to continue.
5 Click Yes.
A bitmap join index is automatically generated for each fact table.
Chapter 13 DBMS-specific Features
PDM User's Guide 733
Displaying automatically generated bitmap join indexes
Automatically generated bitmap join indexes appear in the list of join
indexes. To display the list, select ModelJoin Indexes.
Creating a bitmap join index in the list of join indexes
If you need to create more bitmap join indexes than those automatically
created by the rebuild process, you can use the list of join indexes.
To create a bitmap join index in the list of join indexes:
1 Select ModelJoin Indexes.
The List of Join Indexes appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a bitmap join index name in the Name column.
4 Click the Properties tool.
A confirmation box appears asking you to commit the creation of the
bitmap join index.
5 Click Yes.
The bitmap join index property sheet opens to the General page.
6 Select a base table in the corresponding box.
7 Click the References tab.
The References page appears. It contains the references of the bitmap
join index. The list is empty when you create a new bitmap join index.
8 Click the Add References tool.
A selection dialog box appears. It displays available references
depending on the selected base table.
9 Select one or several references in the list.
10 Click OK.
Support for Oracle
734 PowerDesigner
The selected reference appears in the References list.
11 Click the Columns tab.
The Columns page appears. It contains the columns of the bitmap join
index. The list is empty when you create a new bitmap join index.
12 Click the Add Columns tool.
A selection dialog box appears. It displays available columns depending
on the selected references.
13 Select one or several columns in the list.
14 Click OK.
The selected columns appears in the Columns list.
15 Click OK.
The bitmap join index is created.
Creating a bitmap join index from the table property sheet
You can create a join index or a bitmap join index from the Join Index page
of the table property sheet. The bitmap join index is automatically based on
the current table.
Chapter 13 DBMS-specific Features
PDM User's Guide 735
To create a bitmap join index from the table property sheet:
1 Open the property sheet of a table.
2 Click the Join Index tab to display the join index page.
3 Click the Insert a Row or the Add a Row tool.
A bitmap join index is automatically added to the list of table join
indexes.
4 Click Apply and click the Properties tool to display the bitmap join index
property sheet.
You can check that the Base table box is initialized with the selected
table.
Adding a column to a bitmap join index
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.
To add a column to a bitmap join index:
1 Open the bitmap join index property sheet and make sure the bitmap join
index has a base table.
2 Click the Columns tab to display the column list.
3 Click the Add Columns tool in the list toolbar.
A selection dialog box appears to let you select columns to include in the
join depending on the selected references.
4 Select one or several columns in the list and click OK.
The columns appear in the list of bitmap join index columns.
5 Click OK.
Support for Oracle
736 PowerDesigner
Adding a reference to a bitmap join index
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.
To add a reference to a bitmap join index:
1 Select ModelJoin Indexes.
The List of Join Indexes appears.
2 Select a bitmap join index in the list.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
The bitmap join indexes property sheet opens to the General page.
4 Click the References tab to display the References page.
5 Click the Add References tool.
A selection dialog box appears. It displays available references
depending on the selected base table.
6 Select one or several references in the list.
7 Click OK.
The new reference appears in the References list.
Chapter 13 DBMS-specific Features
PDM User's Guide 737
8 Click OK.
The reference is added to the bitmap join index.
Database package
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
Defining a database package
A database package is not a standard PowerDesigner package.
You define a database package with the following properties:
Property Description
Name Name of the database package
Code Code of the database package, this code is generated in scripts
Comment Additional information about the database package
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
Owner Name of database package owner. You choose an owner from a
list of users. A database package can only have one owner at a
time
Support for Oracle
738 PowerDesigner
Property Description
Privilege Lets you specify whether the functions and procedures in the
database package execute with the privileges and in the schema of
the user who owns it (definer), or with the privileges and in the
schema of CURRENT_USER (invoker)
The definition of a database package also includes the definition of
procedures, variables, cursors, exceptions, types, and initialization
parameters as explained in the following sections.
To create a database package:
1 Select ModelDatabase Packages.
The list of database packages appears.
2 Click the Add a Row tool.
A database package is added to the list.
3 Click Apply.
4 Click the Properties tool to display the property sheet of the database
package.
5 Type a name and a code for the database package.
6 <optional> Select a user from the Owner dropdown listbox.
Chapter 13 DBMS-specific Features
PDM User's Guide 739
7 <optional> Select a privilege from the Privilege dropdown listbox.
8 Click OK.
Inserting procedures in a database package
A database package is a set of related procedures. When you create a
database package you have to declare the procedures it contains.
PowerDesigner makes a difference between:
A procedure created in the model
A procedure created in a database package. This procedure only exists in
the database package and disappears when you delete the package. In
this section, we call it package procedure. You can create a package
procedure from a model procedure using the copy feature
To insert procedures in a database package:
1 Click the Procedures tab in the database package property sheet to
display the Procedures page.
Support for Oracle
740 PowerDesigner
2 Click the Insert a Row tool if you want to create procedures in the
database package.
or
Click the Create from Procedure tool if you want to duplicate existing
procedures in the database package. Select the procedures and click OK.
The procedures appear in the list.
3 Click Apply.
4 Select a procedure in the list and click the Properties button to display
the procedure property sheet.
5 Define the procedure in the property sheet.
6 Click OK in each of the dialog boxes.
Defining a package procedure
A package procedure is created in a database package and exists only in this
package. If you delete the database package you also delete the procedures it
contains.
Chapter 13 DBMS-specific Features
PDM User's Guide 741
A package procedure has the following properties:
Property Description
Name Name of the package procedure
Code Code of the package procedure
Comment Additional information about the package procedure
Stereotype Sub-classification used to extend the semantics of an object
without changing its structure; it can be predefined or user-
defined
DB Package Name of the database package to which the procedure
belongs
Type Allows you to choose between procedure and function
Return data type Allows you to define the return data type of a function
Pragma Allows you to type a compiler directive, that is, a string for
specifying compilation parameters for the procedure
Public Allows you to declare the procedure in the package
specification and to permit use from outside the database
package.
A private procedure (check box deselected) is only defined in
the package body
The Parameters page lets you define the input and output values for
procedures.
Parameters
Support for Oracle
742 PowerDesigner
For example, in the CREDIT procedure, you have to define the following
parameters:
The Definition page lets you define package procedures. Package procedures
are not built using the structure of templates defined in the DBMS. You have
to type the entire package procedure definition. To do so, you can use
operators and functions to insert script items into the cursor definition.
For example, the definition of the CREDIT package procedure is the
following:
CREATE PROCEDURE credit (Account_number NUMBER, Amount IN NUMBER) AS
BEGIN
UPDATE accounts
SET balance = balance + amount
WHERE account_id = acc_no;
END;
Defining variables in a database package
Variables can be declared within a package. A variable can be used in a SQL
or PL/SQL statement to capture or provide a value when one is needed.
Definition
Chapter 13 DBMS-specific Features
PDM User's Guide 743
For example, you can define the variable in_stock with a boolean data type to
verify if a product is available or not.
Variables have the following properties:
Property Description
Name Name of the variable
Code Code of the variable
Comment Additional information about the variable
DB Package Name of the database package to which the variable belongs
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
Default value Default value of the variable
Constant Indicates that the variable is a constant. A constant has a value
assigned. For example:
Credit_Limit constant REAL := 500 000;
Public Allows you to declare the variable in the package specification
and to permit use from outside the database package.
A private variable (check box deselected) is only defined in the
package body
Support for Oracle
744 PowerDesigner
Defining cursors in a database package
In application development, a cursor is a multi-row query.
In Oracle, a cursor lets you name a work area and access its stored
information.
Cursors have the following properties:
Property Description
Name Name of the cursor
Code Code of the cursor
Comment Additional information about the cursor
DB Package Name of the database package to which the cursor belongs
Return Data
Type
Allows you to define the data type of a cursor result value
Public Allows you to declare the cursor in the package specification and
to permit use from outside the database package.
A private cursor (check box deselected) is only defined in the
package body
The Parameters page lets you define the input values for cursors.
For example, you can define a parameter "num" and use it in the cursor to
define the cursor input value. See example below.
The Definition page lets you define the cursor. You can use operators and
functions to insert script items into the cursor definition.
Parameters
Definition
Chapter 13 DBMS-specific Features
PDM User's Guide 745
For example, the following cursor allows locating in table emp, the employee
number, name, and function in a given department and for a given employee
number:
Defining exceptions in a database package
PL/SQL allows you to explicitly handle internal and user-defined error
conditions, called exceptions, that arise during processing of PL/SQL code.
You can create user-defined exceptions linked to the database package
behavior.
Exceptions have the following properties:
Properties Description
Name Name of the exception
Code Code of the exception
Comment Additional information about the exceptions
DB Package Name of the database package to which the exception belongs
Pragma Allows you to type a compiler directive, that is, a string for
specifying compilation parameters for the exception
Support for Oracle
746 PowerDesigner
Defining types in a database package
A type is a user-defined composite datatype that encapsulates a data 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 Name of the type
Code Code of the type
Comment Additional information about the type
DB Package Name of the database package to which the type belongs
Type Allows you to declare the type as type or subtype
Public Allows you to declare the type in the package specification and to
permit use from outside the database package.
A private type (check box deselected) is only defined in the
package body
This page is used to declare the type contents.
The following example defines the type bank_account:
CREATE TYPE Bank_Account AS OBJECT (
acct_number INTEGER(5),
balance REAL,
status VARCHAR2(10),
);
Defining database package initialization
The Initialization page lets you define initialization code for the database
package body. Typically initialization holds statements that initialize
database package variables. Initialization takes place after database package
creation and compilation in the server.
Definition
Chapter 13 DBMS-specific Features
PDM User's Guide 747
In the following example, the variable bonus is declared in the initialization
part of the database package body:
Defining database package parameters
The Parameters page lets you define the input and output values for
procedures and cursors.
For example, in the CREDIT procedure, you have to define the parameters
Account Number and Amount.
For more information on database package procedures, see section
Defining a package procedure.
For more information on database package cursors, see section Defining
cursors in a database package.
Generating database packages
You can define generation parameters for database packages in the Database
Package page of the Triggers and Procedures Generation dialog box. This
page appears when the current DBMS belongs to the Oracle family.
Support for Oracle
748 PowerDesigner
The following parameters are available:
Parameter Resulting generation command
Create database
package
Create database package, as defined in the Oracle DBMS:
create package %DBPACKAGE% [authid
%DBPACKAGEPRIV% ][[%R%?[is][as]:as]
%DBPACKAGESPEC%
end [%DBPACKAGE%]/
[create package body %DBPACKAGE% AS
%DBPACKAGEBODY%
[BEGIN
%DBPACKAGEINIT%] ]
end [%DBPACKAGE%]
]
Drop database
package
Drop database package, as defined in the Oracle DBMS:
drop package %DBPACKAGE%
Permission Generate the permission statement for a given user during
database package creation
For more information on the create and drop statements for database
packages, see chapter DBMS Reference Guide in the Advanced User
Documentation.
Reverse engineering database packages
You can select database packages to reverse engineer from the Database
Package page of the ODBC 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.
Reverse engineering tablespace physical options
In Oracle, you cannot reverse engineer tablespace physical options via
ODBC without a login "System".
If you do not have a login "System", the list of tablespaces is reversed
without the physical options of the objects.
If you want to cancel the reverse engineering of tablespace physical options,
you have to clear the query SqlAttrQuery in the Tablespace category in
the Oracle DBMS.
Chapter 13 DBMS-specific Features
PDM User's Guide 749
Reverse engineering ASC/DESC indexes
In Oracle, DESC index columns have an expression stored in the field
ALL_IND_EXPRESSIONS with the LONG data type. Like for function-
based indexes, such value can not be concatenated in a string statement
during ODBC reverse engineering.
For more information on function-based indexes, see section Creating a
function-based index in chapter Building Physical Diagrams.
To bypass this limitation, the query SqlListQuery defined in the Index
category, uses variables to recover the index expression:
SqlExpression.Xpr'||i.table_name||i.index_name||c.column_pos
ition||'%', c.column_name)||' '||c.descend||', ',
For more information on the use of variables in reverse engineering
queries, see section Using variables in reverse engineering queries, in chapter
DBMS Reference Guide, in the Advanced User Documentation.
To reverse DESC index columns if you are using an Oracle DBMS from a
previous version, you have to copy the content of SqlListQuery in your
DBMS.
Managing Oracle dimensions
You can design Oracle dimensions using dimensions in a PDM
multidimensional diagram.
For more information on dimensions in the multidimensional diagram,
see chapter Building Multidimensional Diagrams.
In Oracle, the columns of the dimension table are called levels of the
dimension hierarchy. These levels can have dependent columns, for
example, in dimension Time, level Quarter has a dependent column called
Number of business days.
The following mapping is established between dimensions in Oracle and
PowerDesigner:
Oracle object PowerDesigner object
Dimension Dimension
Hierarchy Dimension hierarchy
Level Dimension attribute used in a hierarchy
Attribute Dimension attribute used as detail attribute
Support for Oracle
750 PowerDesigner
Oracle dimension creation and deletion orders can be generated and reverse
engineered in PowerDesigner. Both generation and reverse engineering can
be done by script or using ODBC.
Oracle dimension levels and attributes
Oracle dimensions have the same properties as dimensions in the
multidimensional diagram.
The levels in Oracle dimensions are designed as dimension attributes in
PowerDesigner, and the Oracle level attributes are designed as detail
attributes. Detail attributes are attributes used by other attributes, all these
attributes appear in the same list of attributes of the dimension, but you can
use one of them to further define a given attribute. In our example, attribute
Number of business days appears in the list of dimension attributes, however,
it is used as a detail attribute of attribute Quarter.
To define an Oracle dimension attribute:
1 In the dimension property sheet, click the Attributes tab to display the
corresponding page.
Chapter 13 DBMS-specific Features
PDM User's Guide 751
2 Click the Add Detail Attributes tool to display a list of attributes and
select one or several detail attributes.
The list of attributes is identical to the list of dimension attributes. In
PowerDesigner, Oracle dimension levels and attributes are designed as
attributes.
3 Click OK in the Selection dialog box.
The detail attributes appear in the list.
4 Click Apply.
Generating Oracle dimensions
The Multidimensional Objects Generation dialog box allows you to generate
dimension creation and/or drop statements or directly generate them in the
database.
To generate Oracle dimensions:
1 Select DatabaseGenerate Multidimensional Objects.
The Multidimensional Objects Generation dialog box appears.
2 Type a destination directory for the script file in the Directory box.
3 Type a destination filename for the script file in the File Name box.
Support for Oracle
752 PowerDesigner
4 Select the Script Generation radio button.
or
Select the ODBC Generation radio button.
5 Select dimension generation options.
6 Click OK.
Oracle extended attributes
The following extended attributes are defined by default in the Oracle
DBMS.
Object type Extended attribute Use
Table ExtTableType Defines if the table is of type
global temporary or not
Column ExtColumnDeferOption Defines the deferred option of
a column constraint check. It
is used in the definition or
create and add items
statements
Chapter 13 DBMS-specific Features
PDM User's Guide 753
Object type Extended attribute Use
ExtNotNullConstraintName Defines the name of the not
null constraint for a column
Database
package
IsPragma When set to True, defines that
the pragma serially_reusable
clause must be applied on the
database package body
declaration
IsSpecPragma When set to True, defines that
the pragma serially_reusable
clause must be applied on the
database package specification
Reference ExtReferenceDeferOption Defines the deferred option of
a reference. It is used in the
definition of create and add
items statements
View ExtObjOIDList Specifies the attributes of the
object type that will be used
as a key to identify each row
in the object view
ExtObjSuperView Used in the UNDER clause to
specify the superview the
current object view is based
on
ExtObjViewType Defines the type of the object
view
ExtViewForce 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
Support for Sybase Adaptive Server IQ
754 PowerDesigner
Support for Sybase Adaptive Server IQ
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.
Fully-flexible schema support
Efficient query execution without query-specific tuning by the System
Administrator (under most circumstances)
Fast aggregations, counts, comparisons of data
Stored procedures
Entire database and indexing stored in less space than raw data
Numerous index types
Join indexes to improve overall query performance
In Sybase AS IQ, join indexes represent links between columns in different
tables. They enable much faster query processing on multiple indexes in a
very large database. In Sybase AS IQ, join indexes are usually applied
instead of ad hoc queries.
Accessing Sybase AS IQ features
The Sybase AS IQ features are only accessible if you select Sybase AS IQ as
your DBMS. There are three ways to access these features:
Create a new PDM using Sybase AS IQ
Reverse engineer an existing Sybase AS IQ database
Change the target DBMS of an existing PDM
Chapter 13 DBMS-specific Features
PDM User's Guide 755
Extended attribute
The extended attribute ExtIqUnicity is defined for columns in Sybase AS
IQ
Creating a new PDM using Sybase AS IQ
If you create a new PDM using Sybase AS IQ or load a PDM that was
created in Sybase AS IQ, you directly access all the advanced features
concerning join indexes.
Reverse engineering an existing Sybase AS IQ database
Once you reverse engineer an existing Sybase AS IQ database, you directly
access all the advanced features concerning join indexes.
For more information about reverse engineering an existing database,
see chapter Reverse Engineering.
Checking a model built with IQ 12.4.3
If you need to check your PDM, you can use the ToolsCheck Model
command.
You can use the VB script IQ12_4_3_Checks.vbs located in the \Script
folder to perform extended checks on your model. This script was designed
to check models built with Sybase IQ 12.4.3. It checks the data type and
physical options of indexes, column indexes as well as column data types.
Changing the target DBMS of an existing PDM
If you have a PDM created for a DBMS other than Sybase IQ, you can access
the advanced features of Sybase AS IQ by loading the PDM and then
changing the target database.
To change the target database:
1 Select DatabaseChange Current DBMS.
The Change the Target DBMS dialog box appears.
2 Select Sybase AS IQ 12.0 from the New DBMS dropdown listbox.
Support for Sybase Adaptive Server IQ
756 PowerDesigner
The Change the Target DBMS dialog box should appear as shown
below.
3 Click OK.
A message confirms that the target database has been changed.
Join indexes are only available in Sybase AS IQ
Remember that if you change the target DBMS from Sybase AS IQ, you
lose all join indexes.
Defining IQ indexes
Before creating IQ indexes, you should consider the implications of various
types of indexes on the database server memory and disk space.
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
Chapter 13 DBMS-specific Features
PDM User's Guide 757
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.
When you rebuild IQ indexes, two parameters are available:
Parameter Result of selection
Delete and Rebuild When selected all existing indexes are deleted before
index rebuild
Preserve Indexes When selected, preserves all existing indexes in a PDM
There are three types of variables that you can use to define the default name:
Variable Description
%COLUMN% Column name
%INDEXTYPE% Type of index to be rebuilt
%TABLE% Name or code of table (based on display preferences)
Indexes are typed in Sybase IQ, the rebuild process usually creates a
FASTPROJECTION index for all columns. Otherwise, the following rules
are applied:
Criteria Index type
Low number of unique values in a column
Column used in join predicate
LOWFAST
High number of unique values in a column
No COUNT DISTINCT, SELECT DISTINCT, or GROUP
BY queries required
HIGHNONGROUP
Default name for
IQ indexes
Support for Sybase Adaptive Server IQ
758 PowerDesigner
Criteria Index type
Column used in join predicate
High number of unique values in a column (more that
1000)
Anticipate COUNT DISTINCT, SELECT DISTINCT, or
GROUP BY queries
Column must enforce uniqueness
HIGHGROUP
Column with date type DATE
Column with time type TIME
Column with datetime or smalldatetime type DTTM
To rebuild IQ indexes:
1 Select ToolsRebuild ObjectsRebuild Indexes.
The Rebuild Indexes dialog box opens to the General page.
2 Select a default name to generates IQ indexes.
The name may include column, table and index type definitions.
3 Click the Selection tab.
The Selection page appears.
Chapter 13 DBMS-specific Features
PDM User's Guide 759
4 Select one or more tables from the list.
5 Click OK.
A confirmation box asks if you want to continue.
6 Click Yes.
The IQ indexes are rebuilt.
Defining IQ join indexes
IQ join indexes are a special type of index used in Sybase AS IQ. A join
index 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.
Support for Sybase Adaptive Server IQ
760 PowerDesigner
Join index properties
A join index has the following properties:
Property Description
Name Name for the join index. This name improves the readability of the
model
Code Reference name for the join index
Stereotype Sub-classification used to extend the semantics of an object without
changing its structure; it can be predefined or user-defined
Comment Descriptive label for the join index
Base table Name of the table that stores the join index
You can define a join index:
Automatically, by creating join indexes from all references linked to a
fact table
Manually, by creating a join index in the list of join indexes
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 chapter
Building Physical Diagrams.
Rebuild join indexes for all references linked to a fact table
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 page of the Join Index Rebuild page.
Facts and
Dimensions
Chapter 13 DBMS-specific Features
PDM User's Guide 761
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.
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.
Parameter Result of selection
Delete and Rebuild When selected all existing indexes are deleted before
join index rebuild
Preserve When selected, preserves all existing join indexes in the
PDM
The same feature applies to Oracle bitmap join indexes.
For more information on Oracle bitmap join indexes, see section
Rebuild bitmap join indexes for all references linked to a fact table.
To rebuild join indexes for all references linked to a fact table:
1 Select ToolsRebuild ObjectsRebuild Join Indexes.
Support for Sybase Adaptive Server IQ
762 PowerDesigner
The Rebuild Join Indexes dialog box appears.
2 Click the Selection tab.
The Selection page appears.
3 Select one or more fact tables from the list.
4 Click OK.
A confirmation box asks if you want to continue.
5 Click Yes.
A join index is automatically generated for each fact table.
Chapter 13 DBMS-specific Features
PDM User's Guide 763
Displaying automatically generated join indexes
Automatically generated join indexes appear in the list of join
indexes. To display the list, select Model Join Indexes.
Creating a join index from the table property sheet
You can create a join index or a bitmap join index from the Join Index page
of the table property sheet. The join index is automatically based on the
current table.
To create a join index from the table property sheet:
1 Open the property sheet of a table.
2 Click the Join Index tab to display the Join Index page.
3 Click the Insert a Row or the Add a Row tool.
A join index is automatically added to the list of table join indexes.
4 Click Apply and click the Properties tool to display the join index
property sheet.
You can check that the Base table box is initialized with the selected
table.
Creating a join index in the list of join indexes
If you need to create more join indexes than those automatically created by
the rebuild process, you can use the list of join indexes.
Several references can be made at once
The following procedure shows how to create a join index in its simplest
form: using one reference at a time. Once you become familiar with join
index creation, you can select several references at once to reflect a more
complex query plan.
To create a join index in the list of join indexes:
1 Select ModelJoin Indexes.
Support for Sybase Adaptive Server IQ
764 PowerDesigner
The List of Join Indexes appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a join index name in the Name column.
This is the name of the join index. The code automatically equals the
join index name.
4 Click the Properties tool.
A confirmation box appears asking you to commit the creation of the
database object.
5 Click Yes.
The join index property sheet opens to the General page.
6 Click the References tab.
Chapter 13 DBMS-specific Features
PDM User's Guide 765
The References page appears. It contains the references of the join index.
The list is empty when you create a new join index.
7 Click the Add References tool.
A selection dialog box appears. It displays all the references in the PDM.
8 Select a reference in the list.
9 Click OK.
Support for Sybase Adaptive Server IQ
766 PowerDesigner
The selected reference appears in the References list.
10 Click OK in each of the dialog boxes.
The join index is created.
Adding references to a join index
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.
To add a reference to a join index:
1 Select ModelJoin Indexes.
The List of Join Indexes appears.
2 Select a join index in the list.
An arrow appears at the beginning of the line.
3 Click the Properties tool.
The join indexes property sheet opens to the General page.
4 Click the References tab.
The References page is displayed.
5 Click the Add References tool.
Chapter 13 DBMS-specific Features
PDM User's Guide 767
A selection dialog box appears. It displays all the references in the PDM.
6 Select a reference in the list.
7 Click OK.
The new reference appears in the References list.
8 Click OK in each of the dialog boxes.
The reference is added to the join index.
Support for Sybase Adaptive Server IQ
768 PowerDesigner
Generating a Sybase AS IQ database
Sybase AS IQ has its own generation parameters, in addition to the standard
database generation parameters.
For more information on the standard database generation parameters,
see chapter Database Creation and Modification.
Sybase AS IQ database parameters
Sybase AS IQ generation parameters concern join indexes only. These
generation parameters are grayed when you are not using Sybase AS IQ.
When available, they allow you to perform these tasks:
Parameter Result of selection
Create join index Create join indexes
Drop join index Delete join indexes
All join indexes are defined from references. However, the definition of a
join index is not affected by whether its references are generated or not.
Generating a Sybase AS IQ database creation script
To generate a Sybase AS IQ database creation script:
1 Select DatabaseGenerate Database.
The Database Generation dialog box opens to the Tables & Views page.
2 Browse to the output directory.
3 Type a filename with the .SQL extension in the File name box.
This is the name of the database creation script.
4 Click the Script generation radio button.
Chapter 13 DBMS-specific Features
PDM User's Guide 769
The dialog box should appear as shown below.
5 Specify the database generation parameters.
6 Click the Keys & Indexes tab.
The Keys & Indexes page appears.
Support for Sybase Adaptive Server IQ
770 PowerDesigner
7 Specify the database generation parameters.
8 Click the Selection tab.
The selection page appears.
Chapter 13 DBMS-specific Features
PDM User's Guide 771
9 Select one or more tables from the list.
10 Click OK to start the generation.
A Result dialog box asks you if you want to Edit or Close the newly
generated file.
11 Click Edit to see and modify the newly generated script or Close.
Support for Sybase Adaptive Server IQ
772 PowerDesigner
Sybase IQ extended attributes
The following extended attributes are defined by default in the Sybase IQ
DBMS.
Object type Extended attribute Use
Column ExtIqUnicity Defines the cardinality of the
column, it is used to optimize
the indexes internally
Chapter 13 DBMS-specific Features
PDM User's Guide 773
Sybase Adaptive Server Enterprise
PowerDesigner supports the following specific features in Sybase Adaptive
Server Enterprise:
Identity columns
Extended attributes
Identity columns
The first time you insert a row into the table, ASE assigns the IDENTITY
column a value of 1. Each new row gets a column value that is 1 higher than
the last value. This value takes precedence over any defaults declared for the
column in the create table statement or bound to the column with the
sp_bindefault system procedure. The maximum value that can be
inserted into the IDENTITY column is 10, precision - 1.
Inserting a value into the IDENTITY column allows you to specify a seed
value for the column or to restore a row that was deleted in error. The table
owner, Database Owner, or System Administrator can explicitly insert a
value into an IDENTITY column after using set identity_insert
table_name on for the base table. Unless you have created a unique
index on the IDENTITY column, Adaptive Server does not verify the
uniqueness of the value. You can insert any positive integer.
You can reference an IDENTITY column using the syb_identity
keyword, qualified by the table name where necessary, in place of the actual
column name.
System Administrators can use the auto identity database option to
automatically include a 10-digit IDENTITY column in new tables. To turn on
this feature in a database, use:
sp_dboption database_name, "auto identity", "true"
Each time a user creates a table in the database without specifying either a
primary key, a unique constraint, or an IDENTITY column, Adaptive Server
automatically defines an IDENTITY column. This column,
SYB_IDENTITY_COL, is not visible when you retrieve columns with the
select * statement. You must explicitly include the column name in the select
list.
Sybase Adaptive Server Enterprise
774 PowerDesigner
Server failures can create gaps in IDENTITY column values. The maximum
size of the gap depends on the setting of the identity burning set factor
configuration parameter. Gaps can also occur due to transaction rollbacks,
the deletion of rows, or the manual insertion of data into the IDENTITY
column.
Sybase Adaptive Server Enterprise extended attributes
The following extended attributes are defined by default in the Sybase
Adaptive Server Enterprise DBMS.
Object type Extended attribute Use
Column InRow Specifies whether a Java-SQL column is
stored separate from the row (set to
False) or in storage allocated directly in
the row (set to True)
Key DescKey Specifies if the index created for a
constraint is to be created in descending
order for each column
Table ExtTablePartition Defines the number of partitions for the
table
Chapter 13 DBMS-specific Features
PDM User's Guide 775
Sybase Adaptive Server Anywhere
PowerDesigner supports the following specific features in Sybase Adaptive
Server Anywhere:
Auto-increment columns
Extended attributes
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.
Sybase Adaptive Server Anywhere extended attributes
The following extended attributes are defined by default in the Sybase
Adaptive Server Anywhere DBMS.
Object type Extended attribute Use
Table ExtGlobalTemporaryT
able
Defines if table is a global temporary
table or not
Key ClusteredKey Specifies if the constraint index
automatically created for a key is
clustered or not
Reference ClusteredKey Specifies if the constraint index
automatically created for a reference is
clustered or not
Interbase extended attributes
776 PowerDesigner
Interbase extended attributes
The following extended attributes are defined by default in the Interbase
DBMS.
Object type Extended attribute Use
Index ExtAscDesc Defines that the default value of
the index (ascending or
descending) is defined on the index
and not on the column
Sequence ExtStartWith Sequence first value for Interbase
generator
ExtIncrement Sequence increment value for
Interbase generator
Chapter 13 DBMS-specific Features
PDM User's Guide 777
MS SQL Server
PowerDesigner supports Analysis Services in Microsoft SQL Server.
SQL Server Analysis Services concepts
The OLAP Services feature available in SQL Server version 7.0 is called
Analysis Services in SQL Server 2000.
SQL Server Analysis Services major features are:
The Analysis server that manages, stores multidimensional information
and serves client application requests for OLAP data. The server stores
cube metadata (cube definition specifications) in a repository.
Completed cubes can be stored in a variety of storage modes:
multidimensional database files (MOLAP), tables in a relational database
(ROLAP), or a hybrid of multidimensional database files and relational
tables (HOLAP)
A metadata repository that contains definitions of OLAP data objects
such as cubes and their elements
The PivotTable Service, which is an OLE DB for OLAP provider that
connects client applications to the Analysis server and manages offline
cubes
An object model called Decision Support Objects (DSO), that provides
support for the Analysis Manager user interface and for custom
applications that manage OLAP metadata and control the server. DSO
exposes the object model for the Analysis server. The DSO object model
contains interfaces, objects, collections, methods, and properties.
PowerDesigner creates and manipulates DSO objects to manage
metadata for OLAP data. DSO uses hierarchically arranged groups of
objects to define basic elements of OLAP data. These basic elements
include databases, dimensions, cubes, partitions, aggregations, and
virtual cubes. DSO addresses these basic elements in a hierarchical
structure where elements contain other elements in a tree, with the server
at the root of the tree
Source data for multidimensional cubes resides in relational databases where
the data has been transformed into a star or snowflake schema typically used
in OLAP data warehouse systems. Analysis Services can work with many
relational databases that support connections using ODBC or OLE DB.
For more information on SQL Server Analysis Services, see
corresponding DBMS documentation.
MS SQL Server
778 PowerDesigner
Comparing PowerDesigner and DSO metamodels
Conceptually, DSO uses hierarchically arranged groups of objects to define
basic elements of Analysis Services data storage, as implemented by the
Analysis server. These basic elements are databases, data sources,
dimensions, cubes, data mining models, and roles.
DSO maintains these basic elements in a hierarchical structure where
elements contain other elements in a tree, with the server object at the root of
the tree. Other objects support this basic structure. For example, databases,
cubes, partitions, and aggregations support dimensions.
PowerDesigner and DSO have a different metamodel. The following table
maps PowerDesigner to DSO objects.
PowerDesigner
object DSO object Comment
Model clsDatabase Each model corresponds to a
DSO Database
Data source clsDataSource
Chapter 13 DBMS-specific Features
PDM User's Guide 779
PowerDesigner
object DSO object Comment
Dimension ClsDatabaseDimension Like DSO Database
Dimension, PowerDesigner
dimensions are shared
among cubes
Cube clsCube Cubes managed by
PowerDesigner are only
local cubes
Fact clsCube A Fact corresponds to a DSO
cube in order to store
measures
Measure clsCubeMeasure
Dimension hierarchy clsDatabaseDimension Each dimension hierarchy is
generated as a DSO
Database Dimension.
Attributes of a dimension
hierarchy define levels of the
corresponding
DatabaseDimension
Dimension attribute clsDatabaseLevel
clsCubeLevel
Attributes of a dimension or
dimension hierarchy define
levels in a database
dimension
Cube dimension
association
clsCubeDimension A dimension association is
defined by a DSO Cube
Dimension. In DSO, when
the name of a Cube
Dimension corresponds to
the name of a Database
Dimension, the Cube
Dimension is automatically
associated with the Database
Dimension to be shared
between cubes
Enabling Microsoft Analysis Services in PowerDesigner
The Microsoft Analysis Services add-in is an ActiveX DLL (PdMsOlap.dll)
that needs to be enabled from the Add-in page of the General Options dialog
box.
MS SQL Server
780 PowerDesigner
For more information on add-ins, see section Add-ins in chapter
Accessing objects using VBScript in the General Features Guide.
For more information on enabling add-ins, see section Managing add-
ins in chapter Using the PowerDesigner Interface in the General Features
Guide.
Generating cubes
The Microsoft Analysis Services add-in lets you generate cubes.
To generate cubes:
1 Select ToolsMicrosoft Analysis ServicesGenerate Cubes.
The connection dialog box appears.
2 Type a server name. You can directly type the database name or open the
dropdown listbox in order to select a database name retrieved from the
server.
3 Click OK.
The Cube Selection dialog box appears. The state column indicates if the
cube has already been generated. Cubes already generated are deselected
by default.
Chapter 13 DBMS-specific Features
PDM User's Guide 781
4 Select the cubes you want to generate.
5 Click OK.
All cubes selected in the cube selection dialog box 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.
Reverse Engineering cubes
The Microsoft Analysis Services add-in lets you reverse engineer cubes.
To reverse engineer cubes:
1 Select ToolsMicrosoft Analysis ServicesReverse Engineer Cubes.
The connection dialog box appears.
MS SQL Server
782 PowerDesigner
2 Type a server name. You can directly type the database name or open the
dropdown listbox in order to select a database name retrieved from the
server.
3 Click OK.
The Source Model Selection dialog box appears to let you select the
models linked to the selected data source.
4 Select source models and click OK.
The Cube Selection dialog box appears. The state column indicates if the
cube already exists in the current model. Cubes already existing are
deselected by default.
Chapter 13 DBMS-specific Features
PDM User's Guide 783
5 Select the cubes you want to generate.
6 Click OK.
Selected cubes are created or updated in the current model. If a
dimension or a cube already exists, it is updated.
Customizing multi-dimensional objects
You can customize multi-dimensional objects using the following extended
attributes.
Extended
attribute Description
Options
PASSTHROUGH: causes the SELECT clause to be passed directly
to the source database without modification by PivotTable Service.
If PASSTHROUGH is not specified, PivotTable Service parses the
query and formulates a set of queries equivalent to the original that
is optimized for the source database and index structures. This set
of queries is often more efficient than the specified query
DEFER_DATA: causes the query to be parsed locally and executed
only when necessary to retrieve data to satisfy a user request.
DEFER_DATA is used to specify that a local cube has to be
defined in the ROLAP storage mode
Customizing cubes
MS SQL Server
784 PowerDesigner
Extended
attribute Description
ATTEMPT_DEFER: causes PivotTable Service to attempt to parse
the query and defer data loading if successful, or, if the query
cannot be parsed, to process the specified query immediately as if
PASSTHROUGH had been specified
ATTEMPT_ANALYSIS: causes PivotTable Service to attempt to
parse the query and formulate an optimized set of queries. If the
query cannot be parsed, PivotTable Services processes the query
immediately as if PASSTHROUGH had been specified
Extended
attribute Description
IsHidden Indicates whether the dimension is hidden from clients
Options Dimension options to manage member uniqueness and specify
their storage.
UNIQUE_NAME: Member names are unique within the
dimension.
UNIQUE_KEY: Member keys are unique within the dimension.
NOTRELATEDTOFACTTABLE: Indicates that non-leaf
members cannot be associated with fact table data.
ALLOWSIBLINGSWITHSAMENAME: Determines whether
children of a single member in a hierarchy can have identical
names.
SubType Indicates the subtype of a dimension.
PARENT_CHILD:Indicates that the dimension is a parent-child
dimension.
LINKED: Indicates that the cube is linked to another cube on a
remote Analysis server.
MINING: Indicates that the dimension is based on the content of
an OLAP data-mining model that has been processed for a
cube.
Template Contains a template string that is used to generate captions for
system-generated data members
Customizing
dimensions
Chapter 13 DBMS-specific Features
PDM User's Guide 785
Extended
attribute Description
TimeDef Indicates that a dimension refers to time (year, month, week, day,
and so on).
TIME: Indicates that a dimension refers to time (year, month,
week, day, and so on). The only valid levels in a time
dimension are those defined in the LevelTypes enumeration.
The following values post-fixed by an asterisk (*) are additional
values that can be used by the add-in but do not exist in the
MDX syntax:
ACCOUNT: (*) Describes a dimension that contains an account
structure with parent-child relationships.
BILLOFMATERIALS (*): Describes a dimension that represents
a material/component breakdown. The parent-child
relationship implies a parent composed of its children.
CHANNEL (*): Describes a dimension that contains information
about a distribution channel.
CURRENCY (*): Describes a dimension that contains currency
information.
CUSTOMERS (*): Describes a dimension that contains customer
information. The lowest level represents individual customers.
GEOGRAPHY (*): Describes a dimension that contains a
geographic hierarchy.
ORGANIZATION (*): Describes a dimension that represents the
reporting structure of an organization.
PRODUCTS (*): Describes a dimension that contains product
information. The lowest level represents individual products.
PROMOTION (*): Describes a dimension that contains
information about marketing and advertising promotions.
QUANTITATIVE (*): Describes a dimension that contains
quantitative elements (for example, income level, number of
children, and so on).
RATES (*): Describes a dimension that contains different types of
rates (for example, buy, sell, discounted. and so on).
SCENARIO (*): Describes a dimension that contains different
business scenarios.
Extended attribute Description
CustomRollupExpr Contains a Multidimensional Expressions (MDX)
expression used to override the default roll-up mode
FormatKey Name of the column or expression that contains member
keys
FormatName Name of the column or expression that contains member
names
Customizing
attributes
MS SQL Server
786 PowerDesigner
Extended attribute Description
HideValues Options to hide level members:
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
member 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.
IsHidden Indicates whether the level is hidden from client
applications
Options Options about member uniqueness, ordering and data
source.
UNIQUE: Indicates that the members of a level are
unique.
UNIQUE_NAME: Indicates that their member name
columns uniquely identify the level members.
UNIQUE_KEY: Indicates that their member key
columns uniquely identify the level members.
NOTRELATEDTOFACTTABLE: Indicates that the
level members cannot be associated with fact table
data.
SORTBYNAME: Indicates that level members are
ordered by their names.
SORTBYKEY: Indicates that level members are ordered
by their keys.
SORTBYPROPERTY <property names>: Indicates that
members are ordered by their property <property
names>.
RootValues Determines how the root member or members of a
parent-child hierarchy are identified.
ROOT_IF_PARENT_IS_BLANK: Only members with
a null, a zero, or an empty string in their parent key
column are treated as root members.
ROOT_IF_PARENT_IS_MISSING: Only members
with parents that cannot be found are treated as root
members.
ROOT_IF_PARENT_IS_SELF: Only members having
themselves as parents are treated as root members.
ROOT_IF_PARENT_IS_BLANK_OR_SELF_OR_MIS
SING: Members are treated as root members if they
meet one or more of the conditions specified by
ROOT_IF_PARENT_IS_BLANK,
ROOT_IF_PARENT_IS_SELF, or
ROOT_IF_PARENT_IS_MISSING.
Chapter 13 DBMS-specific Features
PDM User's Guide 787
Extended attribute Description
Type Identifies the specific type of level:
ALL: Indicates the top (All) level of a dimension (the
one that precalculates all the members of all lower
levels).
YEAR: Indicates that a level refers to years. It must be
used in a dimension which type is Time dimension.
QUARTER: Indicates that a level refers to (calendar)
quarters. It must be used in a dimension which type
is Time dimension.
MONTH: Indicates that a level refers to months. It must
be used in a dimension which type is Time
dimension.
WEEK: Indicates that a level refers to weeks. It must be
used in a dimension which type is Time dimension.
DAY: Indicates that a level refers to days. It must be
used in a dimension which type is Time dimension.
DAYOFWEEK: Indicates that a level refers to days of
the week. It must be used in a dimension which type
is Time dimension.
DATE: Indicates that a level refers to dates. It must be
used in a dimension which type is Time dimension.
HOUR: Indicates that a level refers to hours. It must be
used in a dimension which type is Time dimension.
MINUTE: Indicates that a level refers to minutes. It
must be used in a dimension which type is Time
dimension.
SECOND: Indicates that a level refers to seconds. It
must be used in a dimension which type is Time
dimension.
Extended attribute Description
IsHidden Indicates whether the hierarchy is hidden from client
applications
Customizing
Hierarchy
NonStop SQL extended attributes
788 PowerDesigner
NonStop SQL extended attributes
The following extended attributes are defined by default in the NonStop SQL
DBMS.
Object type Extended attribute Use
Column ExtType Specifies an extended type for
columns, listed in extended
attribute type TExtType
Chapter 13 DBMS-specific Features
PDM User's Guide 789
PostgreSQL extended attributes
The following extended attributes are defined by default in the PostgreSQL
DBMS.
Object type Extended attribute Use
Domain ExtTypeDelimiter Delimiter character for the
array
ExtTypeElement Specifies the type of the array
elements
ExtTypeInput Name of a function, created by
CREATE FUNCTION, which
converts data from its external
form to the internal form of the
type
ExtTypeLength Literal value which specifies
the internal length of the new
type
ExtTypeOutput Name of a function, created by
CREATE FUNCTION, which
converts data from its internal
form to a form suitable for
display
ExtTypePassedByValue Indicates that operators and
functions which use this data
type should be passed an
argument by value rather than
by reference
ExtTypeReceive Name of a function, created by
CREATE FUNCTION, which
converts data of this type from
a form suitable for transmission
from another machine to
internal form
ExtTypeSend Name of a function, created by
CREATE FUNCTION, which
converts data of this type into a
form suitable for transmission
to another machine
Informix extended attributes
790 PowerDesigner
Informix extended attributes
The following extended attributes are defined by default in the Informix
DBMS.
Object type Extended attribute Use
Column ExtSerialStart Defines the initial value of the
column with a SERIAL datatype
Chapter 13 DBMS-specific Features
PDM User's Guide 791
MySQL extended attributes
The following extended attributes are defined by default in the MySQL
DBMS.
Object type Extended attribute Use
Key ExtUnique When set to True, indicates that the
key is unique. False implies that
the key allows duplicate values
Index FullText Indicates that the index is a full
text index
Model DatabaseType Indicates the type of the database,
as specified in the extended
attribute type DatabaseType
Reference ReferenceMatch Indicates the reference match type,
as specified in the extended
attribute type ReferenceMatchType
MySQL extended attributes
792 PowerDesigner
PDM User's Guide 793
A P P E N D I X
Variables in PowerDesigner
This chapter presents the variables that are available in PowerDesigner.
These variables can be used for database generation, trigger and procedure
generation, and reverse engineering.
Topic Page
List of PowerDesigner variables 794
List of PowerDesigner formatting variables 806
About this chapter
Contents
List of PowerDesigner variables
794 PowerDesigner
List of PowerDesigner 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
The following variables can be used for all named object definitions:
Variable name Comment
@OBJTNAME Object name
@OBJTCODE Object code
@OBJTLABL Object comment
@OBJTDESC Object description
The following variables can be used in all object definitions:
Variable name Comment
COMMENT Object comment. If no comment is defined the object name is
used
OWNER Generated code of the object owner, or the object parent
DBPREFIX Database prefix of object (name of database + '.' if database
defined)
QUALIFIER Whole object qualifier (database prefix + owner prefix)
OPTIONS SQL text defining physical options for object
CONSTNAME Object constraint name
CONSTRAINT Object constraint SQL body. For example(A <= 0) AND (A
>= 10)
RULES Concatenation of server expression for business rule
associated with object
Common variables
for all named
objects
Common variables
for objects
Appendix Variables in PowerDesigner
PDM User's Guide 795
The following variables can used in a table definition:
Variable name Comment
TABLE Generated code of the table
TNAME Table name
TCODE Table code
TLABL Table comment
PKEYCOLUMNS List of primary key columns. For example: A, B
TABLDEFN Complete body of the table definition. It contains
definition of columns, checks and keys
CLASS Abstract data type name
CLUSTERCOLUMNS List of columns used for the cluster
The following variables can be used in domain check parameter and column
check parameter definitions:
Variable name Comment
UNIT Standard check unit attribute
FORMAT Standard check format attribute
DATATYPE Data type. For example int, char(10) or numeric(8, 2)
DTTPCODE Data type code. For example int, char or numeric
LENGTH Data type length. For example 0, 10 or 8
PREC Data type precision. For example 0, 0 or 2
ISRDONLY TRUE if the read-only attribute of standard check is selected
DEFAULT Default value
MINVAL Minimum value
MAXVAL Maximum value
VALUES List of values. For example(0, 1, 2, 3, 4, 5)
LISTVAL SQL constraint associated with a list of values. For example
C1 in (0, 1, 2, 3, 4, 5)
MINMAX SQL constraint associated with minimum and maximum
values. For example(C1 <= 0) AND (C1 >= 5)
ISMAND TRUE if the domain or column is mandatory
Table variables
Variables for
domain and
column checks
List of PowerDesigner variables
796 PowerDesigner
Variable name Comment
MAND Contains the keywords "null" or "not null" depending on if
the attribute is mandatory or not mandatory
NULL Contains keyword "null" if the domain or column is not
mandatory
NOTNULL Contains Keyword "not null" if the domain or column is
mandatory
IDENTITY Keyword "identity" if the domain or column is identity
(Sybase specific)
WITHDEFAULT Keyword "with default" if the domain or column is with
default
ISUPPERVAL TRUE if the upper-case attribute of standard check is
selected
ISLOWERVAL TRUE if the lower-case attribute of standard check is selected
The following variables can be used in a column definition:
Variable name Comment
COLUMN Generated code of the column
COLNNO Position of Column in List of columns of Table
COLNNAME Column name
COLNCODE Column code
PRIMARY Contains Keyword "primary" if the column is a primary key
column
ISPKEY TRUE if the column is part of a primary key
FOREIGN TRUE if the column is part of a foreign key
COMPUTE Compute constraint text
Column variables
Appendix Variables in PowerDesigner
PDM User's Guide 797
The following variables can be used in an abstract data type definition:
Variable name Comment
ADT Generated code of the abstract data type
TYPE Type of Abstract data type. For example "array", or "list"
SIZE Abstract data type size
ISARRAY TRUE if the abstract data type is of type array
ISLIST TRUE if the abstract data type is of type list
ISSTRUCT TRUE if the abstract data type is of type structure
ISOBJECT TRUE if the abstract data type is of type object
ISJAVA TRUE if the abstract data type is of type JAVA class
ADTDEF Contains definition of the abstract data type
The following variable can be used in an abstract data type attribute
definition:
Variable name Comment
ADTATTR Generated code of an abstract data type attribute
The following variable can be used in a domain definition:
Variable name Comment
DOMAIN Generated code of a domain (also available for columns)
The following variables can be used in a business rule definition:
Variable name Comment
RULE Generated code of a business rule
RULENAME Rule name
RULECODE Rule code
RULECEXPR Rule client expression
RULESEXPR Rule server expression
Abstract data type
variables
Abstract data type
attribute variables
Domain variables
Business rule
variables
List of PowerDesigner variables
798 PowerDesigner
The following variables can be used in an index definition:
Variable name Comment
TABLE Generated code of the parent of an index, can be a table or a
query table (view)
INDEX Generated code of the index
INDEXNAME Index name
INDEXCODE Index code
UNIQUE Contains keyword "unique" when an index is unique
INDEXTYPE Contains the index type (DBMS dependant)
CIDXLIST List of index columns. For example A asc, B desc, C asc
INDEXKEY Contains keywords "primary", "unique" or "foreign"
depending on an index origin
CLUSTER Contains keyword "cluster" when an index is a clustered
index
INDXDEF Index definition (list of columns)
The following variables can be used in index column definitions:
Variable name Comment
ASC Contains keywords "ASC" or "DESC" depending on the sort
order
ISASC TRUE if the index column sort is ascending
The following variables can be used in a reference definition:
Variable name Comment
REFR Generated code of the reference
PARENT Generated code of the parent table
PNAME Parent table name
PCODE Parent table name
PQUALIFIER Parent table qualifier. See also QUALIFIER
CHILD Generated code of a child table
CNAME Child table name
CCODE Child table code
Index variables
Index column
variables
Reference
variables
Appendix Variables in PowerDesigner
PDM User's Guide 799
Variable name Comment
CQUALIFIER Child table qualifier. See also QUALIFIER
REFRNAME Reference name
REFRCODE Reference code
FKCONSTRAINT Foreign key (reference) constraint name
PKCONSTRAINT Constraint name of the primary key used to reference the
object
CKEYCOLUMNS List of parent key columns. For example: C1, C2, C3
FKEYCOLUMNS List of child foreign key columns. For example: C1, C2, C3
UPDCONST Update declarative constraint. This can be any of the
following keywords
Restrict
Cascade
Set null
Set default
DELCONST Delete declarative constraint. This can be any of the
following keywords
Restrict
Cascade
Set null
Set default
MINCARD Minimum cardinality
MAXCARD Maximum cardinality
POWNER Parent table owner name
COWNER Child table owner name
CHCKONCMMT TRUE when check on commit is selected on a reference
(ASA 6.0 specific)
JOINS Reference joins
REFRNO Reference number in the child table collection of references
The following variables can be used in reference column definitions:
Variable name Comment
CKEYCOLUMN Generated code of the parent table column (primary key)
FKEYCOLUMN Generated code of a child table column (foreign key)
PK Generated code of a primary key column
Reference column
variables
List of PowerDesigner variables
800 PowerDesigner
Variable name Comment
PKNAME Primary key column name
FK Generated code of a foreign key column
FKNAME Foreign key column name
AK Alternate key column code (same as PK)
AKNAME Alternate key column name (same as PKNAME)
COLTYPE Primary key column data type
DEFAULT Foreign key column default value
HOSTCOLTYPE Primary key column data type used in procedure
declaration. For example: without length
The following variables can be used in a key definition:
Variable name Comment
COLUMNS
COLNLIST
List of key columns. For example"A, B, C"
ISPKEY TRUE when a key is the primary key for the table
PKEY Primary key constraint name
AKEY Alternate key constraint name
KEY Key constraint name
ISMULTICOLN True if the key has more than one column
CLUSTER Cluster keyword
The following variables can be used in a view definition:
Variable name Comment
VIEW Generated code of the view
VIEWNAME View name
VIEWCODE View code
VIEWCOLN List of columns of a view. For example: "A, B, C"
SQL SQL text of a view. For example Select * from T1
VIEWCHECK Contains the keyword "with check option" if this option is
selected in the view property sheet
SCRIPT Complete view creation order. For example create view V1
as select * from T1
Key variables
Variables for views
Appendix Variables in PowerDesigner
PDM User's Guide 801
The variables listed below can be used in a trigger definition. You can also
use parent table variables in a trigger definition.
Variable name Comment
ORDER Order number of Trigger (where the current DBMS
supports more than one trigger of one type)
TRIGGER Generated code of the trigger
REFNO Reference order number in the list of references for the
table
ERRNO Error number for standard error
ERRMSG Error message for standard error
MSGTAB Name of a table containing user-defined error messages
MSGNO Name of a column containing error numbers in a user-
defined error table
MSGTXT Name of a column containing error messages in a user-
defined error table
SCRIPT SQL script of trigger or procedure.
TRGBODY Trigger body (only for Oracle ODBC reverse engineering)
TRGDESC Trigger description (only for Oracle ODBC reverse
engineering)
TRGDEFN Trigger definition
The following variables can be used for database, procedure, and trigger
generation:
Variable name Comment
DATE Generation date & time
USER Login name of the user executing the generation
PATHSCRIPT Path where the file script will be generated
NAMESCRIPT Name of the file script where SQL orders will be written
STARTCMD Description explaining how to execute a generated script
ISUPPER TRUE if upper case generation option is set
ISLOWER TRUE if lower case generation option is set
DBMSNAME Name of the DBMS associated with the generated model
Trigger variables
Database, trigger,
and procedure
generation
variables
List of PowerDesigner variables
802 PowerDesigner
Variable name Comment
DATABASE Code of the database associated with the generated model
The following variables can be used when reverse engineering a database
into a PDM:
Variable name Comment
R Set to TRUE during reverse engineering
S Allows to skip a word. The string is parsed for reverse
engineering but is not generated
D Allows to skip a numeric value. The numeric value is parsed
for reverse engineering but is not generated
A Allows to skip all text. The text is parsed for reverse
engineering but is not generated
ISODBCUSER True if the current user is the connected user
CATALOG Catalog name that will be used in ODBC reverse engineering
queries
SCHEMA Schema that will be used in ODBC reverse engineering
queries
SIZE Data type size of a column or a domain. Used for ODBC
reverse engineering, when a data type length is not defined in
the system tables
VALUE One value from the list of values in a column or domain
TRGTYPE Variable used in the Create order of a trigger. Trigger type
uses keywords for each trigger type, for example
"BeforeInsert", or "AfterUpdate"
TRGEVENT Variable used in the Create order of a trigger. Trigger event
uses keywords for each trigger event, for example" Insert",
"Update", and "Delete"
TRGTIME Variable used in the Create order of a trigger. Timing of
trigger uses the keywords "Null", "Before", and "After"
Reverse
engineering
variables
Appendix Variables in PowerDesigner
PDM User's Guide 803
The following variables can be used for database generation when
synchronizing a modified PDM with an existing database:
Variable name Comment
OLDOWNER Old owner name of the object. See also OWNER
NEWOWNER New owner name of the object. See also OWNER
OLDQUALIFIER Old qualifier of the object. See also QUALIFIER
NEWQUALIFIER New qualifier for the object. See also QUALIFIER
OLDTABL Old code of the table
NEWTABL New code of the table
OLDCOLN Old code of the column
NEWCOLN New code of the column
The following database security variables are available:
Variable name Comment
PRIVLIST List of privileges for a grant/revoke order
PERMLIST List of permissions for a grant/revoke order
GRANTEE Name of the user, group, or role for a grant/revoke order
ID Name of the user
GROUP Name of the group
ROLE Name of the role
OBJECT Database objects (table, view, column, and so on)
PERMISSION SQL grant/revoke order for a database object
PRIVILEGE SQL grant/revoke order for an ID (user, group, or role)
GRANTOPTION Option for grant: with grant option / with admin option
REVOKEOPTION Option for revoke: with cascade
The following metadata variables are available:
Variable name Comment
@CLSSNAME Localized name for an object class. For example: Table,
View, Column, Index
Database
synchronization
variables
Database security
variables
Metadata variables
List of PowerDesigner variables
804 PowerDesigner
Variable name Comment
@CLSSCODE Object class code. For example: TABL, VIEW, COLN,
INDX
The following DBMS and database options variables are available:
Variable name Comment
TABLESPACE Generated code of a tablespace
STORAGE Generated code of a storage
The following DBMS specific variables are available for Sybase Adaptive
Server Anywhere and Microsoft SQL Server:
Variable name Comment
RULENAME Name of a business rule object associated with a domain
DEFAULTNAME Name of a default object associated with a domain
USE_SP_PKEY Use sp_primary key to create primary keys (SQL Server)
USE_SP_FKEY Use sp_foreign key to create foreign keys (SQL Server)
The following variable can be used in a sequence definition:
Variable name Comment
SQNC Name of sequence
The following variables can be used in a procedure definition:
Variable name Comment
PROC Generated code of a procedure (also available for trigger
when a trigger is implemented with a procedure)
FUNC Generated code of a procedure where the procedure is a
function (with a return value)
DBMS, database
options variables
Variables for ASE
& SQL Server
Sequence variable
Procedure
variables
Appendix Variables in PowerDesigner
PDM User's Guide 805
The following variables can be used in a join index definition:
Variable name Comment
JIDX Generated code for join index
JIDXDEFN Complete body of join index definition
REFRLIST List of references (for ODBC)
RFJNLIST List of reference joins (for ODBC)
Join index
variables (IQ)
List of PowerDesigner formatting variables
806 PowerDesigner
List of PowerDesigner formatting variables
Variables have a syntax that can force a format on their values, as follows:
Force values to lower-case or upper-case characters
Truncate the length of values
When a variable does not specify formatting, its values have the same format
as in the PDM.
Format code Format of variable value in script
.L Lower-case characters
.T Removes blank spaces
.U Upper-case characters
.c Upper-case first letter and lower-case next letters
.n Maximum length where n is the number of characters
n Justifies to fixed length where n is the number of characters
-n Right justify variable text to fixed length where n is the number
of characters
You embed formatting options in variable syntax as follows:
%.format:variable%
For example:
%.L:TABLE%
The table below shows formatted variables and their results in a script for the
table EMPLOYEE.
Template statement with variable Resulting script statement
create trigger %TABLE% create trigger EMPLOYEE
create trigger %.L:TABLE% create trigger employee
create trigger %.U:TABLE% create trigger EMPLOYEE
create trigger %.4:TABLE% create trigger EMPL
create trigger %.4L:TABLE% create trigger empl
PDM User's Guide 807
PDM Glossary
User defined data type which encapsulates a range of data values and
functions. The functions are both defined on, and operate on the set of values
Column or columns whose values uniquely identify a row in the table and are
not primary key columns
Shows the axis of investigation of the dimension in the cube
Qualifies dimensions used in queries. For example, the Time dimension can
contain attributes Year, Quarter, Month, and Week
A data type used for large binary objects such as images
Written statement specifying what the information system must do or how it
must be structured to support business needs
Index in which the physical order and the logical (indexed) order is the same
Data structure that contains an individual data item within a row (record),
model equivalent of a database field
Used to eliminate frequent joins between tables and improve query
performance
Entity-relationship diagram that models the information system without
considering the details of physical implementation
Named check that enforces data requirements, default values, or referential
integrity on a table or a column
Collection of measures corresponding to values stored into each of its data
cell. The measures are organized into dimensions to provide for faster
retrieval and drill-down
abstract data type
(ADT)
alternate key
association
attribute
binary long object
(BLOB)
business rule
clustered index
column
column
denormalization
Conceptual Data
Model (CDM)
constraint
cube
Glossary
808 PowerDesigner
Identification of the data to access, its operating system, DBMS, and network
platform
Text file in XML format that contains all the SQL syntax and specifications
for a Database Management System
Axis of analysis in a multidimensional structure
Table that stores data related to the axis of investigation of a fact. For
example, geography, time, product
Set of values for which a data item is valid
Set of measures manipulated by the cube. For example, Sale, Revenue,
Budget are facts
Table that stores variable numerical values related to aspects of a business
Column or columns whose values depend on and migrate from a primary key,
or an alternate key, in another table
A function is a form of procedure that returns a value to the calling
environment for use in queries and other SQL statements
In an XML model, a global element is the root element of an XML hierarchy.
SQL/XML queries are generated from global elements, directly through the
SQL/XML Wizard or indirectly through the XML Builder Wizard
Defines navigational and consolidation paths through dimensions
Consists in segmenting a table into multiple tables each containing a subset of
rows and the same columns as the partitioned table
Data structure that is based on a key and that speeds access to data and
controls unique values
Within a reference, a link between each foreign key column referring to a
matching primary key column
Variable that corresponds to the focus of an investigation, it describes the
meaning of the analytical values stored in each data cell of the cube.
Measures are most of the time numeric values like for example Price or Total
data source
DBMS
dimension
dimension table
domain
fact
fact table
foreign key
function
global element
hierarchy
horizontal
partitioning
index
join
measure
PDM Glossary
PDM User's Guide 809
Open Database Connectivity (ODBC) interface which gives PowerDesigner
access to data in database management systems (DBMS)
Part of the Open Database Connectivity (ODBC) interface that processes
ODBC functions calls, submits SQL requests to a specific data source, and
returns results to the application
Online Analytical Processing is a class of analytic application software that
exposes business data in a multidimensional format
Usage restrictions set on a particular database object for a particular user,
group or role
Table-reference diagram that models the information system including the
details of physical implementation
Column or columns whose values uniquely identify a row in a table
Set of rights assigned to a database user, group, or role
Window that displays the properties of an object
Link between a parent table and a child table. A reference can link tables by
shared keys or by specified columns
Rules governing data consistency, specifically the relationships among
primary keys and foreign keys of different tables
Process of generating a PDM, or specific PDM objects, from an existing
database schema
XML extension of the Structured Query Language. To retrieve relational data
using the SQL syntax and edit the results in an XML format. A SQL/XML
Wizard and a SQLXML macro allow you to insert SQL/XML queries in the
definition of a trigger or a procedure
Sub-classification used to extend the semantics of an object without changing
its structure; it can be predefined or user-defined
Named partition that stores tables and indexes on a storage device
ODBC
ODBC driver
OLAP
permission
Physical Data
Model (PDM)
primary key
privilege
property sheet
reference
referential integrity
reverse
engineering
SQL/XML
stereotype
storage
Glossary
810 PowerDesigner
A stored procedure is a precompiled collection of SQL statements stored
under a name and processed as a unit
Alternative name for various types of objects used to mask the name and
owner of an object, provide location transparency for remote objects of a
distributed database, and simplify SQL statements for database users
Collection of rows (records) that have associated columns (fields)
Consists in merging tables into a single table in order to eliminate joins and
to improve query performance
Named partition that stores tables and indexes in a database
Segment of SQL code associated with a table, 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
Index in which no two rows can have the same index value, including NULL
Name that identifies a person or group working with objects in a PDM, and
which has the ability to own other objects in the PDM
Consists in segmenting a table into multiple tables each containing a subset of
columns and the same number of rows as the partitioned table
Alternate way of looking at the data in one or more tables. Usually created as
a subset of columns from one or more tables
An application stored on a Web server that you can access remotely through
standard Web protocols (HTTP, SOAP) and data formats (HTML, XML,
WSDL), whatever the systems and programming languages
The XML Builder Wizard, available from the Tools menu, helps you build a
mapped XML model from a PDM open in the workspace. The generated
XML model is linked to the SQL/XML extended model definition, so that
you can generate SQL/XML queries from global elements
stored procedure
synonym
table
table collapsing
tablespace
trigger
unique index
user
vertical partitioning
view
Web service
XML Builder
Wizard
Index
PDM User's Guide 811
A
abstract data type 53
abstract object 298
attribute variable 797
categories 77
check 297
code uniqueness 298
create 80, 566
define 77
drop 566
instantiable object 298
link to Java class 85
name uniqueness 298
property 79
use in PowerDesigner 78
variable 797
abstract data type procedure
check 298
code uniqueness 299
definition 299
name conflict with attribute 299
name uniqueness 299
return type 299
access
database 533, 620
Java class 88
trigger property 403
Access 97 387, 574, 725
access.mdb 574, 725
add
column to key 114
package hierarchy 688
reference to join index 766
template item to trigger template 413
add-in MS SQL Server 779
admin option 629
administrator permission 366
ADT See abstract data type
AKCOLN 451
alias 648
all permission 634
ALLCOL 452
alter
permission 634
script 577
statement 576
alternate key 5
column 117
constraint 119, 120
define 111
designate 117
display 57
generate 560, 562
generate index 157
index 148, 150, 152, 563
list 55
name 118
number 58, 120
physical option 562
variable 120
analysis
server 777
services 777
annotated schema 708
apm 25
apply transformation 714
archive 25
synchronize generation 577
ASK column default 92
assign
alias to column 174
alias to table 174
data profile 603
test data profile 586
association (multidimensional diagram) 6, 235,
351
between cubes and dimensions 235
check 314
create 235
display preferences 237
existence of hierarchy 314
fact 237
list 235
812 PowerDesigner
association (multidimensional diagram)
(continued)
235, measure 237
modify 237
name uniqueness 314
properties 235, 237
symbol 235
attach procedure to table 449
attribute (multidimensional diagram) 6, 217, 351
check 313
create 218
dimension 216, 218
display 216
list 218
mapping 335
mapping not defined 313
modify 219
name uniqueness 313
properties 217, 219
symbol 218
auto-arrange join order 132
auto-increment column in Sybase ASA 775
auto-layout during reverse engineering 368
automatic
archive 25
correct 273, 274
error correction 272
generate test data 589, 592, 594
rebuild triggers 395
trigger creation 395
auto-migrate 114, 124
check parameter 114
column 127
default join 130
domain 114
foreign key 16
validation rule 114
auto-reuse columns 124, 127
B
backup table 576
use alter statements 576
use create statements 576
base object 648
based on 53
begin script 445, 552, 556, 557, 560, 564
bend
reference 145, 146
bend (continued)
view reference 190
bibliography xvii
binary data type 67, 673
bind package in IBM DB2 724
bitmap data type 67, 673
bitmap index 149
bitmap join index 730
add reference 736
check model 314
column 735
create 733
options in Oracle 731
properties 731
rebuild 731
table 734
bitmap view index 193
BLOB average size 548
block terminator 366
boolean data type 66, 671
build
index 157
reference 136
business rule (PDM) 36, 37
apply 45, 199
check model 277
constraint 40
create 38
definition 38
domain 70
expression 39, 199
fact 38
formula 38
property 37
type 37, 38
validation 38, 199, 560, 565
variable 797
byte data type 66, 671
C
candidate key 111
cardinality
format 140
maximum 140
minimum 140
reference 140, 143, 145
referential integrity 140
case sensitive 11
PDM User's Guide 813
CDM
data type 671
generate 673, 675
generate from PDM 676
generate PDM 680
generation options 673, 675
global model 676
modify 671
open in current version 680
preserve 671
serial data type 97
update 671, 678
CDM objects
translate from PDM 671
CDM/PDM pair 364
change target database 533
character
data profile 592
format 470, 566, 576
mask 592
script 470, 566, 576
check model
abstract data type 297
abstract data type procedure 298
association 314
attribute (multidimensional diagram) 313
automatic correction 266
bitmap join index 314
business rule (PDM) 277
column 286
correct 271
correct manually 272
cube 309
cursor 304
data source object 307
database package 300
default 316
dimension 311
dimension hierarchy 313
domain (PDM) 282
exception 306
extended link 319
extended object 319
fact 310
fact measure 311
file object 308
global model 267, 268
group 280
horizontal partitioning 274
index 289
check model (continued)
join index 314
key 292
objects verified 274
option 266, 268
package (PDM) 267, 277
package procedure 302
package type 305
PDM 266, 268, 271, 272
procedure 306
reference 294
replication (PDM) 316
role 281
select object 267
set error severity 266
storage 317
synonym 300
table 283
table collapsing 275
tablespace 318
trigger 294
user 279
variable 305
vertical partitioning 276
view 297
view index 291
view reference 296
web operation 320
web service 320
check parameter
additional 198
auto-migrate 114
column 108, 195, 199, 560
constraint 56, 108
data profile 603
data type 104
define 195
domain 70, 195, 199
generate 560, 565
property 195
standard 195
table 56, 560
type 195
validation 199
validation rule 36, 37, 195
child table 120
change 135
choose DBMS 24
circular extended dependency 180, 472
clause insert 175
814 PowerDesigner
clear index 157
client
business rule (PDM) 39
expression 39, 199
CLIENTEXPRESSION 459
close
database 564
PDM 25
clustered index 148, 150
CODASYL 147
code maximum length
web operation 321
web service 320
code uniqueness
extended link 319
extended object 319
web operation 320
web service 320
collapse tables 256
column 5
add 107
add to key 114
additional checks 92
alias assign 174
alternate key 117
assign default 74
attach domain 106
auto-migrate 127
auto-reuse 127
average length 93
bitmap join index 735
check model 286
check parameter 195, 199, 560
check parameter variable 795
comment 560
computed 92, 95
computed expression 93
constraint 108
constraint business rule 46
create 94, 107, 560
data type 57, 103, 183
default 92
default hierarchy 216
define 92, 94
details 92, 93
display 57
distinct values 93, 94
domain 70
domain coherence 70
duplicate 107
column (continued)
enforce coherence 14
fill parameter 601
foreign key 92, 113
generate 560
hierarchy 216
identity 57, 92
indicated property 601
indicator 57
link to key 131
list 55, 109
mapping 328
migrate 131
non-divergence from domain 70
null 57
null values 93
options 92
permission 638, 641
primary key 92, 111
properties 163
property 92
remove from index 156
reuse 131
sequence for 97
sort 109
standard checks 92
table 55, 57
test data 94
test data parameter 93
validation rule 199, 560
variable 199, 454, 796
view 162, 183
view index 194
with default (DB2) 92
column denormalization 261
delete replica 263
duplicate columns 261
generate PDM 263
replication 261
revert 263
select column 261
wizard 261
column mapping 331
mapped to 331
sources 331
command
storage 543, 545
tablespace 543, 545
comment
column 560
PDM User's Guide 815
comment (continued)
generate name for empty comment 566
package (PDM) 29
script 470, 566, 576
table 560
view 561
composite view 28
computed column 92, 95
conceptual data type 533
configure
CDM options 675
data source 529
OOM options 686
storage 540
tablespace 540
confirm delete 16
connect
data source 531
database 532, 537, 538
constant 742
constraint
alternate key 119, 120
business rule 40
column 108
delete 141, 431
foreign key 119, 120
generate 117
insert 430
link index 152
name 56, 108, 119, 120
primary key 119
table 56
unique 117
update 141, 431
constraint business rule 40
apply to table or column 46
column 46
create 42
generate 44
reverse engineer 44
table 46
constraint name
default 119, 120, 121
display 143
label 143
convert external sources 353
copy DBMS 20
correct
automatic 266, 272, 273
check model 271
correct (continued)
error 266
manual 272
PDM 271, 273
create statement 576
creation script for synchronizing PDM 583
criteria for mapping 328, 335, 338
CSV file
import 599
import restriction 599
cube 6, 351
check 309
create 224
define 223
display preference 226
duplicated association 309
existence of association 309
existence of fact 309
fact 226
generate cube data 348
generate in MS SQL Server 780
list 224
measure 226
modify 225
name uniqueness 309
property 223, 225
rebuild 343
reverse engineer in MS SQL Server 781
symbol 224
cube data generation 348
data fields 349
define query 348
dimension 349
member 349
text file 349
cursor
check 304
code uniqueness 304
database package 301
definition 304, 744
in database package 744
name uniqueness 304
parameters 304, 744
public 744
return data type 744
return type 304
customize
function 443, 444
procedure 443, 444
script 552, 556, 557, 560, 564
816 PowerDesigner
D
data access 240
data fields 349
data profile
assign 603
assign from table 604, 606
check parameter 603
data source 588
date/time 589
define 586
export 607
foreign key 603
import 607
data source in a PDM 322, 323, 353
automatic 589
check 307
configure 529
connect 531
create 324
CSV file 599
define 529
define models 324
define ODBC connection 324
differing DBMS 308
disconnect 532
existence of PDM 308
list 596
models 324
name uniqueness 307
ODBC 324, 597
properties 324
select 326
synchronize generation 579
test data 588
data type 63, 66
average length 548
binary 67, 673
bitmap 67, 673
BLOB 548
boolean 66, 671
byte 66, 671
character 67
column 57, 103, 183
conceptual 671
convert to conceptual 533
create 565
date 67, 673
decimal 66, 671
default 16
data type (continued)
display 57
domain 64, 65, 68, 70
drop 565
float 66, 671
generate 564
image 67, 673
integer 66, 671
length 63, 66
money 66, 671
number 66, 671
OLE 67, 673
OOM 684
precision 63, 66
select 64, 103
serial 66, 671
time 67, 673
translate 533, 671
undefined 64, 65, 67, 68, 103, 673
user-defined 564
view 183
data warehouse
feature comparison 351
migrate 351
database 20
access 533, 620
add user to group 628
backup tables 576
change 533
close 564
connect 532, 537, 538
create 26, 552, 559, 564, 571, 572
create group 626
create script 552, 564
create trigger 478
create user 622
define 18
denormalization 240
display 532, 537, 538
drop 564
estimate size 546
generate 552, 559, 564, 571, 572, 577
generate PDM 369
generate privileges 644
group 621, 626
information 532
modify 559, 575, 577, 579, 583
MS Access 97 387, 574, 725
open 564
options variable 804
PDM User's Guide 817
database (continued)
owner 621
parameter 575
permission 634
physical option 564
prefix tablespace in DB2 OS/390 206, 716
preserve object 533
privilege 629
property 18
role 621, 624
script 571, 577
select 533
select object for generation 569
select Sybase AS IQ 754
size 546
synchronization variable 803
synchronize archive PDM 577
synchronize creation script 583
synchronize ODBC data source 579
target 533
user 621
variable 801
database package 737
body 737
check 300
code length 301
code uniqueness 301
create during generation 747
define 737
define cursors 744
define exceptions 745
define procedure 740
define types 746
define variables 742
drop during generation 747
existence of cursor 301
existence of exception 302
existence of procedure 301
existence of type 302
existence of variable 302
generate 747
initialization 746
insert procedure 739
name length 301
name uniqueness 301
owner 737
privilege 737
reverse engineer 748
specification 737
database package cursor 744
database package exception 745
database package procedure 739
check 302
code uniqueness 303
definition 303, 740
name uniqueness 303
parameters 303, 740
public 740
replication of stored procedure 739
return data type 740
return type 303
type 740
database package type 746
check 305
code uniqueness 305
definition 306
name uniqueness 305
date
data profile 589
data type 67, 673
DATE 757
DB2 716
column default 92
reverse engineer 370
DBCreateAfter 180, 472
DBMS 7
choose 24
copy 20
editor 7
library 20
logical model 661
non supported object 533
overview 7
physical option 203
preserve options 663
previous version 24
share 20
trigger template 409
decimal data type 66, 671
decision support object 777
declare referential integrity 567
default
assign 74
automatic rebuild 75
check model 316
code maximum length 317
column 92
constraint name 119, 120, 121
create 73, 561
define 73
818 PowerDesigner
default (continued)
delete and rebuild 75
drop 561
generate 561
implementation 16, 124
link on creation 124
name uniqueness 317
physical option 203
physical options objects 203
properties 73
rebuild 75
reuse 75
same value 317
test data profile 587
value 73
value empty 317
default profiles for test data 610
DEFINE 452
DEFINEIF 453
definition business rule (PDM) 38
delete confirmation 16
delete permission 634
denormalization 240
column denormalization 261
horizontal partitioning 241
table collapsing 256
vertical partitioning 248
DESC index column in Oracle 749
detach PDM from workspace 25
detail column 93
diagram
create table 53
insert table symbol 53
multidimensional 21
PDM 21
physical 21
dimension 6, 349
attribute (multidimensional diagram) 216, 218
check 311
create 214
create mapping 335
default hierarchy 312
define 213
display preference 216
duplicated hierarchies 312
existence of attribute 311
existence of hierarchy 312
generate for Oracle 751
hierarchies 216
list 214
dimension (continued)
mapping 334
mapping not defined 312
modify 215
name uniqueness 311
Oracle 749, 750
property 213, 215
symbol 214
dimension hierarchy 351
check 313
existence of attribute 314
name uniqueness 313
dimension table 351
disconnect data source 532
discriminant column 242
display preference
association (multidimensional diagram) 237
cube 226
dimension 216
package (PDM) 29
procedure 448
reference 143
table 57
view 183
view reference 189
distinct values 94
diverge from domain 14
domain (PDM)
access list 62
assign default 74
attach column 106
auto-migrate 114
business rule 70
check model 282
check parameter 70, 195, 199
check parameter variable 795
coherence 70
column 70
create 62
create from Browser 62
data type 63, 64, 65, 66, 68, 70
define 61, 62
diverge from 14
enforce 16, 70
enforce coherence 14
length 63, 66
mandatory 70
modify 69
non-divergence 70
precision 63, 66
PDM User's Guide 819
domain (PDM) (continued)
property 61
use 70
validation rule 199
variable 199, 797
drag
reference 145
view reference 190
drop
abstract data type 566
data type 565
database 564
default 561
foreign key 563
index 563
join index 564, 768
primary key 562
sequence 565
storage 565
table 560
tablespace 565
temporary tables 576
view 561
DSO metamodel 778
DTTM 757
duplicate columns 261
E
edit
script 552, 556, 557
trigger 403
enabledbprefix 716
EnableMultiCheck 40
end script 445, 552, 556, 557, 560, 564
enforce
domain 70
non-divergence 70
ERROR 453
error in check model 266
error message 453
display 271
parameter 471
PDM 266, 268, 271, 272
user-defined 479, 481
ERwin
embedded extended model definition 362
import 362
migrate CDM/PDM pair 364
ERwin (continued)
migrate physical model 363
migrating from 363
notation 363
user-defined properties 362
estimate
database size 546
model database size 549
tables database size 550
event 394
EventDelimiter 394
multiple 394
trigger 394
EventDelimiter 394
exception
check 306
code uniqueness 306
database package 302
name uniqueness 306
exception (database package) 745
execute permission 634
execute query 538
export data profile 607
expression
business rule 199
business rule (PDM) 39
client 39, 199
server 39, 199
extended attribute 564
DB2 716
IBM DB2 722
import model from previous version 357
import PowerBuilder extended model definition
355
Informix 790
Interbase 776
modify 358
MS Access 725, 726
MySQL 791
NonStop SQL 788
Oracle 752
PostgreSQL 789
PowerBuilder 355
Sybase ASA 775
Sybase ASE 774
Sybase IQ 772
extended dependencies
circular 180, 472
PDM 17
stored procedures 472
820 PowerDesigner
extended dependencies (continued)
view 168, 180
extended link
check 319
code uniqueness 319
name uniqueness 319
extended model definition
Imported Attributes 357
new PDM 8
PowerBuilder 355, 357
extended object
check 319
code uniqueness 319
name uniqueness 319
external
column 353
database 353
sources 353
table 353
external shortcut
generate 568
reverse engineer 568
extraction script 346
Select 346
F
fact 6, 351
association (multidimensional diagram) 237
business rule 38
check 310
create 228
create mapping 339
cube 226
define 227
existence of measure 310
list 228, 229
mapping 337, 338
mapping not defined 310
modify 229
name uniqueness 310
property 227, 229
symbol 228
fact measure
check 311
mapping not defined 310
name uniqueness 311
fact table 351
FASTPROJECTION 757
file object
check 308
external 308
name uniqueness 308
fill parameter
define value 601
indicated column property 601
filter
index 563
FKCOLN 454
float data type 66, 671
FOREACH_CHILD 454
FOREACH_COLUMN 455
FOREACH_PARENT 456
foreign key 5
auto-migrate 16, 114
change column 133
column 92, 113
constraint 119, 120
data profile 603
define 111
designate 113
drop 563
generate 560, 563
generate index 157
index 148, 150, 152, 563
name 150
number 58, 59
referential integrity 138
variable 120, 458
format
cardinality 140
character 470, 566, 576
script 470, 566, 576
variable 395, 413, 433, 558, 806
formula business rule 38
function
begin script 445
create 444
create in physical diagram 445, 447
custom 443, 444
define 443
edit with SQL editor 444
end script 445
function insert 444
insert SQL/XML macro 444
macro insert 444
operator insert 444
permission 634, 638
SQL/XML wizard 444
PDM User's Guide 821
function (continued)
symbol 445, 447
template 443
variable insert 444
function-based index 153
Oracle 8i 153
Oracle 8i2 153
reverse engineer 153
SqlListQuery 153
use variables 153
G
generate
% 559
[ ] 559
alternate key 560, 562
alternate key index 157
annotated schemas via XML Builder Wizard
708
automatic archive 25
automatic test data source 589, 592, 594
CDM 671, 673, 675
CDM from PDM 676
check parameter 560, 565
column 560
configure CDM options 675
configure OOM options 686
constraint 117
constraint business rule 44
create synonym 653
cube data 348
cubes in MS SQL Server 780
data source 359
data type 564
database 552, 559, 564, 571, 572, 577
database package 747
DBMS preserve options 663
default 561
drop group 645
drop role 645
drop synonym 653
drop user 644
error message 479, 481
extended attributes 564
external shortcut 568
external shortcut models 658
extraction script 346
for MS Access 97 574
generate (continued)
foreign key 560, 563
foreign key index 157
group 644, 645
group privilege 645
index 117, 157, 560, 562, 563
inheritance in PDM 714
inside table 560
join index 562, 564, 760, 768
key 562
model 660
modified database 575, 577, 579, 583
name for empty comment 566
new CDM 673
new model 658
new OOM 685
new PDM 662
new XML Model 694
new XML model from PDM 697
OOM 684, 685, 686, 687, 690
OOM object 683
options 32
options for test data 608
outside table 560
PDM 658, 662, 664
PDM from database 369
PDM from PDM 665
PDM to OOM 688
PDM to PDM 661
physical option 560, 563, 564
PowerBuilder extended attribute 359
preserve denormalized columns 263
preserve horizontal partitioning 245
preserve table collapsing 259
preserve vertical partitioning 252
primary key 560, 562
primary key index 157
privileges 644, 646
procedure 469
public names 359
reference 136
referential integrity 138, 560, 566, 567
reserved characters 559
reverse problem for external shortcut 568
role 644, 645
role privilege 645
round trip engineering 568
rule 565
script 470, 476, 560, 564, 566, 571, 576, 577
select object 472, 567
822 PowerDesigner
generate (continued)
select object owner 568
sequence 565
SQL/XML queries via XML Builder Wizard
708
storage 564, 565
stored procedures order 472
synonyms 652, 654
table 560
tablespace 564, 565
target models 658
test data 586, 596, 597, 599, 608
test data for a script 610
test data for ODBC 614
trigger 469, 470, 476, 478, 567
update model 658
updated XML model from PDM 698
user 644
user privilege 644
validation rule 199, 560, 565
view 560, 561
views order 180
XML model 693, 695
XML model via XML Builder Wizard 701
generated code variables 794
global model
CDM 676
check 268
check model 267
PDM 268
rebuild index 159
grant 629, 634
privilege 629
with admin option 629
with grant option 634
group 621, 626
add user 628
assign role 625
check model 280
create 626
create during generation 645
drop 645
generate 644
privilege 629, 645
GROUP BY in query 177
H
HAVING in query 178
HG index 149
hierarchy 6
create 221
define 220
dimension 216
list 221
modify 222
package (PDM) 28
property 220, 222
symbol 221
HIGHGROUP 757
HIGHNONGROUP 757
HNG index 149
horizontal partitioning 241
cancel 244
check model 274
delete 244
discriminant column 242
generate PDM 245
object 243, 245
partition definition 242
partitioned table 242
partitions 243
revert 247
wizard 242
I
IBM DB2
bind package 724
create database 719
create package 724
database checks 722
extended attributes 722
multiple database 719
multiple database as physical option 720
web services 486
IDEF1X 147
identity 57
column 92
column in Sybase ASE 773, 775
column in Sybase ASE 11, 12 773
SQL Server 92
Sybase 92
image data type 67, 673
implement trigger referential integrity 399
import
CSV file 599
data profile 607
PDM User's Guide 823
import (continued)
ERwin 362
model 362
model from previous version 357
PDM 362
PowerBuilder extended attributes 357
PowerBuilder extended model definition 355
XPF file 607
include external shortcut 568
INCOLN 457
index 5
alternate key 148, 150, 563
bitmap 149
change DBMS 149
check model 289
clear 157
clustered 148, 150
column variable 798
create 150, 152, 560
define 148
delete 160
display 57
drop 563
drop join 564
estimate database size 546
filter 563
foreign key 148, 150, 563
function-based 153
generate 117, 157, 560, 562, 563
HG 149
HNG 149
key constraint 152
LF 149
link to key/reference 152
list 55, 160
number 57, 58
owner 148, 149
permission 634
primary key 148, 150, 563
property 148
query table 192
rebuild 157
rebuild from global model 159
rebuild option 157
remove column 156
reverse DESC index column in Oracle 749
table 57, 150
type 757
types 149
unique 117, 148, 150
index (continued)
user define 150
variable 798
Informix extended attributes 790
inheritance 712
inheritance in PDM 714
apply transformations 714
initialization (database package) 746
insert
clause 175
constraint 430
GROUP BY in query 177
HAVING in query 178
ORDER BY in query 179
permission 634
procedure in template 427
trigger template 410, 427
WHERE in query 176
inside table 560, 562, 563
install java class 566
instead of trigger 164
integer data type 66, 671
Interbase
extended attribute 776
sequences 97
IQ 12.4.3 755
IQ index rebuild 756, 757
IQ12_4_3_Checks.vbs 755
J
Java class
access from PDM 88
link 85
remove 566
reverse engineer 88
join 122
change child column 133
create 130
default 130
define 130, 131
index 564
index generate 562, 564
migrate column 131
primary key 130
reference 129, 143
reuse column 131, 187
table collapsing 256
view reference 185, 186
824 PowerDesigner
JOIN 458
join index
check model 314
create 763, 768
define 759
drop 768
generate 760, 768
Sybase AS IQ 754, 759
table 763
variable 805
join order auto-arranged 132
justify variable 395, 413, 433, 558, 806
K
key
add column 114
alternate 111
check model 292
define 111
foreign 111
generate 562
link column 131
primary 111
variable 800
key number
alternate key 58
display 57
foreign key 58, 59
L
label
constraint name 143
referential integrity 143, 144
length of average data type 548
LF index 149
link
Java class 78, 88
Object-Oriented Model 85
reference 129
reverse Java class 78
view reference 185
list
alternate key 55
arrange 55
association (multidimensional diagram) 235
attribute (multidimensional diagram) 218
list (continued)
column 55, 109
cube 224
dimension 214
fact 228
hierarchy 221
index 55, 160
measure 232, 233
order 55
sort 109
standard data types 65
table 53, 55
test data 596
variable 395, 413, 432
LISTVAL check parameter 198
location of file object 308
logical model 4, 661, 712, 714
apply transformations 714
display inheritance 712
generate inheritance links 714
LOWFAST 757
M
macro
CLIENTEXPRESSION 459
SERVEREXPRESSION 459
SQLXML 460
trigger 451
trigger template 451
variable 395, 413, 432
manual creation of triggers 401
mapping 326, 332
attributes page 335
column 331
column sources 331
create 335
create for facts 339
create for tables 329
Criteria page 328, 335, 338
data source 322
dimension page 334
dimensions 334
fact page 338
facts 337
mapped to 331
measures page 338
relational to multidimensional 322, 332
relational to relational 322, 326
PDM User's Guide 825
mapping (continued)
Select page 329, 335, 338
source columns 328
source tables 328
tables 327
mask character 592
materialized query table 191
materialized view 191
index 192
measure 6, 351
association (multidimensional diagram) 237
create 232
cube 226
define 231
list 232, 233
mapping 338
modify 232, 233
property 231, 232, 233
symbol 232
member 349
message error for triggers 479
metadata variables 803
metric 351
migrate
data warehouse 351
ERwin model into CDM/PDM pair 364
ERwin physical model 363
from ERwin 363
object conversion from version 6 351
version 6 351, 680
MINMAX check parameter 198
mode
reference 145
view reference 190
model option 14
case sensitive 11
CODASYL 12
column 14
conceptual 12
domain (PDM) 14
IDEF1X 12
notation 12
relational 12
requirements 11
table 13
trigger 13
view 13
modify
backup tables 576
database 25, 559, 575, 577, 579, 583
modify (continued)
DBMS template item 440
DBMS trigger template 424
extended attribute 358
model trigger template 425, 441
template item 439
trigger 403
trigger from table 403
trigger template 421
money data type 66, 671
move reference to table 146
MS Access 725
MS Access extended attributes 726
MS SQL Server 777
ActiveX 779
analysis server 777
analysis services 777
cube extended attributes 783
customize attributes 785
customize cubes 783
customize dimensions 784
customize hierarchy 787
customize multi-dimensional objects 783
decision support object 777
dimension extended attributes 784
DSO metamodel 778
enable add-in 779
extended attributes 783, 785
generate cubes 780
hierarchy extended attributes 787
repository 777
reverse engineer cubes 781
multi DBMS environment 661
multidimensional diagram 21
association 235
basics 210
create 211
define 210
retrieve objects 341
what for 211
multiple database
checks 722
IBM DB2 20, 719
physical option 720
multiple triggers 406
MySQL extended attributes 791
826 PowerDesigner
N
name uniqueness
extended link 319
extended object 319
web operation 320
web service 320
namespace in PDM package 29
new PDM 8
NMFCOL 458
non supported object 533
non-divergence 70
NonStop SQL extended attributes 788
normalization 240
notation
CODASYL 12, 147
conceptual 12, 147
ERwin 363
IDEF1X 12, 147
model option (PDM) 12
model options 60
reference 144, 147
relational 12, 147
number
alternate key 120
reference 120
rows for test data 608
number data type 66, 671
O
object
attach to user 623
mapping 322
owner 621
PDM 5
object abstract data type 82
object data type in Oracle 727, 754
Object-Oriented Model See OOM
link 85
link Java class 78
ODBC
administrator 529
archive PDM 579
generate test data 614
interface 528
optimize reverse engineering 371
reverse engineer 366
reverse engineer DESC index column in Oracle
749
ODBC (continued)
reverse engineer tablespace physical options in
Oracle 748
synchronize generation 579
test data 597
OLE data type 67, 673
OOM See Object-Oriented Model
add package hierarchy 688
data type 684
generate 685
generate from PDM 688
generate object 683
generate update 690
generation options 684, 685, 687
object 683
open
CDM 680
database 564
PDM 24, 680
operation procedure 449
option
check model 266, 268
configure for generated CDM 675
configure for generated OOM 686
define PDM 10
for reverse engineering 371
physical 560, 563, 564
referential integrity 566, 567
script 470, 566, 576
Oracle
add reference to bitmap join index 736
bitmap join index 727, 730
bitmap join index column 735
bitmap join index in table 734
bitmap join index properties 731
create bitmap join index 733
database package 737
dimension properties 750
dimensions 749
extended attribute 752
generate dimensions 751
object data type 727, 754
rebuild bitmap join index 731
reverse engineer DESC index column 749
reverse engineer tablespace physical options
748
sequences 97
special variables 727
SQLJ object data type 727
ORDER BY in query 179
PDM User's Guide 827
order trigger 406
outside table 560, 562, 563
owner 148, 149, 568, 621, 623, 634
owner filter during reverse engineering 370, 374
P
package (PDM)
add hierarchy 688
bind in IBM DB2 724
check model 267, 277
code 29
comment 29
composite view 28
define 28
display preferences 29
hierarchy 28
name 29
namespace 29
property 29
shortcut code uniqueness 279
sub-package 28
parameter
create procedure 470
create trigger 470
error 471
generate CDM 673
generate PDM 662
generate test data 588
generate trigger 470
generate XML model 693
modify database 575
test data source 589, 592, 594
parent table 120, 366
change 135
partition 243, 250
add 245, 252
corresponding table 245, 252
delete 245, 252
horizontal 242
manage 245, 252
vertical 248
PBCatCol 355
PBCatTbl 355
PDM
archive 25
business rule 45
check 268, 272
check model 266, 271
PDM (continued)
close 25
correct 271, 273
create 2, 20
database 20
DBMS overview 7
define 19
detach from workspace 25
enable transformations 664
error 266, 268, 271, 272
extended dependencies 17
generate 658, 662, 664, 671, 693
generate from database 369
generate from package 660
generate from PDM 665
generation options 662, 664
global model 665
import 362
logical 4, 712
logical model 661
modify 19
object 5, 683
open 24
open in current version 680
preserve modifications 680
property 19
role 2
save 25
save as 25
select diagram type 21
select extended model definition 8
update 667
validation 266
verify 274
warning 266, 268, 271, 272
PDM environment 7
PDM objects
translate to CDM 671
translate to OOM 683
permission
all 634
alter 634
column 641
database 634
define 634
define for user 635
define from object property sheet 638
delete 634
execute 634
functions 634
828 PowerDesigner
permission (continued)
grant 634
grant with grant option 634
index 634
insert 634
object owner 634
procedure 634
references 634
reverse engineer 620
revoke 634
revoke with cascade 634
select 634
table 634
update 634
user 634
view 634
physical data type 533
physical diagram 21
create 50
define 50
physical option
alternate key 562
default 203
define 202, 205
primary key 562
query table 192
storage 206
tablespace 206
PKCOLN 459
PostgreSQL extended attributes 789
PowerBuilder
extended attribute 355, 357
extended model definition 355
generate extended attributes 359
PBCatCol 355
PBCatTbl 355
reverse extended attributes 360
pragma
database package exception 745
database package procedure 740
precision 63, 66
preference
code 57
name 57
reference 143, 145, 147
table 57
prefix tablespace with database 206, 716
preserve
CDM 671
database object 533, 663
preserve (continued)
modification 671, 680
XML model 693
preview
accelerators 32
bookmark 32
change generation options 32
predefined set of options 32
refresh 32
SQL tools 32
storage command 543
table 32
tablespace command 543
trigger 408
primary key 5
column 92, 111
constraint 119
define 111
designate 111
display 57
drop 562
generate 560, 562
generate index 157
index 148, 150, 152, 563
join 130
name 150
physical option 562
rebuild 112, 366
referential integrity 138
variable 119, 458
privilege 629
create in DBMS editor 629
define 629
define for group 629
define for role 629
define for user 629
generate 644, 646
grant 629
reverse engineer 620
revoke 629
with admin option 629
procedure
attach to table 449
begin script 445
check model 306
create 444, 470
create in list 447
create in physical diagram 445
custom 443, 444
database package 301
PDM User's Guide 829
procedure (continued)
define 443, 444
display preference 448
display symbol 447
edit with SQL editor 444
end script 445
example 427
function insert 444
generate 469, 470
insert SQL/XML macro 444
macro insert 444
OOM operation 449
operator insert 444
parameter 470
permission 634, 638
SQL/XML wizard 444
stored 443, 444
symbol 445
template 443
trigger template 427
user-defined 444
variable 801, 804
variable insert 444
procedure (database package) 739, 740
Q
qualifier filter during reverse engineering 370,
374
query
clause 175
columns 175, 176
define 348
display 179
execute 538
performance 240
select synonym 176
select table 176
select view 176
SQL 538
syntax 179
tables 175, 176
query table
add columns to view index 194
create view index 193
define 191
index 192
materialized view 191
physical options 192
query table (continued)
snapshot 191
summary table 191
view index 193
view type 191
quotation mark
generate 201
R
rebuild
bitmap join index 731
cube 343
defaults 75
index 157
IQ index 756, 757
primary key 112, 366
reference 136, 366
rebuild triggers
create trigger automatically 395
delete and rebuild 395
delete trigger 395
insert trigger 395
select trigger template 395
template item 395, 413
trigger referential integrity 399
trigger template 395, 413
update trigger 395
user-defined trigger 395
reference 5
add to bitmap join index 736
add to join index 766
auto-migration 127
bend 145, 146
cardinality 140, 143, 145
change table 135
check model 294
child table 140
CODASYL 147
code 124
column variable 799
conceptual 147
create 129
define 122, 129
delete 136
display 145, 147
display preference 143
drag 145
generate 136
830 PowerDesigner
reference (continued)
join 129, 143
link 129
mode 145
model options 144
modify 145
move to table 146
name 143
notation 144, 147
number 120
number of children 140
permission 634
preference 143, 145, 147
property 123
rebuild 136, 366
relational 147
reuse column 127
select for view 173
straighten 146
text 143
unique code 16, 124
variable 120, 798
view 169
referential integrity 138, 390, 395
cardinality 140
declarative 16, 124, 567
define 141
delete 141
display 143, 144
generate 138, 139, 560, 566, 567
implement by trigger 399
label 143, 144
option 566, 567
property 139
trigger 16, 124, 399, 567
update 141
relational notation 147
relational to multidimensional mapping 332, 348
mapping dimensions 334
mapping facts 337
relational to relational mapping 326, 346
remove column from index 156
replace DBMS from previous version 24
replication (PDM) 261
check model 316
repository in MS SQL Server 777
requirements 11
reserved characters 559
result column
data type 501
result column (continued)
definition 501
is element 501
retrieve
multidimensional objects 341
WarehouseArchitect object 341
reverse engineer 620
Access 97 387
add user to schema list 374
administrator permissions 366
auto-layout 368
block terminator 366
constraint business rule 44
cubes in MS SQL Server 781
database package 748
DB2 370
DESC index column in Oracle 749
for MS Access 97 725
from ODBC data source 366
from ODBC data source into existing PDM
382
from ODBC data source to new PDM 374
from script files 366
from several script files into existing PDM
381
from several script files to new PDM 372
from single script file into existing PDM 380
generate PDM from database 369
into existing PDM 379
into new PDM 372
Java class 88
link Java class 78
merge models 380
optimization 371
options 366, 371
owner filter 370, 374
parent tables 366
permission 620
PowerBuilder extended attributes 360
privilege 620
public names 360
qualifier filter 370, 374
rebuild primary key 366
rebuild reference 366
retrieve number of rows in tables 366
script 620
script files order 366, 373
shortcuts 368
Sybase AS IQ 754
synonym creation 368
PDM User's Guide 831
reverse engineer (continued)
synonyms 655
system login in Oracle 748
table with triggers 369
tablespace physical options in Oracle 748
terminator 366
trigger script files 371
user-defined and abstract data types 369
variable 802
revert
horizontal partitioning 247
table collapsing 259
vertical partitioning 254
revoke 629, 634
privilege 629
with cascade 634
role 621, 624
assign role 625
assign to a group 625
assign to a user 625
check model 281
create 624
create during generation 645
drop 645
generate 644
privilege 629, 645
RULES check parameter 198
S
save as .apm 25
save PDM 25
script
alter 577
begin 552, 556, 557, 560, 564
comment 470, 566, 576
create database 552, 571
create table 552
create trigger 476
customize 552, 556, 557, 560, 564
database create 552, 564
edit 552, 556, 557
end 552, 556, 557, 560, 564
extraction 346
format 470, 566, 576
generate 470, 476, 560, 564, 566, 571, 576,
577
generate test data 610
model 552, 564
script (continued)
modify creation 577, 579, 583
modify database 577
option 470, 566, 576
preview 32
table 556, 560
text color code 32
title 470, 566, 576
variable 552, 556
script files order during reverse engineering 373
script for checking IQ 12.4.3 755
security variables 803
Select mapping 329, 335, 338
select permission 634
sequence 97, 390, 395
create 565
drop 565
generate 565
Interbase 97
property 99
variable 804
serial data type 66, 671
CDM 97
server
business rule (PDM) 39
expression 39, 199
SERVEREXPRESSION 459
share DBMS 20
shortcuts
code uniqueness 279
reverse engineering in PDM 368
size
BLOB 548
database 546
snapshot 191
index 192
SOAP 485
sort
column 109
list 109
source of test data generation 589, 592, 594
special variables in Oracle 727
SQL
display 179
GROUP BY 177
HAVING 178
insert 175
ORDER BY 179
query 179, 538
syntax 179
832 PowerDesigner
SQL (continued)
view expression 176
WHERE 176
SQL editor 176
SQL Server
identity 92
variable 804
SQL tools
editor 30
preview 32
SQL/XML query (in PDM) 708
SQL/XML wizard 462
SQLBase column default 92
SQLJ object abstract data type 82
SQLJ object data type in Oracle 727
SqlListQuery 153
SQLXML macro 460
stereotype DBCreateAfter 180, 472
storage
check model 317
command 543, 545
configure 540
create 565
define 206, 540
drop 565
generate 564, 565
name uniqueness 318
not used 318
preview 543
select 206
stored procedure
extended dependencies 472
generation order 472
symbol 445, 447
straighten reference 146
sub-package hierarchy (PDM) 28
subtype in database package 746
summary table 191
index 192
Sybase AS IQ
add reference to join index 766
create join index 763
define join index 754, 759
extended attribute 754, 772
features 754
generate join index 760
index type 757
join index in table 763
join index properties 759
rebuild IQ indexes 756, 757
Sybase AS IQ (continued)
reverse engineer 754
Sybase AS IQ 12.4.3
check 755
VB script for check 755
Sybase ASA
auto-increment columns 775
extended attribute 775
web services 485
Sybase ASE
extended attribute 774
identity columns 773, 775
Sybase SQL Anywhere data type 671
synchronize
archive PDM 577
creation script file 583
database generation 575
synonym 648
alias 648
base object 648
check 300
code 648
code length 300
code uniqueness 300
create 649, 653
create view 651
define 648
drop 653
existence of base object 300
for DB packages 653
for procedures 653
for sequences 653
for synonyms 653
for tables 653
for views 653
generate 652, 654
name 648
name length 300
name uniqueness 300
owner 648
reverse engineer 368, 655
sort generation 653
type 648
visibility 648
syntax
object compatibility 534
query 179
variable 395, 413, 433, 558, 806
System Administrator 624
system login in ODBC reverse for Oracle 748
PDM User's Guide 833
system privilege 629
system role 624
System Security Officer 624
T
table 5
alias assign 174
alternate key 55, 117
attach procedure 449
backup 576
based on 53
bitmap join index 734
check model 283
check parameter 560
child 120
column 55, 57
comment 560
constraint 56
constraint business rule 46
create 53, 552, 560
create mapping 329
create trigger 401
data profile 604, 606
define 51
delete index 160
display preference 57
drop 560
drop temporary 576
estimate database size 546
foreign key 113, 114
generate 560
ignore or enforce ownership 13
index 55, 57, 150
indicate record 547
join index 763
list 53, 55
mapping 327, 328
message 480
modify 55
modify trigger 403
multidimensional type 341
notation 60
parent 120
permission 634, 638
physical option 560, 563
preference 57
preview code 32
primary key 111
table (continued)
property 51, 55
reverse engineer table triggers 369
script 556, 560
symbol 53
text 57
validation rule 560
variable 119, 120, 795
view 169, 183
table collapsing 256
cancel 259
check model 275
collapsed tables 258
delete 259
eliminate joins 256
generate PDM 259
input tables 257
object 257, 258
references 257
revert 259
source tables 258
target table 257
wizard 257
tablespace
begin script 557
check model 318
command 543, 545
configure 540
create 565
database prefix in DB2 OS/390 206, 716
define 206, 540
drop 565
enabledbprefix 716
end script 557
generate 564, 565
name uniqueness 318
not used 319
preview 543
reverse physical options in Oracle 748
select 206
target model 658
template item 428
add to trigger 405, 422
add to trigger template 413
create 433
create from existing template item 433, 437
create new 436, 438
declare in trigger 441
define 391, 428
function 443
834 PowerDesigner
template item (continued)
identify 430
insert in trigger 429
insert in trigger template 429
modify 439
modify DBMS 440
procedure 443
property 432
rebuild triggers 413
trigger add 405, 422
variable 432
terminator 366
test data 586
assign data profile 603
automatic generation 589, 592, 594
automatic generation parameter 589
column fill parameter 601
data source 588
default profiles 610, 614
distinct values 94
export data profile 607
generate 586, 608
generate from file 599
generate from list 596
generate from ODBC 597
generate option 608
generate option for a script 610
generate option for ODBC 614
generation parameter 588, 608
import data profile 607
number of rows 608
restriction 587
triggers 608
use 586
test data profile
assign 586
class 587
create 587
default 587
define 586
name 587
text
reference 143
table 57
view 183
time
data profile 589
data type 673
TIME 757
time data type 67
title script 470, 566, 576
transformation
cancel horizontal partitioning 244
cancel table collapsing 259
cancel vertical partitioning 251
column denormalization 261
horizontal partitioning 241
table collapsing 256
vertical partitioning 248
translate
data type 533, 671
PDM to OOM 684
trigger
access property 403
add template item 405, 422
check model 294
create 390, 470, 476, 478
create automatically 390, 395
create manually 390, 401
create overview 391
declare template item 441
define 390
edit 403
edit with SQL editor 404
event 394
function insert 403, 404, 422, 439
generate 469, 470, 476, 478, 567
insert SQL/XML macro 404
insert template item 429
instead of 164
macro 451
macro insert 403, 404, 422, 439
modify 403
modify from table 403
multiple 406
multiple events 394
name convention 426
operator insert 403, 404, 422, 439
order 406
overview 390
parameter 470
preview 408
property 393
rebuild See rebuild triggers
rebuild automatically 13
referential integrity 390, 395, 567
reverse engineer script files 371
reverse engineer table with triggers 369
same type 406
script 476
PDM User's Guide 835
trigger (continued)
sequence 390, 395
SQL/XML wizard 404
template See trigger template
template item See template item
template item add 405, 422
test data 608
time 394
user-defined 401
variable 801
variable insert 403, 404, 422, 439
view 164
trigger template 409
add template item 413
available to other models 391
copy 415, 419
create 414, 419, 420
create DBMS 415, 418
create from duplicate 415, 419
create from scratch 418
create user-defined 419, 420
DBMS 409, 414
declare template item 441
define 391, 419
delete 411
duplicate 415, 419
example 427
identify 410
insert 410, 427
insert template item 429
macro 451
model 410
modify 421
modify DBMS 424
modify model 425, 441
name 414, 426
procedure 427
property 412
rebuild triggers 413
template item 412
type 410
update 411
user-defined 410
variable 395, 413, 432
type
business rule 37
database package 302
type (database package)
definition 746
public 746
type (database package) (continued)
subtype 746
typographic conventions xvii
U
undefined data type 64, 65, 68, 103
undefined web operation 321
unique
constraint 117
index 117, 148, 150
reference 16
UniqueConstName 46
update
CDM 678
constraint 141, 431
OOM 690
PDM 667
permission 634
trigger template 411
user 621
add to group 628
assign role 625
attach object 623
check model 279
create 622
create during generation 644
define 621
drop 644
generate 644
permission 635
privilege 629, 644
role 624
vs owner 621
user-defined
error message 479
generate 481
index 150
trigger template 410
V
validation
business rule (PDM) 38
PDM 266
validation rule 195
apply 199
auto-migrate 114
836 PowerDesigner
validation rule (continued)
business rule 199
check parameter 199
column 199, 560
define 200
domain 199
generate 199, 560, 565
table 560
variable
abstract data type 797
abstract data type attribute 797
Adaptive Server Anywhere 804
all named objects 794
all objects 794
business rule (PDM) 797
check 305
code 794
code uniqueness 305
column 199, 454, 796
column check parameter 795
common 794
constraint name 119, 120
data type 305
database 801
database options 804
database package 302
database synchronization 803
domain 199
domain (PDM) 797
domain check parameter 795
foreign key 458
format 395, 413, 433, 558, 806
generated code 794
index 798
index column 798
join index 805
justify 395, 413, 433, 558, 806
key 800
list 395, 413, 432, 794
macro 395, 413, 432
metadata 803
name uniqueness 305
primary key 458
procedure 804
reference 120, 798
reference column 799
reverse engineer 802
script 552, 556
security 803
sequence 804
variable (continued)
SQL Server 804
syntax 395, 413, 433, 558, 806
table 119, 120, 795
template item 395, 413, 432
trigger 801
trigger template 395, 413, 432
view 800
variable (database package) 742
constant 742
data type 742
default value 742
in database package 742
length 742
precision 742
public 742
VB script for checking IQ 12.4.3 755
verify
objects in PDM 274
PDM 274
version 6 migration 680
vertical partitioning 248
cancel 251
check model 276
column selection 248
delete 251
generate PDM 252
object 250, 252
partition definition 248
partitioned table 248
partitions 250
revert 254
wizard 248
view 5
add column 162
check model 297
column 162, 163, 183
comment 561
create 164, 166, 560, 561
create from synonym 651
data type 183
define 161
define query 169
display columns 162
display preference 183
drop 561
extended dependencies 168, 180
formula 183
generate 560, 561
generation order 180
PDM User's Guide 837
view (continued)
GROUP BY 177
HAVING 178
ignore or enforce ownership 13
materialized query table 191
modify 168
modify column properties 163
multidimensional type 341
ORDER BY 179
permission 634, 638
property 161, 168
reference 169
relations between tables 171
remove column 162
rename columns 162
select reference 173
select table 165
select view 165
snapshot 191
summary table 191
table 169, 183
text 183
trigger 164
type 191
variable 800
WHERE 176
view index
add columns 194
bitmap 193
check model 291
create 193
properties 193
view reference
bend 190
change table 189
change view 189
check model 296
CODASYL 189
conceptual 189
create 185
define 184, 185
display 190
display join 189
display name 189
display preference 189
drag 190
IDEF1X 189
join 185, 186
link 185
mode 190
view reference (continued)
modify 190
notation 189
property 184
relational 189
W
WarehouseArchitect object
retrieve 341
warning
message display 271
PDM 266, 268, 271, 272
web operation 5
check 320
code maximum length 321
code uniqueness 320
create web operation 497
definition 492
implementation (SQL statement) 495
list of web operations 492
name uniqueness 320
operation type 493
parameters list 494
result columns list 496
security properties 497
types 487
undefined type 321
web parameter
data type 500
definition 500
is element 500
parameter type 500
web service 5
check 320
code maximum length 320
code uniqueness 320
create web service 490
DADX extended model definition 512
DADX files 486
general definition 484
generate web services for IBM DB2 512
generate web services for Sybase ASA 9 502
in PowerDesigner 484
list of web services 487
local path 486, 488, 486, 488
name uniqueness 320
namespaces list 490
operations list 489
838 PowerDesigner
web service (continued)
prefix name 485
reverse engineer web services from Sybase ASA
9 516
security properties 489
service type 488
types 485
WHERE in query 176
with default (column properties) 92
WSDL 485
X
XML Builder Wizard 701
build XML hierarchy 704
define XML model 702
select tables and views 703
XML model
generate 693, 695
generation options 694, 695
modify 693
objects translated from PDM 693
preserve 693
update 693
XPF import 607

You might also like