Les - 08-MapAdv1 (Ban Quyen)
Les - 08-MapAdv1 (Ban Quyen)
Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Objectives
8-2 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Agenda
8-3 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Business Rules in Mappings
8-4 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Business Rule Elements
Source Attribute Drag an attribute or use the Expression Editor. It is prefixed with the
datastore alias.
DBMS Function Use the Expression Editor for the list of allowed functions and
operators.
8-5 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
More Elements
User functions They are used in the same way as DBMS functions, but replaced at
code generation by their implementation.
8-6 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Expression Editor
Toolbar Technology
Cut, Copy, Paste, Undo, Redo. Indicates the Determines tools available
language in use and the relevant technology and proper syntax
Code
Source Implementation of
Datastores the business rule
Attributes are
automatically
prefixed with
table aliases.
Variables
Project and global
Sequences
Project and global
(if present)
User functions
Project and global
(if present)
8-7 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Agenda
8-9 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Using a Variable in Code
8 - 10 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Binding Versus Substitution
• Substitution:
– Is correct in most cases
– The variable is replaced by its value before execution.
— Use single straight quotation marks for nonnumeric values.
8 - 12 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Case Sensitivity
8 - 13 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Agenda
8 - 14 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Defining a Dataset
1
2
8 - 15 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Using Set-Based Operators
8 - 16 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Example of SET: UNION
8 - 17 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Agenda
8 - 18 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Types of Sequences
• Native sequences
• Standard sequences
• Specific sequences
8 - 19 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Support for Native Sequences
8 - 20 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Creating a Native Sequence
8 - 21 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Referring to Sequences
• Standard sequences:
– In code, the sequence name is followed by _NEXTVAL.
— This increments the sequence and then retrieves
the new value.
– You do not need to specify the scope.
– Substitution versus binding:
— Substitution: #<sequence_name>_NEXTVAL
— Binding: :<sequence_name>_NEXTVAL
• Native sequences:
– <sequence_name>.NEXTVAL
8 - 22 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Sequences: Best Practices
8 - 27 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Automatic Temporary Index Management
8 - 28 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Tracking Variables and Sequences
Variable
Show/Hide
values button
Actual value of variable
8 - 29 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
How Variable and Sequence Tracking Works
8 - 30 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Variable Actions
8 - 31 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Definition Tab of Session Step or Session Task
8 - 32 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Practice 08-1: Using Native Sequences with ODI
Mapping
1. In ODI, create the procedure
Create_ORCL_SEQ_FAM_ID and execute it to create the
sequence SEQ_FAMILY_ID in the RDBMS.
2. In ODI, create the native sequence SEQ_FAMILY_ID.
3. Create and execute the mapping Map_11-1 to load the
TRG_PROD_FAMILY target table by using the native
sequence to generate ID numbers for that table.
Source Map_11-1 Mapping Target
Model Model
Oracle
LKM SQL to Oracle Sales
MySQL_SRC
Application
Use sequence to
generate index on
FAMILY_ID attribute.
SRC_PRODUCT TRG_PROD_FAMILY
FAMILY_ID attribute
:SEQ_FAMILY_ID_NEXTVAL
8 - 36 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Practice 08-2: Using Temporary Indexes
8 - 37 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.
Practice 08-3: Using Sets with ODI Mapping
8 - 38 Copyright © 2021, Insight Data and/or its affiliates. All rights reserved.