Transformation Language Reference

Informatica PowerCenter®
(Version 7.1.1)

Informatica PowerCenter Transformation Language Reference Version 7.1.1 August 2004 Copyright (c) 1998–2004 Informatica Corporation. All rights reserved. Printed in the USA. This software and documentation contain proprietary information of Informatica Corporation, they are provided under a license agreement containing restrictions on use and disclosure and is also protected by copyright law. Reverse engineering of the software is prohibited. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or otherwise) without prior consent of Informatica Corporation. Use, duplication, or disclosure of the Software by the U.S. Government is subject to the restrictions set forth in the applicable software license agreement as provided in DFARS 227.7202-1(a) and 227.7702-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable. The information in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Informatica Corporation does not warrant that this documentation is error free. Informatica, PowerMart, PowerCenter, PowerChannel, PowerCenter Connect, MX, and SuperGlue are trademarks or registered trademarks of Informatica Corporation in the United States and in jurisdictions throughout the world. All other company and product names may be trade names or trademarks of their respective owners. Portions of this software are copyrighted by DataDirect Technologies, 1999-2002. Informatica PowerCenter products contain ACE (TM) software copyrighted by Douglas C. Schmidt and his research group at Washington University and University of California, Irvine, Copyright (c) 1993-2002, all rights reserved. Portions of this software contain copyrighted material from The JBoss Group, LLC. Your right to use such materials is set forth in the GNU Lesser General Public License Agreement, which may be found at http://www.opensource.org/licenses/lgpl-license.php. The JBoss materials are provided free of charge by Informatica, “as-is”, without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Portions of this software contain copyrighted material from Meta Integration Technology, Inc. Meta Integration® is a registered trademark of Meta Integration Technology, Inc. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). The Apache Software is Copyright (c) 1999-2004 The Apache Software Foundation. All rights reserved. DISCLAIMER: Informatica Corporation provides this documentation “as is” without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of non-infringement, merchantability, or use for a particular purpose. The information provided in this documentation may include technical inaccuracies or typographical errors. Informatica could make improvements and/or changes in the products described in this documentation at any time without notice.

Table of Contents
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
New Features and Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii PowerCenter 7.1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii PowerCenter 7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv PowerCenter 7.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xviii About Informatica Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv About this Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv Other Informatica Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Visiting Informatica Customer Portal . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Visiting the Informatica Webzine . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Visiting the Informatica Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Visiting the Informatica Developer Network . . . . . . . . . . . . . . . . . . . . xxvi Obtaining Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

Chapter 1: The Transformation Language . . . . . . . . . . . . . . . . . . . . . . 1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Transformation Language Components . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Transformation Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Internationalization and the Transformation Language . . . . . . . . . . . . . . 3 Expression Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Expression Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 General Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Adding Comments to Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Reserved Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Chapter 2: Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
DD_DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 DD_INSERT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 DD_REJECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
iii

Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 DD_UPDATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 FALSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Working with Null Values in Boolean Expressions . . . . . . . . . . . . . . . . . 17 Working with Null Values in Comparison Expressions . . . . . . . . . . . . . . 17 Null Values in Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Null Values in Filter Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Nulls with Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 TRUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 3: Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 String Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Nulls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Nulls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Chapter 4: Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
System Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 $$$SessStartTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 SESSSTARTTIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 SYSDATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 WORKFLOWSTARTTIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Transaction Control Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 TC_CONTINUE_TRANSACTION . . . . . . . . . . . . . . . . . . . . . . . . . . 31 TC_COMMIT_BEFORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 TC_COMMIT_AFTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 TC_ROLLBACK_BEFORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

iv

Table of Contents

Chapter 5: Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Date/Time Datatype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Julian Day, Modified Julian Day, and the Gregorian Calendar . . . . . . . . 34 Dates in the Year 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Dates in Relational Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Dates in Flat Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Default Date Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Date Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 TO_CHAR Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 TO_DATE and IS_DATE Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Understanding Date Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Chapter 6: Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Function Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Aggregate Functions and Nulls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Character Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Data Cleansing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Date Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Numeric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Scientific Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Special Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Test Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Variable Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 ABORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 ABS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 ADD_TO_DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 ASCII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 AVG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 CEIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 CHR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 CHRCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Table of Contents

v

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 LPAD . . . . . . . . . . . . . . . . . . . . . . . . . . 81 DATE_DIFF . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 METAPHONE . 88 EXP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 COS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 DATE_COMPARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 MEDIAN . . . 104 IS_NUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 DECODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 INITCAP . . . . . . 107 IS_SPACES . . . . . . . . . . . . . . . . . . . . . . . 99 INSTR . . . . . . . . . . . . . . . . . . . . 100 ISNULL . . . . . . . . . . . . . . . . 121 LTRIM . . . . . . . . 115 LN . . . . . . . . . . . . 93 GET_DATE_PART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 FLOOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 MAX (Dates) . . . . . . . . . . . 130 MIN (Dates) . . . . . . . . . . . . . . . . . . . . . . . . . . 135 MOD . 94 IIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 LENGTH . . . . . . . . . . . . . . 74 COSH . . . . . . . . . . . . . 125 MAX (Numbers) . 90 FIRST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .CONCAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 MOVINGAVG . . . . . . . . . . . . . . . . . . . . . . . . . . 109 LAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 vi Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 MOVINGSUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 LOWER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 CUME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 LOOKUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 LOG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 MIN (Numbers) . . . . . . . . . . . 75 COUNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 IS_DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 LAST_DAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 TO_INTEGER . . . . . . . . . . 202 TO_FLOAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Aggregate Functions . . 196 TO_DATE . . . . . . . 146 REPLACECHR . . . . . . . . . . . . . . . . . . . 180 SQRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 STDDEV . . . . . . . . . . . . . . . . 217 Table of Contents vii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 VARIANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 SOUNDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 RTRIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 TO_CHAR (Numbers) . . . . . . . . . . . . . . 157 RPAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 SUBSTR . . . . . . . . . . . . . . . . . . . 178 SINH . . . . . 216 Character Functions . . . . . . . . . . . . 198 TO_DECIMAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 ROUND (Dates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 TAN . . . . . . . . . . . . . . . . . . . . . . . 166 SETMAXVARIABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 TRUNC (Dates) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 POWER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 TO_CHAR (Dates) . 209 UPPER . . . . . . . . . . . 212 Appendix A: Function Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 SIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 SUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 SET_DATE_PART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 SETMINVARIABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 ROUND (Numbers) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 SETCOUNTVARIABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 TRUNC (Numbers) . . . . . . . . . . . . . . . . . . . . 190 TANH . . . . . . . . . . . . . . . . . . . . . . . . . 172 SETVARIABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 REPLACESTR . . . . . . . . . . . . . 175 SIGN . . . . . .PERCENTILE . . . .

. . . . . . . . . . . . . . . . . . . . 219 Data Cleansing Functions . . . . . . . . . 220 Date Functions . . . . . . . . . . . . . . . . . . . . . . . . 229 viii Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Scientific Functions . . . 225 Special Functions . . . . . . . . . . . . . . . . . . . . . . . 222 Numeric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Test Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . 227 Variable Functions . . . . . . . . . . . . . . . . . . . . .

.. .. . . .. . . . . .. . . . . . . . . . . . . . . . Datatype Expansion for $$$SessStartTime .. . . . . . . 5-2. .. . . . . METAPHONE Encoding Guidelines . . . . . . . . . . . . . .... . . .... . . . . Differences Between RR and YY Format Strings. . . 36 . . . . . Logical Operators in the Transformation Reference . . ... . . . . . . 18 . .. . .. . .. . . 3-3. 4-1. . . . . . . . .. . . . . . . . .. ... . . . . . . .. Operators in the Transformation Language . . . . .. . . 36 .. . .. ... . . . 26 ... . . . . . . ... . . . . . .. . . . . . . .. . . . . . . . Reference Qualifiers in Transformation Language . . ... . . . . . Date Format Strings in the Transformation Reference . . . RR Format String Conversions . . . . . . .. .. . . . 5-5. 25 . . . .. Arithmetic Operators in the Transformation Language . . 5-4. . . . . .. . . . 39 . . . . . . . . .. . . . . .. 6-2. . . 39 . . .... .. . . . . . .. .. . . .. . ... Comparison Operators in the Transformation Language . . .. . .. .. . . . . 3-2. .. . . .. . . . SOUNDEX Encoding Guidelines for Consonants ... .. 6 . .. . . . . . 5-1. . TO_DATE and IS_DATE Format Strings . . Date Functions that Use Date Format Strings . . . . . . . . . . 23 . . . . . . . TO_CHAR Format Strings. . . . . 3-4.. . . . . . Evaluating Null Values in Comparison Expressions . . . 28 . . . . 2-1.. ... . .. .. . .. . 3-1. .... . . . . . . 22 . . . 40 . . .. . . . . . 5-6. . . . 43 130 180 List of Tables ix . . . . . . . . .. . . .. . .. . .. .. ..List of Tables Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table 1-1. . . . . . . . . . . . . . . . . . 6-1. . 5-3. . . . . .

x List of Tables .

and managing data. and support high-speed loads. data synchronization. usable. handle complex transformations on the data. The PowerCenter Server can extract large volumes of data from multiple platforms. transforming. xi . including extracting. scalable data integration solution addressing the complete life cycle for all data integration projects including data warehouses and data marts. and efficient manner. loading. The PowerCenter metadata repository coordinates and drives a variety of core functions.Preface Welcome to PowerCenter. data migration. PowerCenter combines the latest technology enhancements for reliably managing data repositories and delivering information resources in a timely. PowerCenter can simplify and accelerate the process of moving data warehouses from development to test to production. Informatica’s software product that delivers an open. and information hubs.

pmcmd. session. Row Uniqueness function. When you use a local parameter file. such as JIPSEkana. the rows that meet the business rule. JEF-kana. The Designer displays profile mappings under a profile mappings node in the Navigator. Flat file partitioning.1. You can determine unique rows for a source based on a selection of columns for the specified source. Session enhancement. Profile mapping display in the Designer. and MELCOM-kana.1. and workflows generated when you create a data profile. and workflow prefixes. The PowerCenter Server can write all rows. ♦ ♦ ♦ ♦ ♦ ♦ PowerCenter Server ♦ ♦ ♦ Code page. or you may want to widen the scope of patterns returned to view exception data. you can configure the session to create multiple threads to read the flat file source. sessions. PowerCenter 7. Data Profiling ♦ Data sampling. a specified percentage of data. You can view a profile from a random sample of data. xii Preface . Define mapping. and workflow prefixes for the mappings. You can use parameter files that reside on a local machine with the Startworkflow command in the pmcmd program. pmcmd passes variables and values in the file to the PowerCenter Server.1.New Features and Enhancements This section describes new features and enhancements to PowerCenter 7. You may want to narrow the scope of patterns returned to view only the primary domains.1.0. PowerCenter supports additional Japanese language code pages. You can create a data profile for a sample of source data instead of the entire source. and 7. You can configure a maximum number of patterns and a minimum pattern frequency.1. or the rows that do not meet the business rule. 7. When you create multiple partitions for a flat file source session. session.1. You can configure the Data Profiling Wizard to filter the Domain Inference function results. Verbose data enhancements. You can save sessions that you create from the Profile Manager to the repository. You can specify the type of verbose data you want the PowerCenter Server to write to the Data Profiling warehouse. You can define default mapping.1 This section describes new features and enhancements to PowerCenter 7. Domain Inference function tuning. or for a specified number of rows starting with the first row.

the PowerCenter Client creates a file format recognized by the target tool. You do not need to know a database user name and password. When the PowerCenter Server initializes a session. On SuSE Linux. containing reserved words. The PowerCenter Server runs on SuSE Linux. When you load to Teradata using an external loader. it searches for reswords. and work table names by specifying different tables on the same or different Teradata database. You can use pmrep to perform the following functions: − − − Remove repositories from the Repository Server cache entry list. You can attach document types such as XML. Depending on the loader you use. ♦ SuSE Linux support. You can export or import multiple objects at a time. such as Business Objects Designer. the PowerCenter Server places quotes around matching reserved words when it executes SQL against the database. DB2. Oracle. reswords. you can also override the error. You can exchange source and target metadata with other BI or data modeling tools. The Repository Server runs on SuSE Linux. or lookup table name or column name contains a database reserved word. Oracle OS Authentication allows you to log on to an Oracle database if you have a logon to the operating system. you can pass attachments through the requests or responses in a service session. On SuSE Linux. When you import web service definitions with attachment groups. and Sybase sources. When you export metadata. Enable enhanced security when you create a relational source or target connection in the repository. PowerCenter uses Oracle OS Authentication when the user name for an Oracle connection is PmNullUser.txt in the PowerCenter Server installation directory. Teradata external loader. JPEG. The document type you can attach is based on the mime content of the WSDL file. targets. ♦ ♦ Repository ♦ Exchange metadata with other tools.♦ SuSE Linux support. log. Repository Server ♦ pmrep. Reserved word support. you can connect to IBM. Use ODBC drivers to access other sources and targets. and Sybase repositories. DB2. If any source. GIF. If the file exists. You can now use Oracle OS Authentication to authenticate database users. Preface xiii . Security ♦ Oracle OS Authentication. target. you can create and maintain a file. and repositories using native drivers. you can now override the control file. or PDF. Update a connection attribute value when you update the connection.txt. Oracle. Web Services Provider ♦ Attachment support. you can connect to IBM.

Creating auto profile enhancements. Purging data from the Data Profiling warehouse. You can now view data profiles by source definition in the Profile Manager. The PowerCenter Server creates a connection to the Web Services Hub based on the number of sources.0 Web Services Hub Guide. This is a new book that describes the functionality of Real-time Web Services. You can also pivot the view row. You can now pivot more than one multiple-occurring element in an XML view. XML ♦ Multi-level pivoting. and Transformation Guide.1 This section describes new features and enhancements to PowerCenter 7. You can now create a data profile for VSAM sources. You can now view PowerCenter Data Profiling reports in a separate browser window. It also includes information from the version 7. connectivity. Licensing Informatica provides licenses for each CPU and each repository rather than for each installation. Aggregator function in auto profiles. Source View in the Profile Manager. You can now purge data from the Data Profiling warehouse. Informatica provides licenses for product. PowerCenter Data Profiling report enhancements. You can create multiple partitions in a session containing web service source and target definitions. Support for verbose mode for source-level functions. PowerCenter 7. Prepackaged domains. This book consolidates XML information previously documented in the Designer Guide. and options. Data Profiling ♦ ♦ Data Profiling for VSAM sources. You can now select the columns or groups you want to include in an auto profile and enable verbose mode for the Distinct Value Count function.♦ Pipeline partitioning. Auto profiles now include the Aggregator function. ♦ ♦ ♦ ♦ ♦ ♦ Documentation ♦ ♦ Web Services Provider Guide. resize columns in a report. You can now create data profiles with source-level functions and write data to the Data Profiling warehouse in verbose mode. Workflow Administration Guide. Informatica provides a set of prepackaged domains that you can include in a Domain Validation function in a data profile. XML User Guide. and view verbose data for Distinct Value Count functions. You store xiv Preface .1. targets. and partitions in the session.

PowerCenter now identifies and updates statistics for all repository tables and indexes when you copy. and run multiple pmrep commands sequentially. delete repository details. and delete a folder. If you have the Partitioning option. This improves processing performance for most sessions. PowerCenter Metadata Reporter PowerCenter Metadata Reporter modified some report names and uses the PowerCenter 7. and deploy group history. and the command line program. back up. This improves performance when PowerCenter accesses the repository. The PowerCenter Server now reads a block of rows at a time.1 MX views in its schema. CLOB/BLOB datatype support. such as Cognos Report Net and Business Objects. PowerCenter Server ♦ ♦ ♦ ♦ 64-bit support. You can manage the license files using the Repository Server Administration Console. You can use pmrep to back up. PowerCenter Server processing enhancements. the PowerCenter Server Setup. workflow and session log history. Increased repository performance. pmlic. truncate log files. You can increase repository performance by skipping information when you copy. Repository Server ♦ Updating repository statistics. You can also use pmrep to create. or restore a repository. You can now read and write CLOB/BLOB datatypes. disable. or enable a repository. You can now run 64-bit PowerCenter Servers on AIX and HP-UX (Itanium). modify. You can choose to skip MX data.the license keys in a license key file. Partitioning enhancements. REP_SERVER_NET and REP_SERVER_NET_REF views allow you to see information about server grids. upgrade. delete a relational connection from a repository. ♦ ♦ Repository ♦ Exchange metadata with business intelligence tools. Object import and export enhancements. ♦ ♦ Preface xv . you can define up to 64 partitions at any partition point in a pipeline that supports multiple partitions. MX views. pmrep. You can export metadata to and import metadata from other business intelligence tools. REP_VERSION_PROPS allows you to see the version history of all objects in a PowerCenter repository. and restore repositories. MX views have been added to help you analyze metadata stored in the repository. You can compare objects in an XML file to objects in the target repository when you import objects.

Version Control You can run object queries that return shortcut objects. You can use the Union transformation to merge multiple sources into a single pipeline. the Designer invokes the Flat File Wizard. You might want to output old values from lookup/output ports when you use the Lookup transformation in a mapping that updates slowly changing dimension tables. ♦ xvi Preface . The Custom transformation API includes new array-based functions that allow you to create procedure code that receives and outputs a block of rows at a time. When you create a Lookup transformation using a flat file as a lookup source. Real-time Web Services allows you to create services using the Workflow Manager and make them available to web service clients through the Web Services Hub. You can also run object queries based on the latest status of an object. The query can return local objects that are checked out. You can also extract data from messaging systems. Use these functions to take advantage of the PowerCenter Server processing enhancements. the PowerCenter Server can ignore some ports when it compares values in lookup and input ports before it updates a row in the cache. Web Services Hub. Custom transformation API enhancements. You can also use a lookup file parameter if you want to change the name or location of a lookup between session runs. Also. You can now perform lookups on flat files. you can choose whether the PowerCenter Server outputs old or new values from the lookup/output ports when it updates a row. The Web Services Hub now hosts Real-time Web Services in addition to Metadata Web Services and Batch Web Services. or a collection of all older versions of objects. such as data stored in a CLOB column. such as TIBCO or IBM MQSeries. Midstream XML transformations. You can now create an XML Parser transformation or an XML Generator transformation to parse or generate XML inside a pipeline. The quality of printed workspace has improved. Web Services Provider ♦ Real-time Web Services. When you use a dynamic lookup cache. Union transformation. ♦ ♦ ♦ ♦ Usability ♦ ♦ Viewing active folders. The Union transformation is similar to using the UNION ALL SQL statement to combine the results from two or more SQL statements. The XML transformations enable you to extract XML data stored in relational tables. Dynamic lookup cache enhancements. Enhanced printing. the latest version of checked in objects. The Designer and the Workflow Manager highlight the active folder in the Navigator.Transformations ♦ Flat file lookup. The PowerCenter Server can perform parallel processing of both requestresponse and one-way services. You can install the Web Services Hub on a JBoss application server.

Note: PowerCenter Connect for Web Services allows you to create sources. or schema files. targets. ♦ ♦ ♦ Preface xvii . the Designer expands each element and reference under its parent element. It displays folders alphabetically. The Workflow Monitor displays workflow runs in Task view chronologically with the most recent run at the top. You can remove the Navigator and Output window. When you create views with entity relationships. In a view with hierarchy relationships. You can use XML schemas that contain simple and complex datatypes. The Workflow Monitor includes improved options for filtering tasks by start and end time. You can synchronize one or more XML definition when the underlying schema changes. For more informations. When you import XML definitions. XML workspace. add or delete columns from views. and transformations to call web services hosted by other providers. Additional options for XML definitions. You can edit XML views and relationships between views in the workspace. You can also extract data from messaging systems. You can simultaneously monitor multiple PowerCenter Servers registered to the same repository. Midstream XML transformations. Synchronizing XML definitions. You can synchronize an XML definition with any repository definition or file used to create the XML definition. such as TIBCO or IBM MQSeries. and define relationships between views. DTD files. the Designer creates separate entities for references and multiple-occurring elements. XML Support PowerCenter XML support now includes the following features: ♦ ♦ Enhanced datatype support. You can create views. you can choose how you want the Designer to represent the metadata associated with the imported files. see PowerCenter Connect for Web Services User and Administrator Guide. you no longer distinguish between online or offline mode. You can open multiple instances of the Workflow Monitor on one machine. such as data stored in a CLOB column. XML files. You can now create an XML Parser transformation or an XML Generator transformation to parse or generate XML inside a pipeline. Workflow Monitor The Workflow Monitor includes the following performance and usability enhancements: ♦ ♦ ♦ ♦ ♦ ♦ When you connect to the PowerCenter Server. You can choose to generate XML views using hierarchy or entity relationships. The XML transformations enable you to extract XML data stored in relational tables. including relational sources or targets.

− − PowerCenter 7. the XML data spills to disk in order to free up memory. You can specify the size of the cache used to store the XML tree. you can determine implicit data type. For example. User-defined commits. Circular references occur when an element is a direct or indirect child of itself. detect data patterns.” This chapter describes changes to repository ♦ xviii Preface . you can create profiling mappings and run sessions. Documentation ♦ ♦ Glossary. you can profile source data to evaluate source data and detect patterns and exceptions. The connectivity information in the Installation and Configuration Guide is consolidated into two chapters. If the size of the tree exceeds the cache size. Data Integration Web Services You can use Data Integration Web Services to write applications to communicate with the PowerCenter Server. You can create XML files of several gigabytes in a PowerCenter 7. PowerCenter now supports XML files. Then you can view reports based on the profile data in the profiling warehouse. DTD files. Load Manager and Metadata Exchange Web Services running on the Web Services Hub. You can output XML data to multiple XML targets. It is comprised of two services for communication with the PowerCenter Server. suggest candidate keys. Support for multiple XML output files. Data Profiling If you have the Data Profiling option.0. The PowerCenter Client provides a Profile Manager and a Profile Wizard to complete these tasks. Increased performance for large XML targets.” Upgrading metadata. and evaluate join criteria. You can also define the file names for XML output files in the mapping. The Installation and Configuration Guide contains a glossary of new PowerCenter terms. Data Integration Web Services is a web-enabled version of the PowerCenter Server functionality available through Load Manager and Metadata Exchange. You can define commits to trigger flushes for XML target files. This book now contains chapters titled “Connecting to Databases from Windows” and “Connecting to Databases from UNIX. Installation and Configuration Guide.♦ Support for circular references. The Installation and Configuration Guide now contains a chapter titled “Upgrading Repository Metadata. After you create a profiling warehouse. and XML schemas that use circular definitions.1 XML session by using the following enhancements: − ♦ Spill to disk.0 This section describes new features and enhancements to PowerCenter 7.

When using external loaders on Windows. You can choose to log row errors in a central location to help understand the cause and source of errors. PowerCenter Servers balance the workload among all the servers in the grid. The change in functionality for existing objects depends on the version of the existing objects. METAPHONE encodes characters of the English language alphabet (A-Z). Metadata analysis. session completion status. Distributed processing. Metaphone. You can specify the length of the string that you want to encode. SOUNDEX works for characters in the English alphabet (A-Z). It uses the first character of the input string as the first character in the return value and encodes the remaining three unique consonants as numbers. mappings. ♦ Installation ♦ Remote PowerCenter Client installation.0 metadata. and transformations. The Metaphone function encodes string values. The Soundex function encodes a string value into a four-character string. The session configuration object has new properties that allow you to define error logging. and distribute it to other users to install the PowerCenter Client. You can enable bulk loading when you load to IBM DB2 8. You can use PowerCenter Metadata Reporter to analyze operational metadata. You can use PowerCenter Metadata Reporter to browse PowerCenter 7. you can now choose to load from a named pipe. It encodes both uppercase and lowercase letters in uppercase. worklets. PowerCenter Metadata Reporter PowerCenter Metadata Reporter replaces Runtime Metadata Reporter and Informatica Metadata Reporter. such as workflows. Functions ♦ Soundex. When using external loaders on UNIX. session errors.1. External loading enhancements. you can group PowerCenter Servers registered to the same repository into a server grid. ♦ PowerCenter Server ♦ ♦ DB2 bulk loading. You can create a control file containing installation information. server load. If you purchase the Server Grid option. and warehouse growth.objects impacted by the upgrade process. you can now choose to load from staged files. Consult the upgrade information in this chapter for each upgraded object to determine whether the upgrade applies to your current version of PowerCenter. Preface xix ♦ ♦ . Row error logging. PowerCenter Metadata Reporter includes the following features: ♦ Metadata browsing. In a server grid. You access the Informatica installation CD from the command line to create the control file and install the product. source and target tables. including session load time.

deploying. Additionally. You can now use default repository user authentication or Lightweight Directory Access Protocol (LDAP) to authenticate users. This enables more efficient joins with minimal usage of memory and disk cache. and change object status. the repository maintains an association between your repository user name and your external login name. Real time processing enhancements. or delete data. The Use Repository Manager privilege allows you to perform tasks in the Repository Manager. upsert. It writes a column in the target file or named pipe to indicate the update strategy. You can perform the same tasks in the Designer and Workflow Manager if you have the Use Designer and Use Workflow Manager privileges. You can now use real-time processing in sessions that also process active transformations. You can export and import multiple objects and objects types. You can now enable or disable users from accessing the repository by changing the status. You can now use a Microsoft SQL Server trusted connection to connect to the repository. ♦ ♦ Security ♦ LDAP user authentication. exporting. The ♦ ♦ xx Preface . When you log in to the repository. The repository maintains a status for each user. groups. The Repository Agent logs security changes to a log file stored in the Repository Server installation directory. Mixed mode processing for Teradata external loaders. The PowerCenter Server now reads data concurrently from sources within a target load order group. You can now use data driven load mode with Teradata external loaders. You can use pmrep to perform change management tasks. You can export and import objects with or without their dependent objects. Teradata Warehouse Builder can simultaneously read from multiple sources and load data into one or more tables. ♦ ♦ ♦ Repository Server ♦ Object export and import enhancements. such as the Aggregator transformation. privileges. or update. delete. the security module passes your login name to the external directory for authentication. You can also export objects from a query result or objects history. and listing objects. If you use LDAP. You can track changes to repository users. You can now export and import objects using the Repository Manager and pmrep. The control file uses these values to determine how to load data to the target. Concurrent processing. pmrep commands.♦ External loading using Teradata Warehouse Builder. such as maintaining deployment groups and labels. Audit trail. checking in. maintain labels. You can use Teradata Warehouse Builder to load to Teradata. Use Repository Manager privilege. You can also use pmrep to run queries. You can apply the transformation logic to rows defined by transaction boundaries. importing. When you select data driven loading. The deployment and object import commands require you to use a control file to define options and resolve conflicts. update. the PowerCenter Server flags rows for insert. Trusted connections. such as copy object. and permissions through the Repository Server Administration Console. You can choose to insert. You do not have to delete user names from the repository.

You can compare tasks. distribute the template with the DLL or shared library you develop. such as changes to folder properties. You can delete an object from view and continue to store it in the repository. You can specify the icons used for transformation. control development on the object. You can create templates that customize the appearance and available properties of a Custom transformation you develop. ♦ Joiner transformation. If you want to permanently remove an object version. Version Control The PowerCenter Client and repository introduce features that allow you to create and manage multiple versions of objects in the repository. You can recover or undelete deleted objects. This allows you to store multiple copies of a given object during the development cycle.audit trail log contains information. track changes. and adding or removing privileges. adding or removing a user or group. you can purge it from the repository. Version control allows you to maintain multiple versions of an object. You can check out and reserve an object you want to edit. the colors. You can create Custom transformations with multiple input and output groups. sessions. copying a deployment group allows you to copy a select number of objects from multiple folders in the source repository to multiple folders in the target repository. and the properties a mapping developer can modify. You can use the Joiner transformation to join two data streams that originate from the same source. Compare objects. You can also compare different versions of the same object. Unlike copying a folder. Individual objects in the repository are now versioned. When you create a Custom transformation template. Deployment. Transformations ♦ Custom transformation. You can compare Designer objects and Workflow Manager objects in the Repository Manager. ♦ ♦ ♦ ♦ Preface xxi . Delete or purge a version. and use deployment groups to copy specific groups of objects from one repository to another. Each version is a separate object with unique properties. This gives you greater control over the specific objects copied from one repository to another. and workflows in the Workflow Manager. Check out and check in versioned objects. Version control in PowerCenter includes the following features: ♦ Object versioning. and check in the object when you are ready to create a new version of the object in the repository. Custom transformations operate in conjunction with procedures you create outside of the Designer interface to extend PowerCenter functionality. The Custom transformation replaces the Advanced External Procedure transformation. and you can compile the procedure with any C compiler. The Repository Manager and Workflow Manager allow you to compare two repository objects of the same type to identify differences between them. The PowerCenter Client tools allow you to compare objects across open folders and repositories. worklets.

You can compare workflows and tasks from the Workflow Manager. XML target enhancements. use XPath to locate XML nodes. ♦ ♦ ♦ XML Support PowerCenter contains XML features that allow you to validate an XML file against an XML schema. A label is an object that you can apply to versioned objects in the repository. You can choose to append the data to the same target file or create a new target file after each flush. This allows you to see the changes made to an object over time. You can format the XML target file so that you can easily view the XML file in a text editor. or you can share it with all users in the repository. Increased performance for large XML files. XML schemas also allow you to define some complex datatypes. Queries. You can now copy objects from all the PowerCenter Client tools using the copy wizard to resolve conflicts. When you process an XML file or stream. to other folders. You can copy objects within folders. You can create a query that specifies conditions to search for objects in the repository. You can create a static deployment group that you manually add objects to. You can also compare all objects from within the Repository Manager. You can create a deployment group that contains references to objects from multiple folders across the repository. Comparing objects. The XML wizard allows you to view the structure of XML schema. XPath support. and organize groups of objects for deployment or export and import. You can use XPath to locate XML nodes. You can use an XML schema to validate an XML file and to generate source and target definitions. Track changes to an object. improve query results.♦ Deployment groups. or create a dynamic deployment group that uses a query to populate the group. You can save queries for later use. You can make a private query. XML schemas allow you to declare multiple namespaces so you can use prefixes for elements and attributes. increase performance for large XML files. ♦ xxii Preface . you can set commits and periodically flush XML data to the target instead of writing all the output at the end of the session. Labels. You can also configure the PowerCenter Server to not output empty elements to the XML target. XML support in PowerCenter includes the following features: ♦ XML schema. Within the Designer. You can view a history that includes all versions of an object and compare any version of the object in the history to any other version. You can use labels to track versioned objects during development. declare multiple namespaces. and parse or generate XML data from various sources. you can also copy segments of mappings to a workspace in a new folder or repository. and to different repositories. ♦ ♦ ♦ Usability ♦ Copying objects. This allows you to associate multiple objects in groups defined by the label. format your XML file output for increased readability.

mappings. expressions. and worklets. such as sources. and conditions based on the direction that you propagate and the attributes you choose to propagate. mapplets. You can now revert to the last saved version of an object in the Workflow Manager. The PowerCenter Client writes messages in the Output window that describe why it invalidates a mapping or workflow when you modify a dependent object. the Workflow Manager accesses the repository to retrieve the last-saved version of the object. you can view dependencies to see the impact on other objects. targets. Viewing dependencies help you modify objects and composite objects without breaking dependencies. Refresh session mappings. View dependencies. workflows. you can choose to propagate changed attributes throughout the mapping.♦ Change propagation. Enhanced validation messages. You can validate sessions. mappings. Before you edit or delete versioned objects. The Designer propagates ports. The Session Wizard is enhanced to provide a graphical depiction of a mapping when you configure partitioning. you can refresh a session mapping. You can validate multiple objects in the repository without fetching them into the workspace. Revert to saved. Validate multiple objects. Enhanced partitioning interface. When you edit a port in a mapping. ♦ ♦ ♦ ♦ ♦ ♦ Preface xxiii . In the Workflow Manager. When you do this. You can view parent and child dependencies and global shortcuts across repositories. You can save and optionally check in objects that change from invalid to valid status as a result of the validation. or workflows.

Web Services Provider Guide. XML User Guide. Lists error messages that you might encounter while using PowerCenter. build mappings. Provides information you need to install and configure the Web Services Hub. as well as monitor workflows in the Workflow Monitor. Also contains information on administering the PowerCenter Server and performance tuning. Workflow Administration Guide. ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ xxiv Preface . XSD. users. or DTD files. and load data into JMS messages. This guide also provides information about how to use the web services that the Web Services Hub hosts. Also includes a description of the transformation datatypes used to process and transform source data. The Web Services Hub hosts Real-time Web Services. Provides information needed to use the Designer. and permissions and privileges. folders. Provides information needed to install and configure the PowerCenter tools. and relational or other XML definitions. Transformation Language Reference. such as creating and maintaining repositories. Includes details on functionality available in the Repository Manager and Administration Console. Troubleshooting Guide. Provides information on how to create and configure each type of transformation in the Designer. groups. Provides information you need to create XML definitions from XML. Getting Started. Designer Guide. Each error message includes one or more possible causes and actions that you can take to correct the condition. Repository Guide. including details on environment variables and database connections. Also includes details on using the midstream XML transformations to parse or generate XML data within a pipeline. PowerCenter Connect® for JMS® User and Administrator Guide. and transformations. Provides basic tutorials for getting started. Includes information on running sessions with XML data. Batch Web Services. Includes information to help you create mappings. Provides information to help you create and run workflows in the Workflow Manager. mapplets. Installation and Configuration Guide. Provides information about how to profile PowerCenter sources to evaluate source data and detect patterns and exceptions. Provides syntax descriptions and examples for each transformation function provided with PowerCenter. Transformation Guide. Provides information to install PowerCenter Connect for JMS. Provides information needed to administer the repository using the Repository Manager or the pmrep command line program. and Metadata Web Services. extract data from JMS messages.About Informatica Documentation The complete set of documentation for PowerCenter includes the following books: ♦ ♦ Data Profiling Guide.

The material in this book is available for online use. italicized text boldfaced text italicized monospaced text Note: Tip: Warning: monospaced text bold monospaced text Preface xxv . The following paragraph provides suggested uses. relational database concepts.About this Book The Transformation Language Reference is written for the developers who are responsible for building mappings to load a data warehouse. unless you follow the specified procedure. This is the variable name for a value you enter as part of an operating system command. The following paragraph notes situations where you can overwrite or corrupt data. Document Conventions This guide uses the following formatting conventions: If you see… It means… The word or set of words are especially emphasized. This is a code example. The Transformation Language Reference assumes you have knowledge of SQL. and the interface requirements for your supporting applications. This is generic text that should be replaced with user-supplied values. The following paragraph provides additional facts. Emphasized subjects. This is an operating system command you enter from a prompt to run a task.

com.informatica.com. and tips and tricks to help you develop data warehouses. and locating your closest sales office.com xxvi Preface . Informatica Webzine. its background.Other Informatica Resources In addition to the product manuals. please email webzine@informatica. and implementation services. The services area of the site includes important information on technical support.informatica. The site contains information about Informatica. newsletters. you can access the Informatica Customer Portal site at http:// my. user group information. upcoming events. Visiting the Informatica Webzine The Informatica Documentation team delivers an online journal. the Informatica Webzine. Visiting the Informatica Web Site You can access Informatica’s corporate web site at http://www. To register for an account. The site contains product information. This journal provides solutions to common tasks. Informatica provides these other resources: ♦ ♦ ♦ ♦ ♦ Informatica Customer Portal Informatica Webzine Informatica web site Informatica Developer Network Informatica Technical Support Visiting Informatica Customer Portal As an Informatica customer. as well as literature and partner information. Visiting the Informatica Developer Network The Informatica Developer Network is a web-based forum for third-party software developers. The Customer Portal has an online registration form for login accounts to its webzine and web support. detailed descriptions of specific features. training and education. You can access the Informatica Developer Network at the following URL: http://devnet. You will also find product information. go to http://my. and access to the Informatica user community.informatica. The Informatica Webzine is a password-protected site that you can access through the Customer Portal. access to the Informatica customer support case management system (ATLAS).com. If you have any questions. the Informatica Knowledgebase.informatica.com.

.5 p. WebSupport requires a user name and password. (local time) France Phone: +33 1 41 38 92 26 Hours: 9 a.m.m.6 p. White Waltham Maidenhead. You can request a user name and password at http://my. (local time) Switzerland Phone: +41 800 81 80 70 Hours: 8 a. (GMT) email: support_eu@informatica.m. North America / South America Informatica Corporation 2100 Seaport Blvd.m.m. (local time) Singapore Phone: +65 322 8589 Hours: 9 a.5:30 p.385. (local time) Germany Phone: +49 1805 702 702 Hours: 9 a.5:30 p.m. (local time) Preface xxvii .563. (PST/PDT) email: support@informatica. .m.5800 Fax: 650. market.m.com Africa / Asia / Australia / Europe Informatica Software Ltd. .m.5 p. . Redwood City.com.The site contains information on how to create.5:30 p.9489 Hours: 6 a. Obtaining Technical Support There are many ways to access Informatica technical support.5:30 p. and support customer-oriented addon solutions based on Informatica’s interoperability interfaces.m.5:30 p.m. You can call or email your nearest Technical Support Center listed below or you can use our WebSupport Service.m. .com Belgium Phone: +32 15 281 702 Hours: 9 a. . 6 Waltham Park Waltham Road.m.6332 or 650. . (local time) Netherlands Phone: +31 306 082 089 Hours: 9 a.213.m.informatica.m.m. CA 94063 Phone: 866. . Berkshire SL6 3TN Phone: 44 870 606 1525 Fax: +44 1628 511 411 Hours: 9 a.

xxviii Preface .

5 Adding Comments to Expressions. 1 .Chapter 1 The Transformation Language This chapter provides a general overview of the transformation language. 2 Expression Syntax. 9 Reserved Words. see “Datatype Reference” in the Designer Guide. It includes the following topics: ♦ ♦ ♦ ♦ Overview. 10 For information about supported datatypes and data conversions.

see “Working with Workflows” in the Workflow Administration Guide. Use built-in constants to reference values that remain constant. For details. You can write expressions in both the Designer and the Workflow Manager. You can also write expressions that include the return values from Lookup. Create workflow variables for use within a workflow to write expressions referencing values that change from workflow to workflow. Workflow variables. and External Procedure transformations. Create mapping parameters for use within a mapping or mapplet to reference values that remain constant throughout a session. or compare data. such as TRUE. Return values. such as a state sales tax rate. see “Mapping Parameters and Variables” in the Designer Guide. For more information. Use transformation operators to create transformation expressions to perform mathematical computations. The transformation language includes SQL-like functions so you can write expressions that modify data or test whether data matches conditions. Mapping parameters and variables. You can also create local variables in transformations. ♦ ♦ ♦ 2 Chapter 1: The Transformation Language . Use built-in variables to write expressions that reference value that vary. Constants. Operators. Create mapping variables in mapplets or mappings to write expressions referencing values that change from session to session. such as the system date.Overview PowerCenter provides a transformation language to help you write expressions to transform source data. The Designer allows you to write expressions in the following transformations: ♦ ♦ ♦ ♦ ♦ ♦ Aggregator Expression Filter Rank Router Update Strategy Link condition Decision task Assignment task The Workflow Manager allows you to write expressions in the following tasks and conditions: ♦ ♦ ♦ Transformation Language Components The transformation language includes the following components to help you create simple or complex transformation expressions: ♦ ♦ ♦ ♦ Functions. Over 60 SQL-like functions allow you to change data in a mapping. Stored Procedure. Local and system variables. combine data.

This indicator appears to the left of and points to the part of the expression containing the error. you might use the AVG function to calculate the average salary of all your employees. Internationalization and the Transformation Language Transformation language functions can handle character data in either ASCII or Unicode data movement mode. For example. during a workflow. Use Unicode mode to handle multibyte character data. the PowerCenter Server writes results to the target tables based on the update strategies you define. When you validate an invalid expression in the expression editor. You can create an expression as simple as a port. such as ORDERS. “>>>>”. or the SUM function to calculate the total sales for a specific branch. if the expression a = b + c contains an error at c.For details on creating expressions and local variables in the Designer. such as 10. For example. such as IIF and DECODE MIN and MAX also return values based on the sort order associated with the PowerCenter Server code page. Transformation Expressions With the transformation language. For a detailed discussion of how transformation expressions are evaluated. a dialog box displays the expression with an error indicator. or a numeric literal. you can create a transformation expression that takes the data from a port and changes it. not byte-oriented. For example. see “Transformations” in the Designer Guide. see “Transformations” in the Designer Guide. the error message displays: a = b + >>>> c Transformation language functions that evaluate character data are character-oriented. the LENGTH function returns the number of characters in a Overview 3 . or combine different ports using the transformation language operators. Then. You can also write complex expressions that include functions nested within functions. The return values of the following functions and transformations depend on the code page of the PowerCenter Server and the data movement mode: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ INITCAP LOWER UPPER MIN (Date) MIN (Number) MAX (Date) MAX (Number) Any function that uses conditional statements to compare strings.

The LOWER function returns a string in lowercase based on the code page of the PowerCenter Server.string. 4 Chapter 1: The Transformation Language . not the number of bytes.

a pre-defined workflow variable (such as $Start. or combine different columns using the transformation language operators. variable) String literals.Expression Syntax Although the transformation language is based on standard SQL. while SQL does not. For example. On the other hand. numeric literals Constants Functions Local and system variables Mapping parameters and mapping variables Pre-defined workflow variables User-defined workflow variables Operators Return values Expression Syntax 5 . SQL supports the keywords AS and FROM for nonaggregate functions and ALL and DISTINCT for aggregate functions. the transformation language supports an optional filter condition for aggregate functions. You can also write complex expressions that include functions nested within functions. input/output. Expression Components Expressions can consist of any combination of the following components: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ Ports (input. but the transformation language does not. You can create an expression that is as simple as a port (such as ORDERS). or a numeric literal (such as 10).Status). it is not exactly like SQL.

:TD.) The arguments are the local ports used in the lookup condition. the following string is not allowed: 'Joan's car' To return a string containing a single quote.external_procedure_transformation(argument1. PROC_RESULT]) The arguments must match the arguments in the unconnected Stored Procedure transformation. argument2.5 LOOKUP function.SALES. Be sure to enclose string literals within single quotation marks. The general syntax is: LOOKUP(:TD.) :LKP Required when you create an expression that includes the return value from an unconnected Lookup transformation..5 expressions only).CURRVAL :SP Required when you write an expression that includes the return value from an unconnected Stored Procedure transformation. The general syntax is: :SEQ. :SD Optional (PowerMart 3.column_name :SEQ Required when you create an expression that includes a port in a Sequence Generator transformation.ITEM_NAME. The general syntax is: :SD. The general syntax is: :SP. argument2.source_table.. use the reference qualifiers in Table 1-1: Table 1-1. 15. The general syntax is: :EXT. For example. 10. use the CHR function: 'Joan' || CHR(39) || 's car' 6 Chapter 1: The Transformation Language . :TD Required when you reference a target table in a PowerMart 3.stored_procedure_transformation( argument1..Ports and Return Values When you write an expression that includes a port or return value from an unconnected transformation. The general syntax is: :LKP. [.99) String and Numeric Literals You can include numeric or string literals.ITEM_ID.sequence_generator_transformation. Qualifies a source table port in an expression.SALES. The datatypes for the local ports must exactly match the datatype of the Lookup ports used in the lookup condition. :TD. Reference Qualifiers in Transformation Language Reference Qualifier :EXT Description Required when you write an expression that includes a return value from an External Procedure transformation..SALES.lookup_transformation(argument1. . argument2. For example: 'Alice Davis' String literals are case-sensitive and can contain any character except a single quotation mark. .PRICE. The order must match the order of the ports in the transformation.

Separate each argument in a function with a comma. For example.05 or $$Sales_Tax Note: For details on constants. For example. Use the ports tab in the Expression Editor to enter a port name into an expression. Stored Procedure transformation. ♦ You can pass a value from a port. The PowerCenter Server treats any string value enclosed in single quotation marks as a character string. General Rules These general rules apply when writing all expressions: ♦ You cannot include both single-level and nested aggregate functions in an Aggregator transformation. local and system variables. 10) is not valid because the SUBSTR function requires an integer value. enclose literal strings within single quotation marks. The colon (:). ♦ You cannot use strings as numeric parameters. For example: . For details on workflow variables. the Designer propagates the name change to expressions in the transformation. mapping parameters and variables.). the expression SUBSTR(TEXT_VAL. For example. create separate Aggregator transformations. The PowerCenter Server treats a dash (-) as a minus operator. Do not use quotation marks for literal numbers. variable. If you need to create both single-level and nested functions. Except for literals. functions. Except for literals. Expression Syntax 7 ♦ ♦ ♦ ♦ ♦ ♦ ♦ . If you rename a port in a connected transformation. If you pass a literal value to a function.4 = ‘123. ♦ You cannot mix datatypes when using comparison operators. and operators see corresponding chapters in this guide. comma (. see “Working with Workflows” in the Workflow Administration Guide. ‘1’. literal string or number. the expression 1 + ‘1’ is not valid because you can only perform addition on numeric datatypes. the Designer and PowerCenter Server ignore spaces. not a string. the transformation language is not case-sensitive. or the results of another expression. External Procedure transformation. ♦ You cannot use strings in numeric expressions. Lookup transformation. the expression 123. You cannot add an integer and a string. Just type the number you want to include. as the start position. and period (.4’ is not valid because it compares a decimal value with a string.) have special meaning and should be used only to specify syntax.Do not use single quotation marks with numeric literals.

which allow only one nested aggregate function). ♦ ♦ For more information on entering expressions. 8 Chapter 1: The Transformation Language .♦ When you pass a mapping parameter or variable or a workflow variable to a function within an expression. see “Transformations” in the Designer Guide and “Working with Workflows” in the Workflow Administration Guide. The PowerCenter Server evaluates the expression starting with the innermost function. Do not use quotation marks to designate ports. You can nest multiple functions within an expression (except aggregate functions. do not use quotation marks to designate mapping parameters or variables or workflow variables.

you can enter the following expression with comments in the middle of the expression: -. For example. you can add them by clicking Comment in the Expression Editor.This expression concatenates first and last names for customers: FIRST_NAME -. the Designer and Workflow Manager do not validate the expression.Adding Comments to Expressions The transformation language provides two comment specifiers to let you insert comments in expressions: ♦ Two dashes.First names from the CUST table || // Concat symbol LAST_NAME // Last names from the CUST table Joe Smith Aug 18 1998 In this case. as in: -.First names from the CUST table || // Concat symbol LAST_NAME // Last names from the CUST table // Joe Smith Aug 18 1998 The PowerCenter Server ignores the comments and evaluates the expression as follows: FIRST_NAME || LAST_NAME You cannot continue a comment to a new line: -.These are comments ♦ Two slashes. if you want to concatenate two strings. If you do not want to embed comments. since the last line is not a valid expression. as in: // These are comments The PowerCenter Server ignores all text on a line preceded by these two comment specifiers. Adding Comments to Expressions 9 .This expression concatenates first and last names for customers: FIRST_NAME -.

Reserved words have predefined meanings in expressions. These include: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ :EXT :LKP :SD :SEQ :SP :TD AND DD_DELETE DD_INSERT DD_REJECT DD_UPDATE FALSE NOT NULL OR PROC_RESULT SESSSTARTTIME SPOUTPUT SYSDATE TRUE WORKFLOWSTARTTIME ABORTED DISABLED FAILED NOTSTARTED STARTED STOPPED SUCCEEDED The following words are reserved for workflow expressions only: ♦ ♦ ♦ ♦ ♦ ♦ ♦ Note: You cannot use a reserved word to name a port or local variable. and system variables.Reserved Words Some keywords in the transformation language. are reserved for specific functions. You can only use reserved words within transformation and workflow expressions. 10 Chapter 1: The Transformation Language . such as constants. operators.

13 DD_REJECT. 14 DD_UPDATE. 12 DD_INSERT. 19 11 . 15 FALSE. 16 NULL.Chapter 2 Constants This chapter describes how to use the built-in constants of the transformation language: ♦ ♦ ♦ ♦ ♦ ♦ ♦ DD_DELETE. 17 TRUE.

select the data-driven update strategy to delete records from a target based on this flag. 2. Example The following expression marks items with an ID number of 1001 for deletion. DD_INSERT ) This update strategy expression uses numeric literals to produce the same result: IIF( ITEM_ID = 1001. DD_DELETE is equivalent to the integer literal 2.DD_DELETE Flags records for deletion in an update strategy expression. Informatica recommends using DD_DELETE instead of the integer literal 2. It is easier to troubleshoot complex numeric expressions if you use DD_DELETE. and all other items for insertion: IIF( ITEM_ID = 1001. When you run a workflow. 12 Chapter 2: Constants . Note: Use the DD_DELETE constant in the Update Strategy transformation only. 0 ) Note: The expression using constants is easier to read than the expression using numeric literals. DD_DELETE.

3 ) Tip: The expression using constants is easier to read than the expression using numeric literals. DD_INSERT is equivalent to the integer literal 0.DATE_SHIPPED.NAME = 'Alex'. 0 ) > 2. ORDERS. 'DD' ). It is easier to troubleshoot complex numeric expressions if you use DD_INSERT.DD_INSERT Flags records for insertion in an update strategy expression. it flags them for insertion: IIF( TRUNC( DATE_DIFF( SESSSTARTTIME. select the data-driven update strategy to write records to a target based on this flag. and rejects everything else: IIF( EMPLOYEE. When you run a workflow. The following update strategy expression uses SESSSTARTTIME to find only those orders that shipped in the last two days and flag them for insertion. Note: Use the DD_INSERT constant in the Update Strategy transformation only. DD_REJECT ) This update strategy expression uses numeric literals to produce the same result: IIF( EMPLOYEE. DD_INSERT. 0.NAME = 'Alex'. DD_INSERT ) DD_INSERT 13 . the expression subtracts DATE_SHIPPED from the system date. It then compares the result to the integer literal 2. The following update strategy expression flags an employee’s sales for insertion. Examples The following examples modify a mapping that calculates monthly sales per salesperson. the expression uses TRUNC to truncate the difference. If the result is greater than 2. the expression flags the records for rejection. Informatica recommends using DD_INSERT instead of the integer literal 0. returning the difference between the two dates. Using DATE_DIFF. If the result is 2 or less. so you can examine the sales of just one salesperson. Because DATE_DIFF returns a Double value.DD_REJECT.

SALES > 0. The following data-driven example uses DD_REJECT and IS_SPACES to avoid writing spaces to a character column in a target table. When you run a workflow. DD_REJECT. This expression flags records that consist entirely of spaces for reject and flags all others for insert: IIF( IS_SPACES( CUST_NAMES ). select the data-driven update strategy to reject records from a target based on this flag. Examples The following examples modify a mapping that calculates the sales for the current month. DD_REJECT is equivalent to the integer literal 3. so it includes only positive values. DD_INSERT. Informatica recommends using DD_REJECT instead of the integer literal 3. If you flag a record as reject. Use DD_REJECT to filter or validate data. It is easier to troubleshoot complex numeric expressions if you use DD_REJECT. This update strategy expression flags records less than zero for reject and all others for insert: IIF( ORDERS. the PowerCenter Server skips the record and writes it to the session reject file.SALES > 0. 3 ) Notice that the expression using constants is easier to read than the expression using numeric literals.DD_REJECT Flags records for rejection in an update strategy expression. DD_REJECT ) This expression uses numeric literals to produce the same result: IIF( ORDERS. DD_INSERT ) 14 Chapter 2: Constants . Note: Use the DD_REJECT constant in the Update Strategy transformation only. 0.

If the result is 2 or less. it flags the records for update. Using DATE_DIFF. it flags them for rejection: IIF( TRUNC( DATE_DIFF( SYSDATE. the expression flags the records for rejection. The following update strategy expression uses SYSDATE to find only those orders that have shipped in the last two days and flag them for insertion. returning the difference between the two dates. It is easier to troubleshoot complex numeric expressions if you use DD_UPDATE. DD_UPDATE. This expression flags records for Alex as updates and flags all others for rejection: IIF( EMPLOYEE.NAME = 'Alex'. When you run a workflow. Examples The following examples modify a mapping that calculates sales for the current month. Note: Use the DD_UPDATE constant in the Update Strategy transformation only. ORDERS. select the data-driven update strategy to write records to a target based on this flag. flagging Alex’s sales for update (1) and flagging all other sales records for rejection (3): IIF( EMPLOYEE.DATE_SHIPPED. It then compares the result to the integer literal 2. If the result is greater than 2. 'DD' ). 0 ) > 2. otherwise. 3 ) Notice that the expression using constants is easier to read than the expression using numeric literals. 1. The mapping loads sales for one employee. DD_REJECT ) This expression uses numeric literals to produce the same result. the expression subtracts DATE_SHIPPED from the system date. Informatica recommends using DD_UPDATE instead of the integer literal 1.NAME = 'Alex'. DD_REJECT.DD_UPDATE Flags records for update in an update strategy expression. DD_UPDATE ) DD_UPDATE 15 . Because DATE_DIFF returns a Double value. DD_UPDATE is equivalent to the integer literal 1. the expression uses TRUNC to truncate the difference.

Var2 = 49. Var2 > 30. Var1 = 22. 'Variable 2 was more than 30. This is useful if you want to perform multiple searches based on a single search value: DECODE( FALSE.'Variable 1 was 22!'. 'Variables were out of desired ranges. Example The following example uses FALSE in a DECODE expression to return values based on the results of a comparison. FALSE is equivalent to the integer 0.') 16 Chapter 2: Constants .'.'Variable 2 was 49!'.FALSE Clarifies a conditional expression. Var1 < 23. 'Variable 1 was less than 23.'.

^=. Functions can handle nulls differently. However.NULL Indicates that a value is either unknown or undefined. it might return zero or NULL. !=. >=. For details on how each function handles null values. <= For example. the PowerCenter Server parameter is TreatNullInComparisonOperatorsAs. or it might ignore null values. see “Installing and Configuring the PowerCenter Server on Windows” and “Installing and Configuring the PowerCenter Server on UNIX” in the Installation and Configuration Guide. you can also configure the PowerCenter Server to treat null values as high or low in comparison operations. Configure how the PowerCenter Server handles null values in comparison expressions on the Configuration tab of the PowerCenter Server setup using the Treat Null In Comparison Operators As property. >. This PowerCenter Server configuration property affects the behavior of the following comparison operators in expressions: =. Therefore. Working with Null Values in Boolean Expressions Expressions that combine a null value with a Boolean expression produces results that are ANSI compliant. <>. see “Functions” on page 49. For more information. For example. any column that has the NOT NULL or PRIMARY KEY constraint will not accept nulls. suppose you have the following expressions: NULL > 1 NULL = NULL NULL 17 . Although you can write expressions that return nulls. when you use a null value in an expression containing a comparison operator. the PowerCenter Server produces the following results: ♦ ♦ NULL AND TRUE = NULL NULL AND FALSE = FALSE Working with Null Values in Comparison Expressions By default. <. the database will reject the row and the PowerCenter Server will write it to the reject file. the PowerCenter Server produces a null value. Be sure to consider nulls when you create transformations. NULL is not equivalent to a blank or empty string (for character columns) or zero (for numerical columns). If you pass a null value to a function. When you configure the PowerCenter Server on UNIX. if the PowerCenter Server tries to write a null value to a column with one of these constraints.

and MOVINGSUM.NULL To test for nulls. 18 Chapter 2: Constants . For more information on configuring the PowerCenter Server. However. If the filter condition evaluates to NULL for all records in the selected port. the function does not select the record. which returns zero). Evaluating Null Values in Comparison Expressions Expression NULL > 1 NULL = NULL Treat Null in Comparison Operators As NULL NULL NULL HIGH TRUE TRUE LOW FALSE TRUE Null Values in Aggregate Functions By default. use the ISNULL function. Null Values in Filter Conditions If a filter condition evaluates to NULL. see “Installing and Configuring the PowerCenter Server on Windows” or “Installing and Configuring the PowerCenter Server on UNIX” in the Installation and Configuration Guide. when you configure the PowerCenter Server. the function returns NULL. you can choose how you want it to handle null values in aggregate functions. the PowerCenter Server treats null values as nulls in aggregate functions. the aggregate function returns NULL (except COUNT. as well as CUME. Nulls with Operators Any expression that uses operators (except the string operator ||) and contains a null value always evaluates to NULL. You use filter conditions with aggregate functions. You can have the PowerCenter Server treat null values as zero in aggregate functions or as NULLs. the following expression evaluates to NULL: 8 * 10 .Table 2-1 describes how the PowerCenter Server evaluates the expressions: Table 2-1. For example. MOVINGAVG. If you pass an entire port or group of null values.

Var1 < 23.TRUE Returns a value based on the result of a comparison.') TRUE 19 . Example The following example uses TRUE in a DECODE expression to return values based on the results of a comparison. 'Variable 1 was less than 23. Var2 > 30.'. 'Variables were out of desired ranges.'.'Variable 2 was 49!'. TRUE is equivalent to the integer 1. Var2 = 49. This is useful if you want to perform multiple searches based on a single search value: DECODE( TRUE. Var1 = 22. 'Variable 2 was more than 30.'Variable 1 was 22!'.

20 Chapter 2: Constants .

23 String Operators.Chapter 3 Operators This chapter describes how to use operators to perform arithmetic or comparisons within functions. 25 Logical Operators. 24 Comparison Operators. 22 Arithmetic Operators. 26 21 . It includes the following topics: ♦ ♦ ♦ ♦ ♦ Operator Precedence.

not equal to. greater than. <>. *. The transformation language also supports the use of operators within nested expressions.2) * 8 Return Value -3 32 22 Chapter 3: Operators . The logical OR operator. 2. Unary plus and minus. The logical AND operator. modulus. ^= NOT AND OR Meaning Parentheses. used when specifying conditions. Equal to. If you write an expression that includes multiple operators. Arithmetic operators String operators Comparison operators Logical operators Table 3-1 lists the precedence for all transformation language operators. The logical NOT operator. less than or equal to. When expressions contain parentheses. >. Multiplication. the PowerCenter Server evaluates operations inside parentheses before operations outside parentheses. Operators in the Transformation Language Operator () +. <=.Operator Precedence The transformation language supports the use of multiple operators and the use of operators within nested expressions. greater than or equal to. Concatenate. || <. 4. % +. subtraction. For example. Table 3-1. 3. >= =. not equal to.2 * 8 returns different values: Equation 8+5-2*8 8 + (5 . It evaluates operators in an expression with equal precedence to all operators from left to right. Operations in the innermost parentheses are evaluated first. The PowerCenter Server evaluates operators in the order they appear in the following table. used when specifying conditions. !=. the equation 8 + 5 . Addition. division. the PowerCenter Server evaluates the expression in the following order: 1. depending on how you nest the operations. Less than. /. not equal to.

To perform arithmetic on date values. the expression 1 + ‘1’ is not valid because it adds an integer to a string. modulus. Arithmetic Operators in the Transformation Language Operator +. subtraction. For further information on built-in date functions. Unary plus indicates a positive value. Unary minus indicates a negative value. The addition operator (+) does not concatenate strings. use the date functions.Arithmetic Operators Use arithmetic operators to perform mathematical calculations on numeric data. all of the operands in the expression must be numeric. The expression 1. use the string operator ||. When you use arithmetic operators in an expression. For example. A modulus is the remainder after dividing two integers. % +. *. Meaning Unary plus and minus. division. the function returns NULL. see “Understanding Date Arithmetic” on page 47. 13 % 2 = 1 because 13 divided by 2 equals 6 with a remainder of 1. Arithmetic Operators 23 . Table 3-2 lists the arithmetic operators in order of precedence in the transformation language: Table 3-2. Note: The transformation language provides built-in date functions that let you perform arithmetic on date/time values. To concatenate strings. If you perform arithmetic on a null value. /. For example. Multiplication. Addition.23 + 4 / 2 is valid because all of the operands are numeric.

String Operators Use the || string operator to concatenate two strings. 24 Chapter 3: Operators . if both values are NULL. Nulls The || operator ignores null values. however. However. The || operator. You can use the LTRIM and RTRIM functions to trim leading and trailing spaces before concatenating two strings. Example The following example shows an expression that concatenates employee first names and employee last names from two columns. then concatenates the last name: LTRIM( RTRIM( EMP_FIRST ) || ' ' || LTRIM( EMP_LAST )) EMP_FIRST ‘ ‘ Alfred’ Bernice’ EMP_LAST ‘ Rice ‘ RETURN VALUE Alfred Rice Bernice Kersins Proud Curt NULL ‘ Kersins’ ‘ Proud’ NULL ‘ Curt’ NULL NULL NULL Note: You can also use the CONCAT function to concatenate two string values. concatenates a space to the end of each first name. the || operator returns NULL. The || operator converts operands of any datatype (except Binary) to String datatypes before concatenation: Input Value 'alpha' || 'betical' 'alpha' || 2 'alpha' || NULL Return Value alphabetical alpha2 alpha The || operator includes leading and trailing spaces. produces the same results in less time. This expression removes the spaces from the end of the first name and the beginning of the last name.

If a filter condition evaluates to NULL. Less than. Not equal to. the result is NULL.4 > 123 and ‘a’ != ‘b’ are valid because the operands are the same datatype. the PowerCenter Server returns NULL. the operands must be the same datatype. For information on how to compare dates. You can use the greater than (>) and less than (<) operators to compare numeric values or return a range of rows based on the sort order for a primary key in a particular port. Greater than. When you use comparison operators in an expression.4 > ‘123’ is not valid because the expression compares a decimal with a string. Comparison Operators 25 . Not equal to. Comparison Operators in the Transformation Language Operator = > < >= <= <> != ^= Meaning Equal to. Table 3-3 lists the comparison operators in the transformation language: Table 3-3. manipulate data. and return a TRUE (1) or FALSE (0) value. The expressions 123. see “Dates” on page 33. the expression 123. If you compare a value to a null value. Less than or equal to. For example. Greater than or equal to. Not equal to.Comparison Operators Use comparison operators to compare character or numeric strings.

and NULL for NULL. For example. Joins two conditions and returns TRUE if both conditions evaluate to TRUE. if an expression evaluates to TRUE. Logical Operators in the Transformation Reference Operator NOT AND OR Meaning Negates result of an expression.Logical Operators Use logical operators to manipulate numeric data. NOT returns TRUE. FALSE for zero. Returns FALSE if one condition is not true. Expressions that return a numeric value evaluate to TRUE for non-zero values. Table 3-4 lists the logical operators in the transformation language: Table 3-4. Connects two conditions and returns TRUE if any condition evaluates to TRUE. the PowerCenter Server produces the following results: ♦ ♦ NULL AND TRUE = NULL NULL AND FALSE = FALSE 26 Chapter 3: Operators . If an expression evaluates to FALSE. Returns FALSE if both conditions are not true. the operator NOT returns FALSE. Nulls Expressions that combine a null value with a Boolean expression produce results that are ANSI compliant. For example.

32 27 . 28 Transaction Control Variables. 31 Local Variables.Chapter 4 Variables This chapter describes how to use these variables: ♦ ♦ ♦ System Variables.

System Variables
The transformation language provides the following system variables:
♦ ♦ ♦ ♦

$$$SessStartTime SESSSTARTTIME SYSDATE WORKFLOWSTARTTIME

$$$SessStartTime
$$$SessStartTime returns the initial system date value on the machine hosting the PowerCenter Server when the server initializes a session. $$$SessStartTime returns the session start time as a string value. The format of the string depends on the database you are using. Table 4-1 lists the $$$SessStartTime date and time format according to different database types:
Table 4-1. Datatype Expansion for $$$SessStartTime Database Type Oracle Sybase Microsoft SQL Server Informix ODBC IBM DB2 Date/time format MM/DD/YYYY HH24:MI:SS MM/DD/YYYY HH24:MI:SS MM/DD/YYYY HH24:MI:SS YYYY-MM-DD HH24:MI:SS YYYY-MM-DD HH24:MI:SS YYYY-MM-DD-HH24:MI:SS

You can use $$$SessStartTime in a mapping or mapplet filter condition, user-defined join, or SQL override of a source qualifier. You can also use $$$SessStartTime in session-level overrides for mapping attributes. For details on using $$$SessStartTime in a mapping, see “Source Qualifier Transformation” in the Transformation Guide.
Note: Changing any database environment variable such as NLS_LANG_FORMAT for

Oracle or DBDATE for Informix does not affect the format string for datetime values the PowerCenter Server uses in the SQL override for $$$SessStartTime.

Example
The following expression uses $$$SessStartTime in the source filter condition of a source qualifier to perform an incremental extraction. The expression specifies a range of dates of all days in the week prior to when the PowerCenter Server initializes the session. The expression uses the function DATEDIFF to find the difference in the number of days between the value

28

Chapter 4: Variables

ORDER_DATE and $$$SessStartTime. If the difference between the two dates is less than or equal to seven days, the PowerCenter Server extracts that row from the source:
DATEDIFF(DAY, ORDER_DATE, ‘$$$SessStartTime’) <= 7

SESSSTARTTIME
SESSSTARTTIME returns the current date and time value on the machine hosting the PowerCenter Server when the server initializes the session. You can use SESSSTARTTIME with any function that accepts transformation date/time datatypes. SESSSTARTTIME is stored as a transformation date/time datatype value. You can use SESSSTARTTIME in a mapping or a mapplet. You can reference SESSSTARTTIME only within the expression language.

Example
The following expression uses SESSSTARTTIME to display the number of days an order has been open. Using the SQL function DATE_DIFF, the PowerCenter Server subtracts DATE_ENTERED from SESSSTARTTIME and returns the result as a number of days:
DATE_DIFF(SESSSTARTTIME, DATE_ENTERED, ‘DD’)

SYSDATE
SYSDATE returns the current date and time on the machine hosting the PowerCenter Server for each row passing through the transformation. SYSDATE is stored as a transformation date/time datatype value. To capture a static system date, use the SESSSTARTTIME variable instead of SYSDATE.

Example
The following expression uses SYSDATE to find only those orders that have shipped in the last two days and flag them for insertion. Using DATE_DIFF, the PowerCenter Server subtracts DATE_SHIPPED from the system date, returning the difference between the two dates. Because DATE_DIFF returns a double value, the expression truncates the difference. It then compares the result to the integer literal 2. If the result is greater than 2, the expression flags the rows for rejection. If the result is 2 or less, it flags them for insertion.
IIF( TRUNC( DATE_DIFF( SYSDATE, DATE_SHIPPED, 'DD' ), 0 ) > 2, DD_REJECT, DD_INSERT

WORKFLOWSTARTTIME
WORKFLOWSTARTTIME returns the current date and time value on the machine hosting the PowerCenter Server when the server initializes the workflow. You can use WORKFLOWSTARTTIME with any function that accepts transformation date/time

System Variables

29

datatypes. WORKFLOWSTARTTIME is stored as a transformation date/time datatype value. You can use WORKFLOWSTARTTIME in workflow tasks such as Assignment tasks, Decision tasks, and links. You can reference WORKFLOWSTARTTIME only within the expression language.

Example
The following expression uses WORKFLOWSTARTTIME to display the number of minutes between the workflow start time and the start time of a task in the workflow. Using the SQL function DATE_DIFF, the PowerCenter Server subtracts the task start time from WORKFLOWSTARTTIME and returns the result as a number of days:
DATE_DIFF(WORKFLOWSTARTTIME, $s_EmployeeData.StartTime, ‘MI’)

30

Chapter 4: Variables

Transaction Control Variables
Transaction control variables define conditions to commit or rollback transactions during the processing of database rows. You use these variables in transaction control expressions that you build in the Expression Editor. Transaction control expressions use the IIF function to test each row against a condition. Depending on the return value of the condition, the PowerCenter Server commits, rolls back, or makes no transaction changes for the row. For details about transaction control, see “Transaction Control Transformation” in the Transformation Guide. The following example uses transaction control variables to determine where to process a row:
IIF (NEWTRAN=1, TC_COMMIT_BEFORE, TC_CONTINUE_TRANSACTION)

If NEWTRAN=1, the TC_COMMIT_BEFORE variable causes a commit to occur before the current row processes. Otherwise, the TC_CONTINUE_TRANSACTION variable forces the row to process in the current transaction. You can use the following variables in the Expression Editor when you create a transaction control expression.
♦ ♦ ♦ ♦

TC_CONTINUE_TRANSACTION TC_COMMIT_BEFORE TC_COMMIT_AFTER TC_ROLLBACK_BEFORE

TC_CONTINUE_TRANSACTION
The PowerCenter Server does not perform any transaction change for the current row. This is the default transaction control variable value.

TC_COMMIT_BEFORE
The PowerCenter Server commits the transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.

TC_COMMIT_AFTER
The PowerCenter Server writes the current row to the target, commits the transaction, and begins a new transaction. The current row is in the committed transaction.

TC_ROLLBACK_BEFORE
The PowerCenter Server rolls back the current transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.

Transaction Control Variables

31

Local Variables
If you use local variables in a mapping, you can use them in any transformation expression in the mapping. For example, if you use a complex tax calculation throughout a mapping, you might want to write the expression once and designate it as a variable. You thereby increase performance since the PowerCenter Server performs the calculation only once. Local variables are especially useful when used with stored procedure expressions to capture multiple return values. For details on local variables, see “Transformations” in the Designer Guide.

32

Chapter 4: Variables

34 Date Format Strings. 40 TO_DATE and IS_DATE Format Strings. 43 Understanding Date Arithmetic. It includes the following topics: ♦ ♦ ♦ ♦ ♦ Overview. 39 TO_CHAR Format Strings.Chapter 5 Dates This chapter describes how to use dates in transformations. 47 33 .

or compare dates. Tests whether a string represents a date.Overview The transformation language provides a set of date functions and built-in date variables to help you perform transformations on dates. To pass a string to a date function. Modified Julian Day. and the Gregorian Calendar PowerCenter supports dates in the Gregorian calendar system only. For details on built-in variables. With the date functions you can round. Julian Day. the PowerCenter Server truncates the millisecond portion of the date. Use to specify the format of the return string. extract one part of a date.D. TO_CHAR. The transformation language provides the following other functions to manipulate dates: ♦ ♦ ♦ IS_DATE. PowerCenter stores dates internally in binary format.D. Dates expressed in a different calendar system are not supported. 34 Chapter 5: Dates . Date format strings. or perform arithmetic on a date. Use with date functions to specify the parts of a date. You can use date variables to capture the current date or session start time on the machine hosting the PowerCenter Server. TO_DATE and IS_DATE format strings. Milliseconds PowerCenter supports date/time values up to the second. ‘MM/DD/RR’). the following expression converts a string port to date/time values and then adds one month to each date: ADD_TO_DATE( TO_DATE( STRING_PORT. For example. TO_DATE. ‘MM’. Converts a string to a date. TO_CHAR format strings. truncate. The transformation language also provides the following sets of format strings: ♦ ♦ ♦ Date/Time Datatype PowerCenter provides a set of generic datatypes to help you transform data from different sources. Date functions accept date/time values only. see “Variables” on page 27. Use to specify the format of a string you want to convert to a date or test. If you pass a value to a date function or Date/Time port. and 9999 A. 1 ) Note: PowerCenter supports dates between 1753 A. These transformation datatypes include a Date/Time datatype. first use TO_DATE to convert it to a date/time value. Converts a date to a string.

The J format string does not convert this time component. The RR format string converts data differently depending on the current year. For example. 'J') SHIP_DATE_MJD_STR 2451544 2415021 RETURN_VALUE Dec 31 1999 00:00:00 Jan 1 1900 00:00:00 Because the J format string does not include the time portion of a date.D. Overview 35 . Dates in the Year 2000 All transformation language date functions support the year 2000. PowerCenter provides the ability to manipulate Modified Julian Day (MJD) formats using the J format string. the return values have the time set to 00:00:00. the following TO_DATE expression converts strings in the SHIP_DATE_MJD_STRING port to date values in the default date format: TO_DATE (SHIP_DATE_MJD_STR. RR Format String The transformation language provides the RR format string to convert strings with two-digit years to dates.D. You can also use the J format string in TO_CHAR expressions. This term should not be confused with Julian Day. and are not supported in PowerCenter. nor with Modified Julian Day. and 9999 A. which represents some fraction of 24 hours. PowerCenter supports dates between 1753 A. Using TO_DATE and the RR format string. By definition. The MJD for a given date is the number of days to that date since Jan 1 4713 BC 00:00:00 (midnight). For example.Note: Dates in the Julian calendar are called Julian dates. For example: TO_CHAR(SHIP_DATE. 'J') SHIP_DATE Dec 31 1999 23:59:59 Jan 1 1900 01:02:03 RETURN_VALUE 2451544 2415021 Note: The PowerCenter Server ignores the time portion of the date in a TO_CHAR expression. you can use the J format string in a TO_CHAR expression to convert date values to MJD values expressed as strings. MJD includes a time component expressed as a decimal. you can convert a string in the format MM/DD/RR to a date.

♦ Current Year Between 0 and 49. the PowerCenter Server returns the current century plus the specified two-digit year. RR and YY produce different results. Current Year Between 50 and 99. Both the RR and YY format strings specify two-digit years. the PowerCenter Server returns the previous century plus the two-digit year from the source string. Table 5-2 illustrates the different results each format string returns: Table 5-2. the PowerCenter Server returns the current century plus the two-digit year from the source string. ‘MM/DD/RR’) 04/12/1998 00:00:00 11/09/2001 00:00:00 TO_DATE(String. The YY and RR format strings produce identical results when used with all date functions except TO_DATE. ‘MM/DD/YY’) 04/12/1998 00:00:00 11/09/1901 00:00:00 36 Chapter 5: Dates . ♦ Table 5-1 summarizes how the RR format string converts to dates: Table 5-1. If the source string year is between 50 and 99. If the current year is between 0 and 49 (such as 2003) and the source string year is between 0 and 49. In TO_DATE expressions. ‘MM/DD/RR’ ) ORDER_DATE ‘04/12/98’ ‘11/09/01’ RETURN_VALUE 04/12/1998 00:00:00 11/09/2001 00:00:00 Difference Between the YY and RR Format Strings PowerCenter also provides a YY format string. the PowerCenter Server returns the next century plus the two-digit year from the source string. If the current year is between 50 and 99 (such as 1998) and the source string year is between 0 and 49. If the source string year is between 50 and 99. Differences Between RR and YY Format Strings String 04/12/98 11/09/01 Current Year 1998 1998 TO_DATE(String. RR Format String Conversions Current year 0-49 0-49 50-99 50-99 Source year 0-49 50-99 0-49 50-99 RR Format String Returns Current century Previous century Next century Current century Example The following expression produces the same return values for any current year between 1950 and 2049: TO_DATE( ORDER_DATE.

[format_string]) to convert dates to strings. MM/DD/ YYYY HH24:MI:SS. or it is an invalid date. ‘MM/DD/YY’) 04/12/2098 00:00:00 11/09/2001 00:00:00 For dates in the year 2000 and beyond. Overview 37 ♦ ♦ . If you want to pass a string to a date function. Informatica recommends using the RR format string for dates in the twenty-first century. The PowerCenter Server expects the string values to be in the default date format. MM/DD/ YYYY HH24:MI:SS. the PowerCenter Server returns a string in the specified format. Note: The transformation language date functions accept date values only. ‘MM/DD/RR’) 04/12/1998 00:00:00 11/09/2001 00:00:00 TO_DATE(String. If you specify a format string. the PowerCenter Server only uses the default date format when you: ♦ Convert a date to a string by connecting a date/time port to a string port. You can pass date/time data to any of the date functions. If the string is in the default date format. and year. Although date formats vary from database to database. the PowerCenter Server skips the row. the YY format string produces less meaningful results than the RR format string. You can also use IS_DATE to check if a string is a valid date before converting it with TO_DATE. dates stored in relational databases contain a date and time value. Use TO_CHAR(date. Dates in Relational Databases In general. Dates in Flat Files The transformation language provides the TO_DATE function to convert strings to date/ time values. the PowerCenter Server returns the string in the default date format. Differences Between RR and YY Format Strings String 04/12/98 11/09/01 Current Year 2003 2003 TO_DATE(String. and even between applications. while the time might include the hours. If you omit the format string. If an input value does not match this format. MM/DD/ YYYY HH24:MI:SS. Convert a string to a date by connecting a string port to a date/time port. Because PowerCenter stores dates in binary format. The PowerCenter Server converts the date to a string in the default date format. minutes. day. you must first use the TO_DATE function to convert it to a transformation Date/Time datatype.Table 5-2. the transformation language can read any date with a date datatype. The date includes the month. Default Date Format The PowerCenter Server uses a default date format to store and manipulate strings that represent dates. the PowerCenter Server converts the string to a date value. and seconds.

12:00:00PM = 12. the PowerCenter Server expects the string in the default date format. 12:00:00AM = 0.♦ Use TO_DATE(date. the PowerCenter Server expects a string in the specified format. MM/DD/ YYYY HH24:MI:SS. If you specify a format string. If you omit the format string. [format_string]) to convert strings to dates. Month (January = 01. 11:00:00PM = 23) Minutes Seconds The default date format of MM/DD/YYYY HH24:MI:SS consists of: ♦ ♦ ♦ ♦ ♦ ♦ 38 Chapter 5: Dates . such as 1998) Hour (in 24-hour form. September = 09) Day (of the month) Year (expressed in four digits. 1:00:00AM = 1. For example.

For example. Specify the part of the date you want to return. Specify the part of the date you want to change. You can use any of these format strings to specify the entire day portion of a date. For example. Seconds (0-59). Date Functions that Use Date Format Strings Function ADD_TO_DATE DATE_DIFF GET_DATE_PART ROUND SET_DATE_PART TRUNC Description Specify the part of the date you want to change. J Description Days (01-31).) Month (01-12). if you pass 12-APR-1997 to a date function. It must always be enclosed within single quotation marks. Minutes (0-59. Date format strings are not internationalized and must be entered in predefined formats as listed in the following table. Specify the part of the date to use to calculate the difference between two dates. HH12. HH. Date Format Strings 39 . Date Format Strings in the Transformation Reference Format String D. You can use any of these formats to specify the entire hour portion of a date. MON. Year portion of date (1753 to 9999). you can use any of these format strings specify 12. You can use any of these format strings to specify the entire month portion of a date. SSSS Y. HH12. Specify the part of the date you want to truncate. DD. if you pass 12-APR1997 to a date function. you can use Y. YYY. MONTH SS. For example. if you pass 12-APR-1997 to a date function. or YYYY to specify 1997. Table 5-3 summarizes the format strings you can use to specify a part of a date: Table 5-3. where zero is 12 AM (midnight). YYY. Specify the part of the date you want to round.Date Format Strings You can evaluate input dates using a combination of format strings and date functions. You can use any of these format strings to specify the entire year portion of a date. Table 5-4 uses date functions with date format strings to evaluate input dates: Table 5-4. YY. if you pass the date 12-APR-1997 2:01:32 PM. or MONTH to specify APR. YY. RR Note: The format string is not case-sensitive. For example. Hour of day (0-23). you can use MM. YYYY. DAY. or HH24 to specify the hour portion of the date. DDD. This function returns an integer value based on the default date format. you can use HH. HH24 MI MM. MON. DY.

if you use 'RR' and pass the year 1997.M. ‘YY. D DD DDD DAY DY HH. It ignores the time component of the date. Table 5-5 summarizes the format strings for dates in the function TO_CHAR: Table 5-5. PM. where January to March equals 1.M.TO_CHAR Format Strings The TO_CHAR function converts a Date/Time datatype to a string with the format you specify. TO_CHAR is generally used when the target is a flat file or a database that does not support a Date/Time datatype. Seconds (00-59). Minutes (00-59). Hour of day (00-23). and is interchangeable with. Month (01-12). Modified Julian Day. where Sunday equals 1.. changing the format for reporting purposes. For example. including leap years). Jan). including up to nine characters (for example. TO_CHAR returns 97. ‘RR’ produces the same results as. calculated from Jan 1. Day of week (1-7). where 00 is 12AM (midnight). ‘RR’ calculates the closest appropriate century and supplies the first two digits of the year. Wed). Name of month. 4713 00:00:00 BC. For example. MI MM MONTH MON Q RR SS 40 Chapter 5: Dates . When used with TO_CHAR.M. Abbreviated three-character name for a day (for example. Hour of day (01-12). including up to nine characters (for example. P. You can convert the entire date or a part of the date to a string. Day of year (001-366. when used with TO_DATE.’ However. ‘J’ ) converts Dec 31 1999 23:59:59 to the string 2451544. the expression TO_CHAR( SHIP_DATE.M. AM and PM return the same values as do A. The function removes the leading digits. Day of month (01-31). Wednesday). Abbreviated three-character name for a month (for example. TO_CHAR Format Strings Format String AM. HH12 HH24 J Description Meridian indicator. January). A. Quarter of year (1-4). and P. You can use any of these format strings to specify AM and PM hours. Last two digits of a year. Converts the calendar date to a string equivalent to its Modified Julian Day value. You might use TO_CHAR to convert dates to string. Name of day.

Last digit of a year. and so on. TO_CHAR returns 97. 'MM.. if you use ‘Y’ and pass the year 1997. where week 1 starts on the first day of the month and ends on the seventh. where week 01 starts on Jan 1 and ends on Jan 7. When you use SSSSS in a TO_CHAR expression. you might create the following expression to separate date parts with a period: TO_CHAR( DATES.: "text" ““ Note: The format string is not case-sensitive. and YY format strings. Use double quotation marks to separate ambiguous format strings.DD. The function removes the leading digits. TO_CHAR returns 997. For example. week 2 starts on Jan 8 and ends on Jan 14. if you use 'YY' and pass the year 1997. Punctuation that displays in the output. TO_CHAR returns 7. if you use 'YYYY' and pass the year 1997. The function removes the leading digits.86399). the expression TO_CHAR( SHIP_DATE. if you create an output port with the expression: TO_CHAR( DATES. Week of year (01-53). TO_CHAR returns 1997. You might use these symbols to separate date parts. For example. Examples The following examples illustrate the J. For example. ‘MM/DD/YYYY SSSSS’) converts 12/31/1999 01:02:03 to 12/31/1999 03783. Last three digits of a year. Last two digits of a year. Note: The PowerCenter Server ignores the time portion of the date in a TO_CHAR expression.Table 5-5. RR. the function returns the string '04/01/1997 Sales Were Up'. For example. 'MM/DD/YYYY "Sales Were Up"' ) and pass the date Apr 1 1997. The empty quotation marks do not appear in the output. SSSSS. You can enter multibyte characters that are valid in the repository code page. week 2 starts on the eighth day and ends on the fourteenth day. Week of month (1-5). TO_CHAR Format Strings 41 . Entire year portion of date. for example D””DDD. TO_CHAR Format Strings Format String SSSSS Description Seconds since midnight (00000 . Feb 1 designates the first week of February. For example. For example. See the individual functions for more examples. For example. the PowerCenter Server only evaluates the time portion of a date.YYYY' ). For example. if you use 'YYY' and pass the year 1997. Y YY YYY YYYY W WW -/. Text that displays in the output. The function removes the leading digits. It must always be enclosed within single quotation marks.

‘MM/DD/YY’) SHIP_DATE 12/31/1999 01:02:03 09/15/1996 23:59:59 05/17/2003 12:13:14 RETURN_VALUE 12/31/99 09/15/96 05/17/03 42 Chapter 5: Dates . The following expression converts dates to strings in the format MM/DD/YY: TO_CHAR( SHIP_DATE. the YY format string produces the same results as the RR format string. the following expression converts the dates in the SHIP_DATE port to strings representing the total seconds since midnight: TO_CHAR( SHIP_DATE.J Format String You can use the J format string in a TO_CHAR expression to convert date values to MJD values expressed as strings. For example. 'J') SHIP_DATE RETURN_VALUE Dec 31 1999 23:59:59 2451544 Jan 1 1900 01:02:03 2415021 SSSSS Format String You can also use the format string SSSSS in a TO_CHAR expression. For example: TO_CHAR(SHIP_DATE. ‘MM/DD/RR’) SHIP_DATE 12/31/1999 01:02:03 09/15/1996 23:59:59 05/17/2003 12:13:14 RETURN_VALUE 12/31/99 09/15/96 05/17/03 YY Format String In TO_CHAR expressions. 'SSSSS') SHIP_DATE 12/31/1999 01:02:03 09/15/1996 23:59:59 RETURN_VALUE 3783 86399 RR Format String The following expression converts dates to strings in the format MM/DD/YY: TO_CHAR( SHIP_DATE.

Wednesday). If you omit the format string. Abbreviated three-character name for a day (for example. If a string does not match the specified format string or is not a valid date. p.m. use the format strings listed in the TO_DATE and IS_DATE Format Strings table to specify the date format. a. TO_DATE and IS_DATE Format Strings Format String AM. the function returns TRUE (1).TO_DATE and IS_DATE Format Strings The TO_DATE function converts a string with the format you specify to a date/time value. The DY format string is not case-sensitive. Table 5-6 summarizes the format strings for the functions TO_DATE and IS_DATE: Table 5-6. When you create a TO_DATE expression. Note: TO_DATE and IS_DATE use the same set of format strings. where zero is 12AM (midnight).m. use a format string for each part of the date in the source string. AM and PM return the same values as do a. A valid date is any string representing a valid date in the default date format of MM/DD/YYYY HH24:MI:SS. TO_DATE is generally used to convert strings from flat files to date/time values. TO_DATE and IS_DATE Format Strings 43 . IS_DATE tells you if a value is a valid date. Minutes (0-59). Hour of day (0-23). HH12 HH24 MI Description Meridian indicator. You can use any of these format strings to specify AM and PM hours. DD DDD DAY DY HH. Name of day. Day of month (1-31).. if any parts do not match. the PowerCenter Server does not convert the string and skips the row. Wed). and p.m. including leap years). TO_DATE format strings are not internationalized and must be entered in predefined formats as listed in the TO_DATE and IS_DATE Format Strings table. The DAY format string is not case-sensitive. If the strings you want to test are not in the default date format. the function returns FALSE (0). the source string must be in the default date format MM/DD/YYYY HH24:MI:SS.m. Day of year (001-366. including up to nine characters (for example. IS_DATE format strings are not internationalized and must be entered in predefined formats as listed in the following table. PM. If the string matches the format string and is a valid date. The source string format and the format string must match exactly including any date separators. Hour of day (1-12).

If you do not include a 44 Chapter 5: Dates . If the source string year is between 50 and 99. SS SSSSS J MM MONTH MON Y YY YYY YYYY Requirements The PowerCenter Server expects the format of the TO_DATE string to meet the following conditions: ♦ The format of the TO_DATE string must exactly match the format string including any date separators. assigning all dates the time of 00:00:00. if you pass the string ‘20200512’. Case does not matter. Do not use this format string if you are passing two-digit years. Aug). the PowerCenter Server might return inaccurate values or skip the row. For example. August). representing May 12.Table 5-6. the PowerCenter Server only evaluates the time portion of a date. the PowerCenter Server returns the current century plus the specified two-digit year. . The current year on the machine running the PowerCenter Server with the last three digits of the year replaced with the string value. Seconds (0-59). For example. The current year on the machine running the PowerCenter Server with the last digit of the year replaced with the string value. the expression TO_DATE(‘2451544’. Use the RR or YY format string instead. . The current year on the machine running the PowerCenter Server with the last two digits of the year replaced with the string value. Seconds since midnight. ‘MM/DD/YYYY SSSSS’) converts 12/31/1999 3783 to 12/31/1999 01:02:03.Current Year Between 50 and 99. Four digits of a year. the PowerCenter Server returns the next century plus the two-digit year from the source string. It ignores the time component of the source string. 2020. If the current year is between 50 and 99 (such as 1998) and the year value of the source string is between 0 and 49. 2034). 1998. Modified Julian Day.Current Year Between 0 and 49. When you use SSSSS in a TO_DATE expression. to TO_DATE. Use when source strings include two-digit years. Name of month. ‘J’ ) converts 2451544 to Dec 31 1999 00:00:00. the PowerCenter Server returns the current century plus the two-digit year from the source string. the PowerCenter Server returns the previous century plus the two-digit year from the source string. Convert strings in MJD format to date values. TO_DATE and IS_DATE Format Strings Format String RR Description Four-digit year (for example. Use with TO_DATE to convert two-digit years to four-digit years. including up to nine characters (for example. the expression TO_DATE( DATE_STR. you must include the format string YYYYMMDD. Abbreviated three-character name for a month (for example. If the year value of the source string is between 50 and 99. If it does not. Month (1-12). Case does not matter. If the current year is between 0 and 49 (such as 2003) and the source string year is between 0 and 49. For example.

For example. RR Format String The following expression converts a string into a four-digit year format. 'J') SHIP_DATE_MJD_STR 2451544 2415021 RETURN_VALUE Dec 31 1999 00:00:00 Jan 1 1900 00:00:00 Because the J format string does not include the time portion of a date. The format string is not case-sensitive. the PowerCenter Server expects the string in the default date format MM/ DD/YYYY HH24:MI:SS. the PowerCenter Server uses the format string MM/DD/YYYY HH24:MI:SS. Likewise. Example The following examples illustrate the J. the PowerCenter Server returns an error and skips the row because the string does not match the format string. the PowerCenter Server returns an error and skips the row. ‘MM/DD/RR’) DATE_STR 04/01/98 08/17/05 RETURN VALUE 04/01/1998 00:00:00 08/17/2005 00:00:00 YY Format String The following expression converts a string into a four-digit year format. if you pass the string 2020120 to TO_DATE and include the format string YYYYMMDD. See the individual functions for more examples. The current year is 1998: TO_DATE and IS_DATE Format Strings 45 . Tip: By default. if you pass a string that does not match the format string. The current year is 1998: TO_DATE( DATE_STR. and SSSSS format strings.format string. ♦ The format string must always be enclosed within single quotation marks. J Format String The following expression converts strings in the SHIP_DATE_MJD_STRING port to date values in the default date format: TO_DATE (SHIP_DATE_MJD_STR. the return values have the time set to 00:00:00. RR.

while YY returns the year 1905. RR returns the year 2005. ‘MM/DD/YY’) DATE_STR 04/01/98 08/17/05 RETURN VALUE 04/01/1998 00:00:00 08/17/1905 00:00:00 Note: For the second row. SSSSS Format String The following expression converts strings that include the seconds since midnight to date values: TO_DATE( DATE_STR.TO_DATE( DATE_STR. 'MM/DD/YYYY SSSSS') DATE_STR 12/31/1999 3783 09/15/1996 86399 RETURN_VALUE 12/31/1999 01:02:03 09/15/1996 23:59:59 46 Chapter 5: Dates .

You cannot use numeric arithmetic operators (such as + or -) to add or subtract dates. The transformation language recognizes leap years and accepts dates between Jan. 1753 00:00:00 AD and Dec. Change one part of a date. SET_DATE_PART. 9999 23:59:59 AD. Add or subtract a specific portion of a date. 31. You can only use the date functions on Date/Time values. 1. Subtract two dates. Note: The transformation language uses the transformation Date/Time datatype to specify date values. Understanding Date Arithmetic 47 . DATE_DIFF.Understanding Date Arithmetic The transformation language provides built-in date functions so you can perform arithmetic on date/time values as follows: ♦ ♦ ♦ ADD_TO_DATE.

48 Chapter 5: Dates .

49 . in alphabetical order.Chapter 6 Functions This chapter describes all the functions in the transformation languages. Each function description includes: ♦ ♦ ♦ Syntax Return value Example For a quick reference to these functions. see “Function Quick Reference” on page 215.

Use operators to perform arithmetic within the function. Calculate two or more aggregate values derived from the same source columns in a single pass. AVG COUNT FIRST LAST MAX (Date) MAX (Number) MEDIAN MIN (Date) MIN (Number) PERCENTILE STDDEV The transformation language includes the following aggregate functions: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ 50 Chapter 6: Functions . With aggregate functions you can: ♦ ♦ ♦ ♦ ♦ Calculate a single value for all rows in a group.Function Categories The transformation language provides the following types of functions: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ Aggregate Character Conversion Data Cleansing Date Numerical Scientific Special Test Variable Aggregate Functions Aggregate functions return summary values for non-null values in selected ports. Return a single value for each group in an Aggregator transformation. Apply filters to calculate values for specific rows in the selected ports.

evaluates the AVG expression. You can use aggregate functions in Aggregator transformations only. and returns four values. The PowerCenter Server will evaluate the innermost aggregate function expression. Function Categories 51 . The PowerCenter Server groups by ID. MIN and MAX return values according to the sort order of the code page you specify in the session properties.♦ ♦ SUM VARIANCE If you configure the PowerCenter Server to run in Unicode mode. Then it SUMS the four averages to get the result. and use the result to evaluate the outer aggregate function expression. You can set up an Aggregator transformation that groups by ID and nests two aggregate functions as follows: SUM( AVG( earnings ) ) where your dataset contains the following values: ID 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 EARNINGS 32 45 100 650 800 65 74 76 763 916 20 45 99 100 347 25 112 250 347 560 The return value is 1085. You can nest only one aggregate function within another aggregate function.

If the value rounds to zero. 1. the PowerCenter Server treats null values as NULL in aggregate functions. SALARY > 50000 ) You can also use other numeric values as the filter condition. FALSE. You can apply a filter condition to all aggregate functions. For example. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. the PowerCenter Server does not select the row. Character Functions The transformation language includes the following character functions: ♦ ♦ ♦ ♦ ♦ ♦ ASCII CHR CHRCODE CONCAT INITCAP INSTR 52 Chapter 6: Functions .Aggregate Functions and Nulls When you configure the PowerCenter Server. By default. the filter condition returns FALSE. and MOVINGSUM. Filter Conditions A filter limits the rows returned in a search.000: MEDIAN( SALARY. MOVINGAVG. including a numeric port: MEDIAN( PRICE. the PowerCenter Server rounds a decimal value to an integer (for example. you can choose how you want to handle null values in aggregate functions. the function returns NULL. you can enter the following as the complete syntax for the MEDIAN function. as well as to CUME. the following expression calculates the median salary for all employees who make more than $50.2 to 1. you can use the TRUNC function to truncate the value to an integer: MEDIAN( PRICE. or NULL. You can optionally configure the PowerCenter Server so that if you pass an entire port of null values to an aggregate function. For example. TRUNC( QUANTITY ) > 0 ) If you omit the filter condition. If you pass an entire port of null values. You can have the PowerCenter Server treat null values in aggregate functions as NULL or zero. If you do not want to round up a value. The filter condition must evaluate to TRUE. For more information on configuring the PowerCenter Server. If the filter condition evaluates to NULL or FALSE. 1.5 to 2. QUANTITY > 0 ) In all cases. You can enter any valid transformation expression. 0. the function selects all rows in the port. the function returns zero.35 to 0) for the filter condition.

LOWER. Trim string values. Conversion Functions The transformation language includes the following conversion functions: ♦ ♦ ♦ ♦ ♦ ♦ TO_CHAR(Date) TO_CHAR(Number) TO_DATE TO_DECIMAL TO_FLOAT TO_INTEGER Data Cleansing Functions The transformation language includes a group of functions to help you eliminate data errors. and INITCAP use the code page of the PowerCenter Server to evaluate character data. UPPER. MIN. Replace characters in a string. Encode strings. INSTR IS_DATE Function Categories 53 The transformation language includes the following data cleansing functions: ♦ ♦ .♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ LENGTH LOWER LPAD LTRIM METAPHONE REPLACECHR REPLACESTR RPAD RTRIM SOUNDEX SUBSTR UPPER The character functions MAX. Convert the datatype of an input value. With data cleansing functions you can: ♦ ♦ ♦ ♦ ♦ Test input value.

However. Date format strings are not internationalized. or perform arithmetic on a date. extract one part of a date. 54 Chapter 6: Functions . For a complete list of date format strings. You can pass any value with a date datatype to any of the date functions. truncate. The transformation language includes the following date functions: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ADD_TO_DATE DATE_COMPARE DATE_DIFF GET_DATE_PART LAST_DAY MAX MIN ROUND SET_DATE_PART TRUNC Several of the date functions include a format argument. you must first use the TO_DATE function to convert it to a transformation Date/Time datatype.♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ IS_NUMBER IS_SPACES ISNULL LTRIM METAPHONE REPLACECHR REPLACESTR RTRIM SOUNDEX SUBSTR TO_CHAR TO_DATE TO_DECIMAL TO_FLOAT TO_INTEGER Date Functions The transformation language includes a group of date functions to help you round. You must specify one of the transformation language format strings for this argument. if you want to pass a string to a date function. see “Dates” on page 33. or compare dates.

The Date/Time transformation datatype does not support milliseconds. Therefore. the PowerCenter Server truncates the millisecond portion of the date. if you pass a date with milliseconds. Numeric Functions The transformation language includes the following numeric functions: ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ABS CEIL CUME EXP FLOOR LN LOG MOD MOVINGAVG MOVINGSUM POWER ROUND SIGN SQRT TRUNC Scientific Functions The transformation language includes the following scientific functions: ♦ ♦ ♦ ♦ ♦ ♦ COS COSH SIN SINH TAN TANH Special Functions The transformation language includes the following special functions: ♦ ♦ ABORT DECODE Function Categories 55 .

You should use SetVariable function only once for each mapping variable in a pipeline. You can also nest a special function in an aggregate function. The PowerCenter Server calculates the minimum current value for the variable for each partition. it uses the saved value as the start value of the variable for the next time you use this session. When using mapping variables in sessions with multiple partitions. You can use the following variable functions: ♦ ♦ ♦ ♦ SetCountVariable SetMaxVariable SetMinVariable SetVariable You can use different variable functions with a variable based on the aggregation type of the variable. use variable functions to determine the final value of the variable for each partition. When you run a workflow. For example. When you create multiple partitions in a pipeline. You can nest other functions within special functions. and Update Strategy transformations.♦ ♦ ♦ ERROR IIF LOOKUP Generally. the PowerCenter Server uses multiple threads to 56 Chapter 6: Functions . Then at the end of the session. it finds the minimum current value across all partitions and saves that value into the repository. Test Functions The transformation language includes the following test functions: ♦ ♦ ♦ ♦ ISNULL IS_DATE IS_NUMBER IS_SPACES Variable Functions The transformation language includes a group of variable functions to help you update the current value of a mapping variable throughout the session. the PowerCenter Server evaluates the start and current value of a variable at the beginning of the session based on the final value of the variable from the last session run. you use SetMinVariable to set a variable to the minimum evaluated value. you use special functions in Expression. the PowerCenter Server performs the aggregate function across all partitions to determine one final value to save to the repository. Unless overridden. At the end of the session. Filter.

If you use this function more than once for the same variable. see “Pipeline Partitioning” in the Workflow Administration Guide. the current value of a mapping variable may have indeterministic results. For more information on mapping variables.process that pipeline. see “Mapping Parameters and Variables” in the Designer Guide. Function Categories 57 . For more information on mapping variables in sessions with multiple partitions.

The default value overrides the ERROR function in an expression. String. 58 Chapter 6: Functions . The string can be any length. You might use ABORT for input ports to keep null values from passing into a transformation. It processes any rows read before the session aborts and loads them based on the source. When the PowerCenter Server encounters an ABORT function. If you use ABORT in an expression for an unconnected port. The PowerCenter Server writes to the target up to the aborted row and then rolls back all uncommitted data to the last commit point. and issues a specified error message to the session log file. You can also use ABORT to handle any kind of transformation error. Note: The PowerCenter Server handles the ABORT function and the Abort command you issue from the Workflow Manager differently. If you want to ensure the session stops when an error occurs. you use ABORT within an IIF or DECODE function to set rules for aborting a session. the PowerCenter Server does not run the ABORT function. For more information on the Abort command. The message you want to display in the session log file when the session stops. You can use the ABORT function for both input and output port default values. see “Working with Workflows” and “Working with Sessions” in the Workflow Administration Guide. You can enter any valid transformation expression. You can use ABORT to validate data. it stops transforming data at that row. Syntax ABORT( string ) Argument string Meaning Required. assign ABORT as the default value. Return Value NULL.or target-based commit interval and the buffer block size defined for the session. including ERROR function calls within an expression. You can perform recovery on the session after rollback.ABORT Availability: Designer Stops the session. Generally.

You can enter any valid transformation expression. Syntax ABS( numeric_value ) Argument numeric_value Meaning Required. regardless of which number is larger: ABS( PRICE . ABS returns the same datatype as the numeric value passed as an argument. NULL if you pass a null value to the function. it returns a Double. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. Numeric datatype.95 59.ABS Availability: Designer Workflow Manager Returns the absolute value of a numeric value.COST ) PRICE 250 52 169. Example The following expression returns the difference between two numbers as a positive value.95 70 430 100 COST 150 48 69. if you pass an Integer.95 NULL 30 330 200 RETURN VALUE 100 4 100 NULL 40 100 100 ABS 59 . Likewise. Passes the values for which you want to return the absolute values. If you pass a Double. Note: If the return value is Decimal with precision greater than 15. it returns an Integer. Return Value Positive numeric value.

the expression ADD_TO_DATE( SHIP_DATE. and DAY. ADD_TO_DATE accepts positive and negative integer values. MONTH. For example. the expression ADD_TO_DATE ( SHIP_DATE. 10 ) adds 10 days to each date in the SHIP_DATE port. Day. 'MONTH'. You can use ADD_TO_DATE to change the following parts of a date: ♦ Year. Enter a positive or negative integer in the amount argument. the expression ADD_TO_DATE( SHIP_DATE. Hour. You can use any of the hour format strings: HH. and returns a date in the same format as the date you pass to the function. DY. 25 ) adds 25 minutes to each date in the SHIP_DATE port. For example. You can use any of the day format strings: D. Minute. HH12. 'DD'. 14 ) adds 14 hours to each date in the SHIP_DATE port. ♦ ♦ ♦ ♦ ♦ 60 Chapter 6: Functions . For example. DDD. 'HH'. DD. Enter a positive or negative integer in the amount argument. YYY. You use the MI format string to set the minute. the expression ADD_TO_DATE( SHIP_DATE. Month. Seconds. You use the SS format string to set the second. 10 ) adds 10 years to all dates in the SHIP_DATE port. HH24. For example. You can use any of the year format strings: Y. For example.ADD_TO_DATE Availability: Designer Workflow Manager Adds a specified amount to one part of a date/time value. MON. the expression ADD_TO_DATE( SHIP_DATE. 'SS'. Enter a positive or negative integer in the amount argument. For example. Enter a positive or negative integer in the amount argument. or YYYY. 'YY'. Enter a positive or negative integer in the amount argument. 'MI'. the expression ADD_TO_DATE( SHIP_DATE. Enter a positive or negative integer in the amount argument. You can use any of the month format strings: MM. -10 ) subtracts 10 months from each date in the SHIP_DATE port. 59 ) adds 59 seconds to each date in the SHIP_DATE port. YY.

For example. If you pass a value that creates a day that does not exist in a particular month. amount ) Argument date format Meaning Required. 1 ) ADD_TO_DATE( DATE_SHIPPED. Passes the values you want to change. the PowerCenter Server returns Feb 28 1998. 'mm'. Enclose the format string within single quotation marks. You can enter any valid transformation expression that evaluates to an integer.Syntax ADD_TO_DATE( date. months. 1 ) DATE_SHIPPED Jan 12 1998 12:00:30AM Jan 31 1998 6:24:45PM Jan 29 2000 5:32:12AM Oct 9 1998 2:30:12PM NULL RETURN VALUE Feb 12 1998 12:00:30AM Feb 28 1998 6:24:45PM Feb 29 2000 5:32:12AM Nov 9 1998 2:30:12PM NULL (Leap Year) ADD_TO_DATE 61 . Example The following expressions all add one month to each date in the DATE_SHIPPED port. Note that the format string is not case-sensitive. Required. hours. A format string specifying the portion of the date value you want to change. NULL if a null value is passed as an argument to the function. days. Also note. for example. 'MM'. amount Return Value Date in the same format as the date you pass to this function. 'MONTH'. ADD_TO_DATE recognizes leap years and adds one month to Jan 29 2000: ADD_TO_DATE( DATE_SHIPPED. 'MON'. Required. the PowerCenter Server returns the last day of the month. Date/Time datatype. and so on by which you want to change the date value. 1 ) ADD_TO_DATE( DATE_SHIPPED. format. An integer value specifying the amount of years. You can enter any valid transformation expression. if you add one month to Jan 31 1998.

If you pass a value that creates a day that does not exist in a particular month. which you specify. 'DDD'. the PowerCenter Server returns the last day of the month. 'HH24'. -10 ) ADD_TO_DATE( DATE_SHIPPED. -10 ) ADD_TO_DATE( DATE_SHIPPED. -10 ) ADD_TO_DATE( DATE_SHIPPED. -15 ) ADD_TO_DATE( DATE_SHIPPED. -10 ) DATE_SHIPPED Jan 1 1997 12:00:30AM Jan 31 1997 6:24:45PM Mar 9 1996 5:32:12AM Oct 9 1997 2:30:12PM Mar 3 1996 5:12:20AM NULL RETURN VALUE Dec 22 1996 12:00AM Jan 21 1997 6:24:45PM Feb 29 1996 5:32:12AM Sep 30 1997 2:30:12PM Feb 22 1996 5:12:20AM NULL (Leap Year) The following expressions subtract 15 hours from each date in the DATE_SHIPPED port: ADD_TO_DATE( DATE_SHIPPED. -15 ) ADD_TO_DATE( DATE_SHIPPED. the PowerCenter Server returns Feb 28 1998. -10 ) ADD_TO_DATE( DATE_SHIPPED. if you add one month to Jan 31 1998. ADD_TO_DATE changes only one portion of the date. you need to change the hour portion of the date. 'DY'. 'D'. If you modify a date so that it changes from standard to daylight savings time. ♦ ♦ ♦ 62 Chapter 6: Functions . 'HH'. You can nest TO_DATE to convert strings to dates. 'DAY'.The following expressions subtract 10 days from each date in the DATE_SHIPPED port: ADD_TO_DATE( DATE_SHIPPED. 'HH12'. For example. You can nest TRUNC and ROUND to help you manipulate dates. 'DD'. -15 ) DATE_SHIPPED Jan 1 1997 12:00:30AM Jan 31 1997 6:24:45PM Oct 9 1997 2:30:12PM Mar 3 1996 5:12:20AM Mar 1 1996 5:32:12AM NULL RETURN VALUE Dec 31 1996 9:00:30AM Jan 31 1997 3:24:45AM Oct 8 1997 11:30:12PM Mar 2 1996 2:12:20PM Feb 29 1996 2:32:12PM NULL (Leap Year) Working with Dates Use the following tips when working with ADD_TO_DATE: ♦ ♦ You can add or subtract any part of the date by specifying a format string and making the amount argument a positive or negative integer.

ASCII converts it to a character string and returns the ASCII or Unicode value of the first character in the string. you parse out the specific character you want to convert to an ASCII or Unicode value. but it evaluates only the first character in the string. You can pass a string of any size to ASCII. Character string. before you pass any string value to ASCII. This function is identical in behavior to the CHRCODE function. Passes the value you want to return as an ASCII value. The ASCII or Unicode value of the first character in the string. the ASCII function returns the numeric ASCII value of the first character of the string passed to the function. Syntax ASCII ( string ) Argument string Meaning Required. You can enter any valid transformation expression.ASCII Availability: Designer Workflow Manager When you configure the PowerCenter Server to run in ASCII mode. Informatica recommends using the CHRCODE function instead of the ASCII function to create new expressions. however. ASCII 63 . Return Value Integer. the ASCII function returns the numeric Unicode value of the first character of the string passed to the function. they will still work correctly. you might use RTRIM or another string-manipulation function to do this. When you configure the PowerCenter Server to run in Unicode mode. If you use ASCII in your existing expressions. If you pass a numeric value. Normally. For example. Unicode values fall in the range 0 to 65.535. NULL if a value passed to the function is NULL.

Example The following expression returns the ASCII or Unicode value for the first character of each value in the ITEMS port: ASCII( ITEMS ) ITEMS Flashlight Compass Safety Knife Depth/Pressure Gauge Regulator System RETURN VALUE 70 67 83 68 82 64 Chapter 6: Functions .

AVG
Availability: Designer

Returns the average of all values in a group of rows. Optionally, you can apply a filter to limit the rows you read to calculate the average. AVG is one of several aggregate functions. You can nest only one other aggregate function within AVG, and the nested function must return a Numeric datatype. You use aggregate functions in Aggregator transformations only. For more information, see “Aggregate Functions” on page 50.

Syntax
AVG( numeric_value [, filter_condition ] ) Argument numeric_value filter_condition Meaning Required. Numeric datatype. Passes the values for which you want to calculate an average. You can enter any valid transformation expression. Optional. Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value
Numeric value. NULL if all values passed to the function are NULL, or if no rows are selected. For example, the filter condition evaluates to FALSE or NULL for all rows.
Note: If the return value is decimal with precision greater than 15, you can enable high

precision in the session properties to ensure decimal precision up to 28 digits.

Nulls
If a value is NULL, AVG ignores the row. However, if all values passed from the port are NULL, AVG returns NULL.
Note: By default, the PowerCenter Server treats null values as NULLs in aggregate functions. If

you pass an entire port or group of null values, the function returns NULL. However, when you configure the PowerCenter Server, you can choose how you want to handle null values in aggregate functions. You can treat null values as zero in aggregate functions or as NULL. For more information on configuring the PowerCenter Server, see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide.

AVG

65

Group By
AVG groups values based on group by ports you define in the transformation, returning one result for each group. If there is not a group by port, AVG treats all rows as one group, returning one value.

Example
The following expression returns the average wholesale cost of flashlights:
AVG( WHOLESALE_COST, ITEM_NAME=’Flashlight’ ) ITEM_NAME Flashlight Navigation Compass Regulator System Flashlight Depth/Pressure Gauge Flashlight RETURN VALUE: 31.66 WHOLESALE_COST 35.00 8.05 150.00 29.00 88.00 31.00

Tip
You can perform arithmetic on the values passed to AVG before the function calculates the average. For example:
AVG( QTY * PRICE - DISCOUNT )

66

Chapter 6: Functions

CEIL
Availability: Designer Workflow Manager

Returns the smallest integer greater than or equal to the numeric value passed to this function. For example, if you pass 3.14 to CEIL, the function returns 4. If you pass 3.98 to CEIL, the function returns 4. Likewise, if you pass -3.17 to CEIL, the function returns -3.

Syntax
CEIL( numeric_value ) Argument numeric_value Meaning Required. Numeric datatype. You can enter any valid transformation expression.

Return Value
Integer if you pass a numeric value with declared precision between 0 and 28. Double value if you pass a numeric value with declared precision greater than 28. NULL if a value passed to the function is NULL.

Example
The following expression returns the price rounded to the next integer:
CEIL( PRICE ) PRICE 39.79 125.12 74.24 NULL -100.99 RETURN VALUE 40 126 75 NULL -100

Tip
You can perform arithmetic on the values passed to CEIL before CEIL returns the next integer value. For example, if you wanted to multiply a numeric value by 10 before you calculated the smallest integer less than the modified value, you might write the function as follows:
CEIL( PRICE * 10 )

CEIL

67

CHR
Availability: Designer Workflow Manager

When you configure the PowerCenter Server to move data in ASCII mode, CHR returns the ASCII character corresponding to the numeric value you pass to this function. ASCII values fall in the range 0 to 255. You can pass any integer to CHR, but only ASCII codes 32 to 126 are printable characters. When you configure the PowerCenter Server to move data in Unicode mode, CHR returns the Unicode character corresponding to the numeric value you pass to this function. Unicode values fall in the range 0 to 65,535.

Syntax
CHR( numeric_value ) Argument numeric_value Meaning Required. Numeric datatype. The value you want to return as an ASCII or Unicode character. You can enter any valid transformation expression.

Return Value
ASCII or Unicode character. A string containing one character. NULL if a value passed to the function is NULL.

Example
The following expression returns the ASCII or Unicode character for each numeric value in the ITEM_ID port:
CHR( ITEM_ID ) ITEM_ID 65 122 NULL 88 100 71 RETURN VALUE A z NULL X d G

68

Chapter 6: Functions

Use the CHR function to concatenate a single quote onto a string. The single quote is the only character that you cannot use inside a string literal. For example:
'Joan' || CHR(39) || 's car'

returns
Joan's car

CHR

69

CHRCODE converts it to a character string and returns the ASCII or Unicode value of the first character in the string. you parse out the specific character you want to convert to an ASCII or Unicode value. You can enter any valid transformation expression.CHRCODE Availability: Designer Workflow Manager When you configure the PowerCenter Server to run in ASCII mode. Informatica recommends using the CHRCODE function instead of the ASCII function to create new expressions. Return Value ASCII or Unicode character. it will still work correctly.535. 70 Chapter 6: Functions . ASCII values fall in the range 0 to 255. However. you might use RTRIM or another string-manipulation function to do this. Character string. A string containing one character. Syntax CHRCODE ( string ) Argument string Meaning Required. For example. If you pass a numeric value. before you pass any string value to CHRCODE. Normally. This function is identical in behavior to the ASCII function. CHRCODE returns the numeric ASCII value of the first character of the string passed to the function. Passes the values you want to return as ASCII or Unicode values. CHRCODE returns the numeric Unicode value of the first character of the string passed to the function. If you currently use ASCII in expressions. NULL if a value passed to the function is NULL. When you configure the PowerCenter Server to run in Unicode mode. Unicode values fall in the range 0 to 65.

Example The following expression returns the ASCII or Unicode value for the first character of each value in the ITEMS port: CHRCODE( ITEMS ) ITEMS Flashlight Compass Safety Knife Depth/Pressure Gauge Regulator System RETURN VALUE 70 67 83 68 82 CHRCODE 71 .

Using the || string operator instead of CONCAT improves PowerCenter Server performance when you run sessions. Required. LAST_NAME ) FIRST_NAME John NULL Bobbi Jason Dan LAST_NAME Baer Campbell Apperley Wood Covington RETURN VALUE JohnBaer Campbell BobbiApperley JasonWood DanCovington 72 Chapter 6: Functions . The first part of the string you want to concatenate. The second part of the string you want to concatenate. Any datatype (except Binary). Syntax CONCAT( first_string. NULL if both string values are NULL. CONCAT ignores it and returns the other string. Example The following expression concatenates the names in the FIRST_NAME and LAST_NAME ports: CONCAT( FIRST_NAME. You can enter any valid transformation expression. Nulls If one of the strings is NULL. Return Value String. second_string ) Argument first_string second_string Meaning Required. You can enter any valid transformation expression. CONCAT returns NULL. CONCAT converts all data to text before concatenating the strings. If both strings are NULL. Any datatype (except Binary).CONCAT Availability: Designer Workflow Manager Concatenates two strings. you can use the || string operator to concatenate strings. Alternatively.

CONCAT( CHR(39).FIRST_NAME Greg NULL 100 LAST_NAME NULL NULL 200 RETURN VALUE Greg NULL 100200 CONCAT does not add spaces to separate strings. For example. the following expression first concatenates a space on the end of the first name and then concatenates the last name: CONCAT( CONCAT( FIRST_NAME. For example: CONCAT( 'Joan'. The single quote is the only character you cannot use inside a string literal. you can write an expression with two nested CONCAT functions. LAST_NAME ) FIRST_NAME John NULL Bobbi Jason Dan Greg NULL LAST_NAME Baer Campbell Apperley Wood Covington NULL NULL RETURN VALUE John Baer Campbell (includes leading space) Bobbi Apperley Jason Wood Dan Covington Greg NULL Use the CHR and CONCAT functions to concatenate a single quote onto a string. 's car' )) returns Joan's car CONCAT 73 . If you want to add a space between two strings. ' ' ).

You can enter any valid transformation expression.COS Availability: Designer Workflow Manager Returns the cosine of a numeric value (expressed in radians). NULL if a value passed to the function is NULL. Return Value Double value. Numeric datatype.342020143325593 0.14159265359 / 180 ) DEGREES 0 90 70 30 5 18 89 NULL RETURN VALUE 1. you can convert the values in the port to radians before calculating the cosine.951056516295147 0. as follows: COS( ARCS * 3. For example.996194698091745 0.0 0.14159265359 / 180 ) 74 Chapter 6: Functions . Syntax COS( numeric_value ) Argument numeric_value Meaning Required.0174524064371813 NULL Tip You can perform arithmetic on the values passed to COS before the function calculates the cosine.0 0. Example The following expression returns the cosine for all values in the Degrees port: COS( DEGREES * 3. Passes the values for which you want to calculate a cosine. Numeric data expressed in radians (degrees multiplied by pi divided by 180).866025403784421 0.

0 2.66 5.54308063481524 9.345 NULL RETURN VALUE 1.897 3.381231106176 1.45 0 0.COSH Availability: Designer Workflow Manager Returns the hyperbolic cosine of a numeric value (expressed in radians).0 1.4435376920294 116. You can enter any valid transformation expression. Numeric data expressed in radians (degrees multiplied by pi divided by 180). For example: COSH( MEASURES. Numeric datatype. Return Value Double value. Passes the values for which you want to calculate the hyperbolic cosine. Syntax COSH( numeric_value ) Argument numeric_value Meaning Required.06010513656773 NULL Tip You can perform arithmetic on the values passed to COSH before the function calculates the hyperbolic cosine.0874465864177 19. Example The following expression returns the hyperbolic cosine for the values in the Angles port: COSH( ANGLES ) ANGLES 1.ARCS / 360 ) COSH 75 . NULL if a value passed to the function is NULL.

COUNT is one of several aggregate functions. the function returns NULL. Optional. when you configure the PowerCenter Server. this function counts all rows. The filter condition must be a numeric value or evaluate to TRUE. Syntax COUNT( value [. the function returns 0. Alternative.COUNT Availability: Designer Returns the number of rows that have non-null values in a group. For more information on configuring the PowerCenter Server. You can enter any valid transformation expression. regardless if a column in a row contains a null value. You can enter any valid transformation expression. For more information. this function ignores columns with null values. You can apply a condition to filter rows before counting them. Return Value Integer. Use to count all rows in a transformation. filter_condition] ) or COUNT( * [. filter_condition] ) Argument value * filter_condition Meaning Required. Passes the values you want to count. Any datatype (except Binary). Limits the rows in the search. You use aggregate functions in Aggregator transformations only. If you apply the value argument. If you apply the asterisk argument. see “Installing and Configuring the 76 Chapter 6: Functions . You can treat null values as zero in aggregate functions or as NULL. If you pass an entire port or group of null values. Nulls If all values are NULL. you can choose how you want to handle null values in aggregate functions. or NULL. Zero if all values passed to this function are NULL (unless you include the asterisk argument). However. You can nest only one other aggregate function within COUNT. you can include the asterisk (*) argument to count all input values in a transformation. the PowerCenter Server treats null values as NULLs in aggregate functions. Note: By default. see “Aggregate Functions” on page 50. Optionally. FALSE.

returning one result for each group. excluding null values: COUNT( ITEM_NAME. IN_STOCK < 5 ) ITEM_NAME Flashlight NULL Compass Regulator System Safety Knife Halogen Flashlight RETURN VALUE: 1 IN_STOCK 10 2 NULL 5 8 1 In this example. including null values. as illustrated in the following example: COUNT( *. If there is no group by port COUNT treats all rows as one group. returning one value. Example The following expression counts the items with less than 5 quantity in stock. QTY < 5 ) ITEM_NAME Flashlight NULL Compass Regulator System Safety Knife Halogen Flashlight RETURN VALUE: 2 QTY 10 2 NULL 5 8 1 COUNT 77 .PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. The function counts all rows in a transformation. the function counted the Halogen flashlight but not the NULL item. Group By COUNT groups values based on group by ports you define in the transformation.

For example: COUNT( * ) ITEM_NAME Flashlight NULL Compass Regulator System Safety Knife Halogen Flashlight RETURN VALUE: 6 QTY 10 2 NULL 5 8 1 78 Chapter 6: Functions .In this example. If you include the asterisk argument. but do not use a filter. the function counts the NULL item and the Halogen Flashlight. the function counts all rows that pass into the transformation.

CUME returns the running total for the previous row. or NULL. You can add a condition to filter rows out of the row set before calculating the running total. Numeric datatype. You can create a nested expression to calculate a running total based on the results of the function as long as the result is a numeric value. Note: If the return value is decimal with precision greater than 15. Nulls If a value is NULL. However. Optional. CUME 79 . You can enter any valid transformation expression.CUME Availability: Designer Returns a running total. the filter condition evaluates to FALSE or NULL for all rows). filter_condition Return Value Numeric value. A running total means CUME returns a total each time it adds a value. FALSE. Limits the rows in the search. NULL if all values passed to the function are NULL. The filter condition must be a numeric value or evaluate to TRUE. filter_condition] ) Argument numeric_value Meaning Required. or if no rows are selected (for example. if all values in the selected port are NULL. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. CUME returns NULL. You can enter any valid transformation expression. Passes the values for which you want to calculate a running total. Syntax CUME( numeric_value [. Use CUME and similar functions (such as MOVINGAVG and MOVINGSUM) to simplify reporting by calculating running values.

Example The following sample rowset might result from using the CUME function: CUME( PERSONAL_SALES ) PERSONAL_SALES 40000 80000 40000 60000 NULL 50000 RETURN VALUE 40000 120000 160000 220000 220000 270000 Likewise. you can add values before calculating a running total: CUME( CA_SALES + OR_SALES ) CA_SALES 40000 80000 40000 60000 NULL 50000 OR_SALES 10000 50000 2000 NULL NULL 3000 RETURN VALUE 50000 180000 222000 222000 222000 275000 80 Chapter 6: Functions .

Example The following expression compares each date in the DATE_PROMISED and DATE_SHIPPED ports. The first date you want to compare. Note that DATE_COMPARE returns an integer value rather than a date value. The second date you want to compare. You can enter any valid transformation expression as long as it evaluates to a date. and returns an integer indicating which date is earlier: DATE_COMPARE( DATE_PROMISED. You can enter any valid transformation expression as long as it evaluates to a date. Date/Time datatype. date2 ) Argument date1 date2 Meaning Required. Required. 0 if the two dates are equal. Return Value -1 if the first date is earlier.DATE_COMPARE Availability: Designer Workflow Manager Returns an integer indicating which of two dates is earlier. NULL if one of the date values is NULL. 1 if the second date is earlier. DATE_SHIPPED ) DATE_PROMISED Jan 1 1997 Feb 1 1997 Dec 22 1997 Feb 29 1996 NULL Jan 13 1997 DATE_SHIPPED Jan 13 1997 Feb 1 1997 Dec 15 1997 Apr 12 1996 Jan 6 1997 NULL RETURN VALUE -1 0 1 -1 NULL NULL (Leap year) DATE_COMPARE 81 . Date/Time datatype. Syntax DATE_COMPARE( date1.

DATE_DIFF Availability: Designer Workflow Manager Returns the length of time between two dates. Required. You can request the format to be years. Syntax DATE_DIFF( date1. the return value is a positive number. Return Value Double value. days. hours. You can enter any valid transformation expression. NULL if one (or both) of the date values is NULL. The PowerCenter Server subtracts the second date from the first date and returns the difference. hours. Passes the values for the first date you want to compare. months. the format string 'mm' is the same as 'MM'. Required. 'Mm' or 'mM'. minutes. Format string specifying the date or time measurement. minutes. If date1 is later than date2. months. Enclose the format strings within single quotation marks. or seconds. Date/Time datatype. days. For example. date2. You can specify only one part of the date. such as 'mm'. Date/Time datatype. Zero if the dates are the same. the return value is a negative number. You can specify years. You can enter any valid transformation expression. 82 Chapter 6: Functions . format ) Argument date1 date2 format Meaning Required. If date1 is earlier than date2. The format string is not case-sensitive. Passes the values for the second date you want to compare. or seconds.

5 87.925277777016 (Leap year) NULL NULL 6812.870486111147 DATE_DIFF 83 . DATE_SHIPPED.0 255. DATE_SHIPPED. 'HH' ) DATE_DIFF( DATE_PROMISED. 'HH24' ) DATE_PROMISED Jan 1 1997 12:00:00AM Mar 29 1997 12:00:00PM Mar 10 1996 6:10:45PM NULL Dec 10 1997 5:55:10PM Jun 3 1997 1:13:46PM DATE_SHIPPED Mar 29 1997 12:00:00PM Jan 1 1997 12:00:00AM Feb 29 1996 2:15:14AM Dec 10 1997 5:55:10PM NULL Aug 23 1996 4:20:16PM RETURN VALUE -2100. 'DY' ) DATE_DIFF( DATE_PROMISED.663553240709 (Leap year) NULL NULL 283.5 10. DATE_SHIPPED. 'DD' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED.0 2100. 'DDD' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED. 'HH12' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED.Example The following expressions return the number of hours between the DATE_PROMISED and DATE_SHIPPED ports: DATE_DIFF( DATE_PROMISED. 'DAY' ) DATE_PROMISED Jan 1 1997 12:00:00AM Mar 29 1997 12:00:00PM Mar 10 1996 6:10:45PM NULL Dec 10 1997 5:55:10PM Jun 3 1997 1:13:46PM DATE_SHIPPED Mar 29 1997 12:00:00PM Jan 1 1997 12:00:00AM Feb 29 1996 2:15:14AM Dec 10 1997 5:55:10PM NULL Aug 23 1996 4:20:16PM RETURN VALUE -87. DATE_SHIPPED. DATE_SHIPPED.89166666567 The following expressions return the number of days between the DATE_PROMISED and the DATE_SHIPPED ports: DATE_DIFF( DATE_PROMISED. 'D' ) DATE_DIFF( DATE_PROMISED.

DATE_SHIPPED.91935483870839 0. DATE_SHIPPED.0288334464133489 (Leap year) NULL NULL 0. 'Y' ) DATE_DIFF( DATE_PROMISED. 'MONTH' ) DATE_PROMISED Jan 1 1997 12:00:00AM Mar 29 1997 12:00:00PM Mar 10 1996 6:10:45PM NULL Dec 10 1997 5:55:10PM Jun 3 1997 1:13:46PM DATE_SHIPPED Mar 29 1997 12:00:00PM Jan 1 1997 12:00:00AM Feb 29 1996 2:15:14AM Dec 10 1997 5:55:10PM NULL Aug 23 1996 4:20:16PM RETURN VALUE -2. 'YYYY' ) DATE_PROMISED Jan 1 1997 12:00:00AM Mar 29 1997 12:00:00PM Mar 10 1996 6:10:45PM NULL Dec 10 1997 5:55:10PM Jun 3 1997 1:13:46PM DATE_SHIPPED Mar 29 1997 12:00:00PM Jan 1 1997 12:00:00AM Feb 29 1996 2:15:14AM Dec 10 1997 5:55:10PM NULL Aug 23 1996 4:20:16PM RETURN VALUE -0.35340409697164 The following expressions return the number of years between the DATE_PROMISED and DATE_SHIPPED ports: DATE_DIFF( DATE_PROMISED.91935483870839 2. 'MON' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED.243279569892366 0.779450341414304 84 Chapter 6: Functions . 'MM' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED. 'YY' ) DATE_DIFF( DATE_PROMISED.The following expressions return the number of months between the DATE_PROMISED and DATE_SHIPPED ports: DATE_DIFF( DATE_PROMISED. DATE_SHIPPED.243279569892366 0. DATE_SHIPPED. 'YYY' ) DATE_DIFF( DATE_PROMISED. DATE_SHIPPED.346001356960187 NULL NULL 9.

You can build an unlimited number of searches within a DECODE function. Any datatype (except Binary). result default Return Value First_result if the search finds a matching value. You can enter any valid transformation expression. NULL if you omit the default argument and the search does not find a matching value. The search value must match the value argument exactly. DECODE 85 . Syntax DECODE( value. Even if multiple conditions are met. If your data contains multibyte characters and your DECODE expression compares string data. Optional. The value you want to return if the search does not find a matching value. You can enter any valid transformation expression. Any value with the same datatype as the value argument. You can enter any valid transformation expression. you must enter 'Halogen Flashlight. Required. it returns a result value. first_result [.DECODE Availability: Designer Workflow Manager Searches a port for a value you specify. which you define. not just 'Halogen'. first_search. if you want to search for the string 'Halogen Flashlight' in a particular port. Passes the values for which you want to search. For example. the return value depends on the code page and data movement mode of the PowerCenter Server. Required. second_result]. Also note that the search value is case-sensitive. you may not search for a portion of a value. the PowerCenter Server returns the first matching result. Any datatype (except Binary).. If you enter 'Halogen'.[. The value you want to return if the search finds a matching value. Any datatype (except Binary). the search does not find a matching value. If you use DECODE to search for a value in a string port. You can enter any valid transformation expression. second_search. If the function finds the value. Default value if the search does not find a matching value.default] ) Argument value search Meaning Required. you can either trim trailing blanks with the RTRIM function or include the blanks in your search string. Passes the values you want to search..

‘Archimedes’. if at least one result is Double.414213562’. 20. 'Tank'. Example You might use DECODE in an expression that searches for a particular ITEM_ID and returns the ITEM_NAME: DECODE( ITEM_ID. 10. This expression always writes the result as a Decimal.141592654. 'Flashlight'. 40. the Designer writes the following error message: Function cannot resolve operands of ambiguously mismatching datatypes. you have the following expression: DECODE ( CONST_NAME ‘Five’. 5. 1. 14. and the other results are Decimal. The Decimal datatype has greater precision than Integer. The first result is an Integer. the following expression is invalid: DECODE ( CONST_NAME ‘Five’. ‘3. 1. the datatype of the return value is Double. When you run a session in high precision mode. 'Regulator'.414213562. ‘Archimedes’.414213562. and 3. 3. 'Knife'. ‘Pythagoras’. For example. 5. You cannot create a DECODE function with both string and numeric return values. 3. For example. ‘Pythagoras’.141592654 ) When you validate the expression above.DECODE and Datatypes When you use DECODE. ‘Pi’.141592654’. ‘Pi’.141592654.141592654 ) The return values in this expression are 5. ‘1. 3. the datatype of the return value is always the same as the datatype of the result with the greatest precision. 'NONE' ) ITEM_ID 10 14 17 20 25 NULL 40 RETURN VALUE Flashlight Regulator NONE Knife NONE NONE Tank 86 Chapter 6: Functions .

'. evaluated in a top to bottom order for TRUE or FALSE: DECODE( TRUE. desired ranges.'. DECODE 87 . Also. Var2 = 49. Var2 > 30. was more than 30. DECODE returns NONE for the NULL ITEM_ID. The following expression tests multiple columns and conditions. 'Variables Var1 21 22 23 24 25 Var2 47 49 49 27 50 'Variable 1 'Variable 2 'Variable 1 'Variable 2 were out of was 22!'.') RETURN VALUE Variable 1 was less than 23.Note that DECODE returns the default value of NONE for items 17 and 25 because the search values did not match the ITEM_ID. Variable 2 was more than 30. was less than 23. was 49!'. Var1 = 22. Var1 < 23. Variable 1 was 22! Variable 2 was 49! Variables were out of desired ranges.

You might use ERROR for input ports to keep null values from passing into a transformation. including ERROR function calls within an expression. assign ERROR as the default value. and you assign the default value. You can use the ERROR function for both input and output port default values. The error message displays in the session log file. The string can be any length. you use the ERROR function in an expression. see “Transformations” in the Designer Guide. The message you want to display when the PowerCenter Server skips a row based on the expression containing the ERROR function. For details about using default values. Syntax ERROR( string ) Argument string Meaning Required.ERROR Availability: Designer Causes the PowerCenter Server to skip a row and issue an error message. For example. the PowerCenter Server skips the row and logs both the error message from the expression and the error message from the default value. String value. If you want to ensure the PowerCenter Server skips rows that produce an error. ‘1234’. If you use an output default value other than ERROR. The PowerCenter Server does not write these skipped rows to the session reject file. You can use ERROR in Expression transformations to validate data. Use ERROR for output ports to handle any kind of transformation error. Generally. it overrides the error with the value ‘1234’ and passes ‘1234’ to the next transformation. which you define. and it does not log an error in the session log. the default value overrides the ERROR function in an expression. It does not skip the row. Each time the PowerCenter Server encounters the ERROR function in the expression. Return Value String value. you use ERROR within an IIF or DECODE function to set rules for skipping rows. When you use the ERROR function in an expression and in the output port default value. 88 Chapter 6: Functions . to the output port.

Negative salary found. EMP_SALARY ) SALARY 10000 -15000 NULL 150000 1005 RETURN VALUE 10000 'Error. The following expression nests the ERROR function in an IIF expression so that if the PowerCenter Server finds a negative salary in the Salary port. Negative salary found. but skip negative values. Row skipped.' NULL 150000 1005 ERROR 89 .'. it skips the row and displays an error: IIF( SALARY < 0. ERROR ('Error.Example The following example shows how to reference a mapping that calculates the average salary for employees in all departments of your company. Row skipped.

You can enter any valid transformation expression. Return Value Double value. The value to which you want to raise e. Numeric datatype. EXP is the reciprocal of the LN function.135335283236613 5166. For example. Example The following expression uses the values stored in the Numbers port as the exponent value: EXP( NUMBERS ) NUMBERS 10 -2 8.55 NULL RETURN VALUE 22026.754427176 NULL 90 Chapter 6: Functions . NULL if a value passed as an argument to the function is NULL. which returns the natural logarithm of a numeric value. Syntax EXP( exponent ) Argument exponent Meaning Required.38905609893065.71828183. EXP(2) returns 7. (The exponent in the equation e^value). where e=2.EXP Availability: Designer Workflow Manager Returns e raised to the specified power (exponent). rather than business data. You might use this function to analyze scientific and technical data.4657948067 0.

If you pass an entire port or group of null values. or NULL. For more information on configuring the PowerCenter Server. filter_condition ] ) Argument value filter_condition Meaning Required. You can treat null values as zero in aggregate functions or as NULL. the PowerCenter Server treats null values as NULLs in aggregate functions. you can apply a filter to limit the rows the PowerCenter Server reads. you can choose how you want to handle null values in aggregate functions. FIRST ignores the row. Nulls If a value is NULL. when you configure the PowerCenter Server. NULL if all values passed to the function are NULL. You can enter any valid transformation expression. FALSE. Optional. You use aggregate functions in Aggregator transformations only. For more information. the function returns NULL. FIRST is one of several aggregate functions. However.FIRST Availability: Designer Returns the first value found within a port or group. Note: By default. Syntax FIRST( value [. Any datatype (except Binary). see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. FIRST returns NULL. Optionally. see “Aggregate Functions” on page 50. Limits the rows in the search. However. if all values passed from the port are NULL. The filter condition must be a numeric value or evaluate to TRUE. You can nest only one other aggregate function within FIRST. You can enter any valid transformation expression. Passes the values for which you want to return the first value. the filter condition evaluates to FALSE or NULL for all rows). or if no rows are selected (for example. FIRST 91 . Return Value First value in a group.

00 31.Group By FIRST groups values based on group by ports you define in the transformation. ITEM_PRICE > 40 ) ITEM_NAME Flashlight Navigation Compass Regulator System Flashlight Depth/Pressure Gauge Flashlight RETURN VALUE: Regulator System ITEM_PRICE 35. ITEM_PRICE > 10 ) ITEM_NAME Flashlight Navigation Compass Regulator System Flashlight Depth/Pressure Gauge Flashlight RETURN VALUE: Flashlight ITEM_PRICE 35. returning one value.00 88.00 The following expression returns the first value in the ITEM_NAME port with a price greater than $40.05 150.05 150. If there is no group by port.00 29.00 8.00 29.00 8. Example The following expression returns the first value in the ITEM_NAME port with a price greater than $10. returning one result for each group.00 88.00: FIRST( ITEM_NAME.00 92 Chapter 6: Functions .00 31. FIRST treats all rows as one group.00: FIRST( ITEM_NAME.

Numeric datatype.24 NULL -100.FLOOR Availability: Designer Workflow Manager Returns the largest integer less than or equal to the numeric value you pass to this function.79 125.14 to FLOOR. For example. the function returns 3. the function returns -4.99 RETURN VALUE 39 125 74 NULL -101 Tip You can perform arithmetic on the values you pass to FLOOR.17 to FLOOR. Return Value Integer if you pass a numeric value with declared precision between 0 and 28. you might write the function as follows: FLOOR( UNIT_PRICE * 10 ) FLOOR 93 . Double if you pass a numeric value with declared precision greater than 28. You can enter any valid transformation expression as long as it evaluates to numeric data. For example. if you want to multiply a numeric value by 10 before you calculate the largest integer less than the modified value. Likewise. the function returns 3.98 to FLOOR.12 74. if you pass -3. Example The following expression returns the largest integer less than or equal to the values in the PRICE port: FLOOR( PRICE ) PRICE 39. Syntax FLOOR( numeric_value ) Argument numeric_value Meaning Required. NULL if a value passed to the function is NULL. If you pass 3. if you pass 3.

format ) Argument date format Meaning Required. You can enter any valid transformation expression. 'HH' ) GET_DATE_PART( DATE_SHIPPED. Each format string returns the entire part of the date based on the default format of MM/DD/YYYY HH24:MI:SS. Therefore. GET_DATE_PART returns 4. The format string is not case-sensitive. 'mm'. and pass a date such as Apr 1 1997 00:00:00. 'HH12' ) GET_DATE_PART( DATE_SHIPPED. 'YYY'. or 'YYYY' all return 1997. Example The following expressions return the hour for each date in the DATE_SHIPPED port. Syntax GET_DATE_PART( date. Required.GET_DATE_PART Availability: Designer Workflow Manager Returns the specified part of a date as an integer value. 'HH24' ) DATE_SHIPPED Mar 13 1997 12:00:00AM Sep 2 1997 2:00:01AM Aug 22 1997 12:00:00PM June 3 1997 11:30:44PM NULL RETURN VALUE 0 2 12 23 NULL 94 Chapter 6: Functions . Date/Time datatype. 'YY'. Return Value Integer representing the specified part of the date. if you pass the date Apr 1 1997 to GET_DATE_PART. For example. for example. NULL if a value passed to the function is NULL. A format string specifying the portion of the date value you want to change. the format strings 'Y'. Enclose format strings within single quotation marks. if you create an expression that returns the month portion of the date. Note that 12:00:00AM returns 0 because the default date format is based on the 24 hour interval: GET_DATE_PART( DATE_SHIPPED.

'MM' ) GET_DATE_PART( DATE_SHIPPED. 'DAY' ) DATE_SHIPPED Mar 13 1997 12:00:00AM June 3 1997 11:30:44PM Aug 22 1997 12:00:00PM NULL RETURN VALUE 13 3 22 NULL The following expressions return the month for each date in the DATE_SHIPPED port: GET_DATE_PART( DATE_SHIPPED. 'DDD' ) GET_DATE_PART( DATE_SHIPPED. 'D' ) GET_DATE_PART( DATE_SHIPPED. 'MON' ) GET_DATE_PART( DATE_SHIPPED. 'MONTH' ) DATE_SHIPPED Mar 13 1997 12:00:00AM June 3 1997 11:30:44PM NULL RETURN VALUE 3 6 NULL The following expression return the year for each date in the DATE_SHIPPED port: GET_DATE_PART( DATE_SHIPPED. 'YYYY' ) DATE_SHIPPED RETURN VALUE Mar 13 1997 12:00:00AM 1997 June 3 1997 11:30:44PM 1997 NULL NULL GET_DATE_PART 95 . 'DY' ) GET_DATE_PART( DATE_SHIPPED. 'Y' ) GET_DATE_PART( DATE_SHIPPED. 'YYY' ) GET_DATE_PART( DATE_SHIPPED. 'YY' ) GET_DATE_PART( DATE_SHIPPED. 'DD' ) GET_DATE_PART( DATE_SHIPPED.The following expressions return the day for each date in the DATE_SHIPPED port: GET_DATE_PART( DATE_SHIPPED.

For example. You can enter any valid transformation expression. Required. If you omit value2.value2] ) Argument condition value1 Meaning Required. value2 Unlike conditional functions in some systems. The condition you want to evaluate. value1 [. Syntax IIF( condition. including another IIF expression. You can enter any valid transformation expression.IIF Availability: Designer Workflow Manager Returns one of two values you specify. including another IIF expression. Any datatype (except Binary). The value you want to return if the condition is TRUE. The return value is always the datatype specified by this argument. the FALSE (value2) condition in the IIF function is not required. EMP_NAME ) SALES 150 50 120 NULL EMP_NAME John Smith Pierre Bleu Sally Green Greg Jones RETURN VALUE John Smith '' (empty string) Sally Green '' (empty string) 96 Chapter 6: Functions . You can enter any valid transformation expression that evaluates to TRUE or FALSE. The value you want to return if the condition is FALSE. the following expression does not include a FALSE condition and value1 is a string datatype so the PowerCenter Server returns an empty string for each row that evaluates to FALSE: IIF( SALES > 100. Optional. Empty string if value1 is a String datatype. the function returns the following when the condition is FALSE: ♦ ♦ ♦ 0 if value1 is a Numeric datatype. NULL if value1 is a Date/Time datatype. based on the results of a condition. Any datatype (except Binary).

--then return SALARY1 IIF 97 .Return Value value1 if the condition is TRUE. Special Uses of IIF You can use nested IIF statements to test multiple conditions. you have the following expression: IIF( SALES < 100. --then test to see if sales is between 1 and 49: IIF( SALES < 50. the datatype of the return value is the same as the datatype of the result with the greatest precision. BONUS))).3333 ) The TRUE result (1) is an integer and the FALSE result (. SALARY1. SALARY2. so the datatype of the return value is always a Decimal. the return value depends on the code page and data movement mode of the PowerCenter Server. For example. When you run a session in high precision mode and at least one result is Double. 0 ) You can make this logic more readable by adding comments: IIF( SALES > 0. IIF( SALES < 100. the following expression includes the FALSE condition NULL so the PowerCenter Server returns NULL for each row that evaluates to FALSE: IIF( SALES > 100. value2 if the condition is FALSE. EMP_NAME. The Decimal datatype has greater precision than Integer. SALARY3. For example. 1. NULL ) SALES 150 50 120 NULL EMP_NAME John Smith Pierre Bleu Sally Green Greg Jones RETURN VALUE John Smith NULL Sally Green NULL If your data contains multibyte characters and your condition argument compares string data. the datatype of the return value is Double. IIF( SALES < 50. The following example tests for various conditions and returns 0 if sales is zero or negative: IIF( SALES > 0. IIF( SALES < 200. .3333) is a decimal. IIF and Datatypes When you use IIF.

The following shows how you can use DECODE instead of IIF using the first example from the previous section: DECODE( TRUE. For example: IIF( ISNULL( ITEM_NAME ). --else test to see if sales is between 100 and 199: IIF( SALES < 200. --then return SALARY2. SALES > 49 AND SALES < 100. DECODE may improve readability. BONUS) You can often use a Filter transformation instead of IIF to maximize session performance. return BONUS) ) ). --else for sales over 199. SALES > 199. 98 Chapter 6: Functions . For more information. DD_REJECT. SALES > 0 and SALES < 50. DD_INSERT) Alternative to IIF You can use DECODE instead of IIF in many cases. --then return SALARY3. --else for sales less than or equal to zero. see “Filter Transformation” in the Transformation Guide. SALARY2. SALARY3.SALARY1. SALARY1. return 0) You can use IIF in update strategies. --else test to see if sales is between 50 and 99: IIF( SALES < 100. SALES > 99 AND SALES < 200.

For example. Syntax INITCAP( string ) Argument string Meaning Required. Words are delimited by white space (a blank space. Return Value String. INITCAP( FIRST_NAME ) FIRST_NAME ramona 18-albert NULL ?!SAM THOMAS PierRe RETURN VALUE Ramona 18-Albert NULL ?!Sam Thomas Pierre INITCAP 99 . the function returns Thomas. or vertical tab) and characters that are not alphanumeric. NULL if a value passed to the function is NULL. carriage return. tab. Any datatype (except Binary). You can enter any valid transformation expression. formfeed. newline. the return value depends on the code page and data movement mode of the PowerCenter Server.INITCAP Availability: Designer Workflow Manager Capitalizes the first letter in each word of a string and converts all other letters to lowercase. if you pass the string ‘…THOMAS’. Example The following expression capitalizes all names in the FIRST_NAME port. If your data contains multibyte characters.

For example. Any value. meaning that INSTR searches for the first occurrence of the search value. If the start position is zero. The search_value must match a part of the string exactly.start [. The default value is 1. the function uses the default value of 1. if you write INSTR('Alfred Pope'. the function uses the default value of 1. You can enter any valid transformation expression. If you want to search for a character string. For example. If you omit this argument. If you pass a decimal. If you omit this argument. counting from left to right. the mapping fails when you run a workflow. You can enter any valid transformation expression. If the start position is a positive number. search_value start occurrence Return Value Integer if the search is successful. search_value [. The set of characters you want to search for. Integer represents the position of the first character in the search_value. you can specify which occurrence you want to search for. You can enter any valid transformation expression. you would enter 2 to search for the second occurrence from the start position. A positive integer greater than zero. INSTR locates the start position by counting from the beginning of the string. The position in the string where you want to start the search. the PowerCenter Server rounds it to the nearest integer value. Optional. INSTR searches from the first character in the string. meaning that INSTR starts the search at the first character in the string. Required. The search value is case-sensitive. The results of the expression must be a character string. Passes the value you want to evaluate. The string must be a character string. You can enter any valid transformation expression. INSTR converts the value to a string before evaluating it. 'Alfred Smith') the function returns zero. If the start position is a negative number. NULL if a value passed to the function is NULL. for example 'abc'. Syntax INSTR( string. Optional.occurrence]] ) Argument string Meaning Required. enclose the characters you want to search for in single quotation marks. If the search value appears more than once in the string. Zero if the search is unsuccessful. if not. INSTR locates the start position by counting from the end of the string. If you pass a negative integer or zero. counting from left to right. Must be an integer value.INSTR Availability: Designer Workflow Manager Returns the position of a character set in a string. 100 Chapter 6: Functions .

it skips the ‘A’ in 'Blue Fin Aqua Center’. starting from the last character in the company name. 2 ) COMPANY Blue Fin Aqua Center Maco Shark Shop Scuba Gear Frank’s Dive Shop VIP Diving Club RETURN VALUE 0 2 5 0 0 INSTR 101 . Because the search_value argument is case-sensitive. Because the search_value argument is casesensitive. starting at the beginning of each company name. and returns the position for the ‘a’ in ‘Aqua’: INSTR( COMPANY. it skips the ‘A’ in ‘Blue Fin Aqua Center’. 2 ) COMPANY Blue Fin Aqua Center Maco Shark Shop Scuba Gear Frank’s Dive Shop VIP Diving Club RETURN VALUE 0 8 9 0 0 The following expression returns the position of the second occurrence of the letter ‘a’ in each company name.Example The following expression returns the position of the first occurrence of the letter ‘a’. 'a' ) COMPANY Blue Fin Aqua Center Maco Shark Shop Scuba Gear Frank’s Dive Shop VIP Diving Club RETURN VALUE 13 2 5 3 0 The following expression returns the position of the second occurrence of the letter ‘a’. starting at the beginning of each company name. and returns 0: INSTR( COMPANY. 'a'. 1. it skips the ‘A’ in ‘Blue Fin Aqua Center’. and returns 0: INSTR( COMPANY. 'a'. Because the search_value argument is case-sensitive. -1.

-1. starting from the end of the string. '#')+1 ) CUST_ID ID#33 #A3577 SS #712403399 RETURN VALUE ID33 A3577 SS 712403399 102 Chapter 6: Functions . The following expression evaluates a string.INSTR( CUST_NAME.1 )) CUST_NAME PATRICIA JONES MARY ELLEN SHAH RETURN VALUE PATRICIA MARY ELLEN The following expression strips out the character '#' from a string: SUBSTR( CUST_ID. INSTR(CUST_ID.1. The expression finds the last (rightmost) space in the string and then returns all characters to the left of it: SUBSTR( CUST_NAME.' ' . '#')-1 ) || SUBSTR( CUST_ID. 1.-1.The following expression returns the position of the first character in the string ‘Blue Fin Aqua Center’ (starting from the last character in the company name): INSTR( COMPANY. 1 ) COMPANY Blue Fin Aqua Center Maco Shark Shop Scuba Gear Frank’s Dive Shop VIP Diving Club RETURN VALUE 1 0 0 0 0 Using Nested INSTR You can nest the INSTR function within other functions to accomplish more complex tasks. INSTR(CUST_ID. 'Blue Fin Aqua Center'.

You can enter any valid transformation expression. ISNULL evaluates an empty string as FALSE. Passes the rows you want to evaluate. FALSE (0) if the value is not NULL. see “LENGTH” on page 115.ISNULL Availability: Designer Workflow Manager Returns whether a value is NULL. use LENGTH. For more information. Syntax ISNULL( value ) Argument value Meaning Required. Note: To test for empty strings. Any datatype (except Binary). Return Value TRUE (1) if the value is NULL. Example The following example checks for null values in the items table: ISNULL( ITEM_NAME ) ITEM_NAME Flashlight NULL Regulator system ‘’ RETURN VALUE 0 (FALSE) 1 (TRUE) 0 (FALSE) 0 (FALSE) Empty string is not NULL ISNULL 103 .

Syntax IS_DATE( value [. so there is no February 29th. Passes the rows you want to evaluate. If the strings you want to test are not in the default date format. Return Value TRUE (1) if the row is a valid date. the string value must be in the default date of MM/DD/YYYY HH24:MI:SS. IS_DATE evaluates strings and returns an integer value. ‘YY’) is internally computed as IS_DATE(02/29/1900 00:00:00). Informatica recommends using the RR format string with IS_DATE. which returns TRUE. For example. A valid date is any string in the default date format of MM/DD/YYYY HH24:MI:SS. but there are some unique cases where YY returns incorrect results. You might use IS_DATE to test or filter data in a flat file before writing it to a target. For example. use the TO_DATE format strings to specify the date format. the function returns FALSE (0). However. you must use the format string 'MON DD YYYY HH12:MI:SSAM'. year 1900 is not a leap year.format] ) Argument value format Meaning Required. In the first case. the function returns TRUE (1). The format string must match the parts of the string argument exactly.IS_DATE Availability: Designer Workflow Manager Returns whether a string value is a valid date. the PowerCenter Server computes the expression IS_DATE(‘02/29/00’. Optional. the expression IS_DATE(‘02/29/00’. If the strings passed to IS_DATE do not match the format string specified. Enter a valid TO_DATE format string. In most cases. ‘RR’) as IS_DATE(02/29/2000 00:00:00). 104 Chapter 6: Functions . Must be a string datatype. the two format strings return the same values. Note: IS_DATE uses the same format strings as TO_DATE. FALSE (0) if the row is not a valid date. NULL if a value in the expression is NULL or if the format string is NULL. which returns false. The output port for an IS_DATE expression must be String or Numeric datatype. If you omit the format string. You can enter any valid transformation expression. If the strings match the format string. if you pass the string 'Mar 15 1997 12:43:10AM'. not the YY format string.

and converts each valid date to a date value. IS_DATE 105 . IS_DATE returns FALSE: INVOICE_DATE NULL ‘180’ ‘04/01/98’ ‘1998/01/12’ ‘1998/11/21 00:00:13’ ‘1998/02/31’ ‘John Smith’ RETURN VALUE NULL 0 (FALSE) 0 (FALSE) 1 (TRUE) 0 (FALSE) 0 (FALSE) 0 (FALSE) (February does not have 31 days) The following example shows how you can use IS_DATE to test data before using TO_DATE to convert the strings to dates. This expression checks the values in the INVOICE_DATE port. ‘YYYY/MM/DD’ ) If the string value does not match this format. If the value is not a valid date. If it does not. the PowerCenter Server returns ERROR and skips the row.Warning: The format of the IS_DATE string must exactly match the format string including any date separators. Example The following expression checks the INVOICE_DATE port for valid dates: IS_DATE( INVOICE_DATE ) This expression returns data similar to the following: INVOICE_DATE NULL ‘180’ ‘04/01/98’ ‘04/01/1998 00:12:15’ ‘02/31/1998 12:13:55’ ‘John Smith’ RETURN VALUE NULL 0 (FALSE) 0 (FALSE) 1 (TRUE) 0 (FALSE) 0 (FALSE) (February does not have 31 days ) The following IS_DATE expression specifies a format string of ‘YYYY/MM/DD’: IS_DATE( INVOICE_DATE. the PowerCenter Server might return inaccurate values or skip the record.

‘YYYY/MM/DD’ ). the output port for the expression needs to be Date/Time: IIF( IS_DATE ( INVOICE_DATE.Note that this example returns a Date/Time value. Therefore. TO_DATE( INVOICE_DATE ). ERROR(‘Not a valid date’ ) ) INVOICE_DATE NULL ‘180’ ‘04/01/98’ ‘1998/01/12’ ‘1998/11/21 00:00:13’ ‘1998/02/31’ ‘John Smith’ RETURN VALUE NULL ‘Not a valid date’ ‘Not a valid date’ 1998/01/12 ‘Not a valid date’ ‘Not a valid date’ ‘Not a valid date’ 106 Chapter 6: Functions .

45e+32’ ‘+3. Syntax IS_NUMBER( value ) Argument value Meaning Required.45D-32’ (Windows only) ‘.IS_NUMBER Availability: Designer Workflow Manager Returns whether a string is a valid number.45d+32’ (Windows only) ‘+3.6804’ The output port for an IS_NUMBER expression must be a String or Numeric datatype. Return Value TRUE (1) if the row is a valid number. IS_NUMBER 107 .45E-32’ ‘+3. FALSE (0) if the row is not a valid number. Must be a string datatype. Passes the rows you want to evaluate. followed by one or more digits Optional white space following the number The following numbers are all valid: ‘ 100 ‘ ’ +100’ ‘-100’ ‘-3. A valid number consists of the following parts: ♦ ♦ ♦ ♦ ♦ Optional space before the number Optional sign (+/-) One or more digits with an optional decimal point Optional scientific notation. such as the letter ‘e’ or ‘E’ (and the letter ‘d’ or ‘D’ on Windows) followed by an optional sign (+/-). You might use IS_NUMBER to test or filter data in a flat file before writing it to a target. You can enter any valid transformation expression.

0. If the value is not a valid number. TO_FLOAT( ITEM_PRICE ).45e+3’ ‘3.45E-3’ ‘ ‘’ ‘+123abc’ ‘ 123ABC’ ’ RETURN VALUE 123 -3450 0.00 NULL Consists entirely of whitespace Empty string ‘ABC’ ‘-ABC’ NULL 108 Chapter 6: Functions .00 0.00: IIF( IS_NUMBER ( ITEM_PRICE ).Windows only) 0 (False . Example The following expression checks the ITEM_PRICE port for valid numbers: IS_NUMBER( ITEM_PRICE ) ITEM_PRICE ‘123. the PowerCenter Server returns 0.00 0.UNIX only) 0 (False) 0 (False) 0 (False) 0 (False) 1 (True) 1 (True) 0 (False) 0 (False) NULL Incomplete number Consists entirely of whitespace Empty string Leading whitespace Trailing whitespace ‘123 ‘ABC’ ‘-ABC’ NULL You can use IS_NUMBER to test data before using one of the numeric conversion functions.00345 0.NULL if a value in the expression is NULL. such as TO_FLOAT. and converts each valid number to a double-precision floating point value.45E-’ ‘ ‘’ ‘+123abc’ ‘ 123’ ‘ ’ RETURN VALUE 1 (True) 1 (True) 1 (True .00 0.00 0. the following expression checks the values in the ITEM_PRICE port.00’ ‘-3.00 0. For example.00 ) ITEM_PRICE ‘123.45d-3’ ‘3.45e+3’ ‘-3.00’ ‘-3.45D-3’ ‘-3.

if you have a transformation that writes customer names to a fixed length CHAR(5) IS_SPACES 109 . For example. a newline.IS_SPACES Availability: Designer Workflow Manager Returns whether a string value consists entirely of spaces. To test for an empty string. Return Value TRUE (1) if the row consists entirely of spaces.) Tip You can use IS_SPACES to avoid writing spaces to a character column in a target table. Syntax IS_SPACES( value ) Argument value Meaning Required. or a vertical tab. see “LENGTH” on page 115. A space is a blank space. For more information. a carriage return. Example The following expression checks the ITEM_NAME port for rows that consist entirely of spaces: IS_SPACES( ITEM_NAME ) ITEM_NAME Flashlight RETURN VALUE 0 (False) 1 (True) Regulator system NULL ‘’ 0 (False) NULL 0 (FALSE) (Empty string does not contain spaces. use LENGTH. IS_SPACES evaluates an empty string as FALSE because there are no spaces. Must be a string datatype. a formfeed. a tab. Passes the rows you want to evaluate. NULL if a value in the expression is NULL. You can enter any valid transformation expression. FALSE (0) if the row contains data.

'00000'. you might want to write ‘00000’ instead of spaces. CUST_NAMES ) 110 Chapter 6: Functions . you create an expression similar to the following: IIF( IS_SPACES( CUST_NAMES ). To do this.column in a target table.

you can apply a filter to limit the rows the PowerCenter Server reads. LAST 111 . the function returns NULL. You can enter any valid transformation expression. filter_condition ] ) Argument value filter_condition Meaning Required. The filter condition must be a numeric value or evaluate to TRUE. You can nest only one other aggregate function within LAST. Optionally. Syntax LAST( value [. or if no rows are selected (for example. If you pass an entire port or group of null values. For more information. LAST is one of several aggregate functions. Passes the values for which you want to return the last row. NULL if all values passed to the function are NULL. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. Any datatype (except Binary). the PowerCenter Server treats null values as NULLs in aggregate functions. Optional.LAST Availability: Designer Returns the last row in the selected port. For more information on configuring the PowerCenter Server. the filter condition evaluates to FALSE or NULL for all rows). Return Value Last row in a port. Note: By default. you can choose how you want to handle null values in aggregate functions. Limits the rows in the search. You can treat null values as zero in aggregate functions or as NULL. However. see “Aggregate Functions” on page 50. when you configure the PowerCenter Server. You use aggregate functions in Aggregator transformations only. or NULL. FALSE. You can enter any valid transformation expression.

ITEM_PRICE > 10 ) ITEM_NAME Flashlight Navigation Compass Regulator System Flashlight ITEM_PRICE 35.00 8.00 112 Chapter 6: Functions .Example The following expression returns the last row in the ITEMS_NAME port with a price greater than $10.00: LAST( ITEM_NAME.00 29.05 150.00 Vest RETURN VALUE: Vest 31.00 Depth/Pressure Gauge 88.

The last day of the month for that date value you pass to this function. LAST_DAY treats all rows as one group. If there is no group by port. However. returning one result for each group. Passes the dates for which you want to return the last day of the month.LAST_DAY Availability: Designer Workflow Manager Returns the date of the last day of the month for each date in a port. LAST_DAY ignores the row. if all values passed from the port are NULL. Null If a value is NULL. Date/Time datatype. You can enter any valid transformation expression that evaluates to a date. Group By LAST_DAY groups values based on group by ports you define in the transformation. NULL if a value in the selected port is NULL. Return Value Date. LAST_DAY returns NULL. Example The following expression returns the last day of the month for each date in the ORDER_DATE port: LAST_DAY( ORDER_DATE ) ORDER_DATE Apr 1 1998 12:00:00AM Jan 6 1998 12:00:00AM Feb 2 1996 12:00:00AM NULL Jul 31 1998 12:00:00AM RETURN VALUE Apr 30 1998 12:00:00AM Jan 31 1998 12:00:00AM Feb 29 1996 12:00:00AM NULL Jul 31 1998 12:00:00AM (Leap year) LAST_DAY 113 . returning one value. Syntax LAST_DAY( date ) Argument date Meaning Required.

the date returned will include the time 00:00:00. The following example returns the last day of the month for each order date in the same format as the string: LAST_DAY( TO_DATE( ORDER_DATE. If you pass a string that does not have a time value.You can nest TO_DATE to convert string values to a date. TO_DATE always includes time information. 'DD-MON-YY' )) ORDER_DATE '18-NOV-98' '28-APR-98' NULL '18-FEB-96' RETURN VALUE Nov 30 1998 00:00:00 Apr 30 1998 00:00:00 NULL Feb 29 1996 00:00:00 (Leap year) 114 Chapter 6: Functions .

If you want to find fields in which customer name is empty. To test for spaces. see “IS_SPACES” on page 109. For details. use an expression such as: IIF( LENGTH( CUSTOMER_NAME ) = 0. ‘EMPTY STRING’ ) To test for a null field. NULL if a value passed to the function is NULL. use IS_SPACES. see “ISNULL” on page 103. The strings you want to evaluate.LENGTH Availability: Designer Workflow Manager Returns the number of characters in a string. You can enter any valid transformation expression. LENGTH 115 . Syntax LENGTH( string ) Argument string Meaning Required. Return Value Integer representing the length of the string. use ISNULL. including trailing blanks. String datatype. For details. Example The following expression returns the length of each customer name: LENGTH( CUSTOMER_NAME ) CUSTOMER_NAME Bernice Davis NULL John Baer Greg Brown RETURN VALUE 13 NULL 9 10 Tips You can use LENGTH to test for empty string conditions.

302585092994 4.098612.LN Availability: Designer Workflow Manager Returns the natural logarithm of a numeric value. You usually use this function to analyze scientific data rather than business data.) Note: The PowerCenter Server displays an error and does not write the row when you pass a negative number or zero. (The PowerCenter Server does not write row. It must be a positive number. LN(3)returns 1. This function is the reciprocal of the function EXP. 116 Chapter 6: Functions . Syntax LN( numeric_value ) Argument numeric_value Meaning Required. NULL if a value passed to the function is NULL. Return Value Double value. Numeric datatype.) Error. For example. You can enter any valid transformation expression.04082199452026 NULL Error. Example The following expression returns the natural logarithm for all values in the NUMBERS port: LN( NUMBERS ) NUMBERS 10 125 0. The numeric_value must be a positive number greater than zero.828313737302 -0. (The PowerCenter Server does not write row. greater than zero. Passes the values for which you want to calculate the natural logarithm.96 NULL -90 0 RETURN VALUE 2.

) Error. Must be a positive numeric value other than 0 or 1.LOG Availability: Designer Workflow Manager Returns the logarithm of a numeric value. (PowerCenter Server does not write the row. exponent ) Argument base Meaning Required. The base of the logarithm. or if you pass a negative value for the exponent. Any valid transformation expression that evaluates to a positive number other than 0 or 1. Most often. you use this function to analyze scientific data rather than business data.) Note that the PowerCenter Server displays an error and does not write the row if you pass a negative number. Any valid transformation expression that evaluates to a positive number greater than 0.09 NULL 35. or 1 as a base value. Must be a positive numeric value greater than 0. (PowerCenter Server does not write the row.) Error. Required. zero. Example The following expression returns the logarithm for all values in the NUMBERS port: LOG( BASE.78 -9 0 10 EXPONENT 1 10 18 NULL 18 5 -2 RETURN VALUE 0 -0. EXPONENT ) BASE 15 . Syntax LOG( base. LOG 117 .956244644696599 NULL NULL Error. NULL if a value passed to the function is NULL. (PowerCenter Server does not write the row. exponent Return Value Double value. The exponent of the logarithm.

The LOOKUP function compares data in a lookup source to a value you specify. For more information. Required. Datatype that matches the value1. The values you want to search for in the lookup source column specified in search1.5 users who want to continue using the LOOKUP function..LOOKUP Availability: Designer Searches for a value in a lookup source column. must match search1 datatype. If you use the LOOKUP function in a mapping. Any datatype (except Binary). This option exists expressly for PowerMart 3. However. When you create a session based on a mapping that uses the LOOKUP function. search1. Any datatype (except Binary). each search must find a matching value to return the lookup value. Must be an output port in the same lookup table as result. search2. Specifies the values you want to match to value. rather than creating Lookup transformations. Syntax LOOKUP( result. You can enter any valid transformation expression. You can define multiple searches for one lookup table within a LOOKUP function. you must specify the database connections for $Source Connection Value and $Target Connection Value in the session properties. value1 [. see “Lookup Transformation” in the Transformation Guide. Required. search1 value1 118 Chapter 6: Functions . value2]. Using the Lookup Transformation or the LOOKUP Function Informatica recommends using the Lookup transformation rather than the LOOKUP function to look up values in PowerCenter mappings.. Specifies the return value if the search matches the value. Must be an output port in the same lookup table as search. Always preface this argument with the reference qualifier :TD. Always preface this argument with the reference qualifier :TD. it returns the value from a specified column in the same row in the lookup table.5 compatibility in the session properties. Note: This function is not supported in mapplets. ) Argument result Meaning Required. you need to enable the lookup caching option for 3. When the PowerCenter Server finds the search value in the lookup table.

ITEM. 15.ITEM_ID. RTRIM( ORDERS. Example The following expression searches the lookup source :TD. This means that both the value and the length for each row must match.99 Tips When you compare char and varchar values.SALES. ORDERS. :TD.99 ) ITEM_NAME Regulator Flashlight Halogen Flashlight NULL RETURN VALUE: Flashlight ITEM_ID 5 10 15 20 PRICE 100.PRICE.00 15. :TD. If your lookup source is a padded char value of a specified length and your lookup search is a varchar value.ITEM. If the PowerCenter Server finds matching values.SALES.ORDERS.SALES for a specific item ID and price.99 15.PRICE.ORDERS. the LOOKUP function returns a result only if the two rows match exactly. Error if the search finds more than one matching value.PRICE.ORDERS.ITEM_NAME. and returns the item name if both searches find a match: LOOKUP( :TD. :TD. 10. you need to use the RTRIM function to trim the trailing spaces from the lookup source so that the values match the lookup search: LOOKUP(:TD.QTY. :TD. :TD. it returns the result from the same row as the search1 argument. NULL if the search does not find any matching values.PRICE.ORDERS. ' ')) Use the :TD reference qualifier in the result and search arguments of a LOOKUP function: LOOKUP(:TD.SALES.99 15.Return Value Result if all searches find matching values.ITEM.ORDERS. ORDERS.QTY) LOOKUP 119 .

You can enter any valid transformation expression that evaluates to a string. The argument passes the string values that you want to return as lowercase. Return Value Lowercase character string.LOWER Availability: Designer Workflow Manager Converts uppercase string characters to lowercase. Any string value. If your data contains multibyte characters. Example The following expression returns all first names to lowercase: LOWER( FIRST_NAME ) FIRST_NAME antonia NULL THOMAS PierRe BERNICE RETURN VALUE antonia NULL thomas pierre bernice 120 Chapter 6: Functions . NULL if a value in the selected port is NULL. Syntax LOWER( string ) Argument string Meaning Required. the return value depends on the code page and data movement mode of the PowerCenter Server.

You can enter any valid transformation expression. 6. The strings you want to change. or if length is a negative number. second_string Return Value String of the specified length. be sure to enclose the characters you want to add to the beginning of the string within single quotation marks. Required. If you omit the second_string. length [. RPAD returns NULL.LPAD Availability: Designer Workflow Manager Adds a set of blanks or characters to the beginning of a string to set the string to a specified length. LPAD( PART_NUM. Can be any string value. This argument is case-sensitive. This argument specifies the length you want each string to be. however. Example The following expression standardizes numbers to six digits by padding them with leading zeros. NULL if a value passed to the function is NULL. When length is a negative number. the function pads the beginning of the first string with blanks. Optional. '0') PART_NUM 702 1 0553 484834 RETURN VALUE 000702 000001 000553 484834 LPAD 121 . The characters you want to append to the left-side of the first_string values.second_string] ) Argument first_string length Meaning Required. Syntax LPAD( first_string. Can be a character string. for example 'abc'. Must be a positive integer literal. You can enter a specific string literal. You can enter any valid transformation expression.

If the second string is longer than the total characters needed to return the specified length. -5.') ITEM_NAME Flashlight Compass Regulator System RETURN VALUE NULL NULL NULL 122 Chapter 6: Functions ..**. 5.LPAD counts the length from left to right. LPAD truncates the string from right to left.**.**Compass Regulator System *. 16.. If the first string is longer than the length. For example... LPAD uses a portion of the second string: LPAD( ITEM_NAME. '. LPAD(‘alphabetical’.. '*.*' ) ITEM_NAME Flashlight Compass Regulator System Safety Knife RETURN VALUE *.Flashlight *.*Safety Knife The following expression shows how LPAD handles negative values for the length argument for each row in the ITEM_NAME port: LPAD( ITEM_NAME. ‘x’) returns the string ‘alpha’.

however. If you use LTRIM to remove characters from a string. Then it returns the string.LTRIM Availability: Designer Workflow Manager Removes blanks or characters from the beginning of a string. not 'a'. you must enclose the characters you want to remove from the beginning of the string within single quotation marks. trim_set Return Value String. Passes the characters you want to remove from the beginning of the first string. Any string value. You can enter any valid transformation expression. LTRIM removes only single-byte spaces. if you want to remove the 'A' character from the string 'Alfredo'. LTRIM removes it. Any string value. character-by-character. Passes the strings you want to modify. you use LTRIM with IIF or DECODE in an Expression or Update Strategy transformation to avoid spaces in a target table. Most often. If the character in the string matches any character in the trim_set. LTRIM continues comparing and removing characters until it fails to find a matching character in the trim_set. trim_set] ) Arguments string Meaning Required. If you do not specify a trim_set parameter in your expression: ♦ ♦ In UNICODE mode. LTRIM compares the trim_set to each character in the string argument. In ASCII mode. LTRIM 123 . starting with the left side of the string. If the trim_set is NULL. the function returns NULL. the function removes any blanks from the beginning of the string. 'abc'. You can also enter a character string.and double-byte spaces from the beginning of a string. with any matching characters removed. You can enter any valid transformation expression. LTRIM removes both single. Syntax LTRIM( string [. NULL if a value passed to the function is NULL. you would enter 'A'. You can use operators to perform comparisons or concatenate strings before removing characters from the beginning of a string. If you omit the second string. Also note that LTRIM is case-sensitive. The string values with the specified characters in the trim_set argument removed. Optional. For example. for example.

you might create an expression similar to the following: LTRIM( LTRIM( NAMES ). for the set of characters you specify in the trim_set argument. LTRIM returns the string and evaluates the next row. You can also remove multiple sets of characters by nesting LTRIM.’ from the strings in the LAST_NAME port: LTRIM( LAST_NAME. Then LTRIM looks at the second character in the string. so LTRIM returns the string in the LAST_NAME port and moves to the next row. Bender. if you want to remove leading blanks and the character 'T' from a column of names. character-by-character. Bender Steadman RETURN VALUE Nelson Osborne NULL MacDonald awyer H. Bender. If it matches the second character in the trim_set. For example. Tips You can use RTRIM and LTRIM with || or CONCAT to remove leading and trailing blanks after you concatenate two strings.Example The following expression removes the characters ‘S’ and ‘. Bender teadman LTRIM removes ‘S. LTRIM removes it. 'T' ) 124 Chapter 6: Functions .') LAST_NAME Nelson Osborne NULL S. H does not match either character in the trim_set argument. If the first character in the string matches the first character in the trim_set. but not the period from H. 'S. LTRIM removes it. MacDonald and the ‘S’ from both Sawyer and Steadman.’ from S. In the example of H. and so on. MacDonald Sawyer H. When the first character in the string does not match the corresponding character in the trim_set. This is because LTRIM searches.

or if no rows are selected (for example. The filter condition must be a numeric value or evaluate to TRUE. Example You can return the maximum date for a port or group. FALSE.MAX (Dates) Availability: Designer Returns the latest date found within a port or group. Syntax MAX( date [. You can enter any valid transformation expression. You can enter any valid transformation expression. Passes the date for which you want to return a maximum date. Optional. You can apply a filter to limit the rows in the search. You can also use MAX to return the largest numeric value in a port or group. MAX is one of several aggregate functions. ITEM_NAME='Flashlight' ) ITEM_NAME Flashlight Regulator System Flashlight Diving Hood Halogen Flashlight Flashlight Flashlight ORDER_DATE Apr 20 1998 May 15 1998 Sep 21 1998 Aug 18 1998 Feb 1 1998 Oct 10 1998 NULL MAX (Dates) 125 . The following expression returns the maximum order date for flashlights: MAX( ORDERDATE. Return Value Date. For more information. Limits the rows in the search. NULL if all values passed to the function are NULL. or NULL. filter_condition] ) Argument date filter_condition Meaning Required. see “Aggregate Functions” on page 50. Date/Time datatype. You use aggregate functions in Aggregator transformations only. the filter condition evaluates to FALSE or NULL for all rows). You can nest only one other aggregate function within MAX.

or NULL. You can treat null values as zero in aggregate functions or as NULL. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. You can enter any valid transformation expression. If the return value is decimal with precision greater than 15. If you pass an entire port or group of null values. For more information on configuring the PowerCenter Server. However. FALSE. NULL if all values passed to the function are NULL. However. Limits the rows in the search. Passes the numeric values for which you want to return a maximum numeric value. You can enter any valid transformation expression. the function returns NULL. when you configure the PowerCenter Server. You use aggregate functions in Aggregator transformations only. MAX is one of several aggregate functions. the filter condition evaluates to FALSE or NULL for all rows). For more information. You can nest only one other aggregate function within MAX. or if no rows are selected (for example. Optional. Note: By default. Nulls If a value is NULL. Syntax MAX( numeric_value [. filter_condition] ) Argument numeric_value filter_condition Meaning Required. 126 Chapter 6: Functions . see “Aggregate Functions” on page 50. Numeric datatype. MAX ignores it. MAX returns NULL. you can choose how you want to handle null values in aggregate functions. You can apply a filter to limit the rows in the search. You can also use MAX to return the latest date in a port or group. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. if all values passed from the port are NULL. The filter condition must be a numeric value or evaluate to TRUE. the PowerCenter Server treats null values as NULLs in aggregate functions. Return Value Numeric value.MAX (Numbers) Availability: Designer Returns the maximum numeric value found within a port or group.

00 79. If there is no group by port. ITEM_NAME='Flashlight' ) ITEM_NAME Flashlight Regulator System Flashlight Diving Hood Halogen Flashlight Flashlight Flashlight RETURN VALUE: 85.00 PRICE 10.00 NULL MAX (Numbers) 127 . returning one value.00 162.00 55.Group By MAX groups values based on group by ports you define in the transformation. returning one result for each group. Example The first expression returns the maximum price for flashlights: MAX( PRICE.00 360.00 85. MAX treats all rows as one group.

you can apply a filter to limit the rows you read to calculate the median. FALSE. You use aggregate functions in Aggregator transformations only. If there is an even number of values in the port. However. see “Installing and Configuring the 128 Chapter 6: Functions . If there is an odd number of values in the port. NULL if all values passed to the function are NULL.MEDIAN Availability: Designer Returns the median of all values in a selected port. You can enter any valid transformation expression. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. You can treat null values as zero in aggregate functions or as NULL. the filter condition evaluates to FALSE or NULL for all rows). The filter condition must be a numeric value or evaluate to TRUE. You can nest only one other aggregate function within MEDIAN. filter_condition ] ) Argument numeric_value filter_condition Meaning Required. the median is the middle number. and the nested function must return a Numeric datatype. Return Value Numeric value. Optional. or NULL. the median is the average of the middle two values when all values are placed ordinally on a number line. Optionally. Note: If the return value is decimal with precision greater than 15. Nulls If a value is NULL. For more information. Syntax MEDIAN( numeric_value [. or if no rows are selected (for example. the PowerCenter Server treats null values as NULLs in aggregate functions. Numeric datatype. when you configure the PowerCenter Server. see “Aggregate Functions” on page 50. MEDIAN ignores the row. the function returns NULL. If you pass an entire port or group of null values. MEDIAN returns NULL. Passes the values for which you want to calculate a median. For more information on configuring the PowerCenter Server. However. Note: By default. if all values passed from the port are NULL. you can choose how you want to handle null values in aggregate functions. Limits the rows in the search. You can enter any valid transformation expression. MEDIAN is one of several aggregate functions.

PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide.

Group By
MEDIAN groups values based on group by ports you define in the transformation, returning one result for each group. If there is no group by port, MEDIAN treats all rows as one group, returning one value.

Example
To calculate the median salary for all departments, you create an Aggregator transformation grouped by departments with a port specifying the following expression:
MEDIAN( SALARY )

The following expression returns the median value for orders of stabilizing vests:
MEDIAN( SALES, ITEM = ‘Stabilizing Vest’ ) ITEM Flashlight Stabilizing Vest Stabilizing Vest Safety Knife Medium Titanium Knife Tank Stabilizing Vest Chisel Point Knife Stabilizing Vest Stabilizing Vest SALES 85 504 36 5 150 NULL 441 60 NULL 1044

Wrist Band Thermometer 110 RETURN VALUE: 472.5

MEDIAN

129

METAPHONE
Availability: Designer Workflow Manager

Encodes string values. You can specify the length of the string that you want to encode. METAPHONE encodes characters of the English language alphabet (A-Z). It encodes both uppercase and lowercase letters in uppercase. METAPHONE encodes characters according to the following list of rules:
♦ ♦

Skips vowels (A, E, I, O, and U) unless one of them is the first character of the input string. METAPHONE(‘CAR’) returns ‘KR’ and METAPHONE(‘AAR’) returns ‘AR’. Table 6-1 lists the METAPHONE encoding guidelines:
Table 6-1. METAPHONE Encoding Guidelines Input B C Returns n/a B X S n/a K J T F F n/a J K H H n/a J K L M N J n/a K L M N Condition - when it follows M - in all other cases - when followed by IA or H - when followed by I, E, or Y - when it follows S, and is followed by I, E, or Y - in all other cases - when followed by GE, GY, or GI - in all other cases - in all cases - when followed by H and the first character in the input string is not B, D, or H - when followed by H and the first character in the input string is B, D, or H - when followed by I, E or Y and does not repeat - in all other cases - when it does not follow C, G, P, S, or T and is followed by A, E, I, or U - in all other cases - in all cases - when it follows C - in all other cases - in all cases - in all cases - in all cases Example - METAPHONE (‘Lamb’) returns LM. - METAPHONE (‘Box’) returns BKS. - METAPHONE (‘Facial’) returns FXL. - METAPHONE (‘Fence’) returns FNS. - METAPHONE (‘Scene’) returns SN. - METAPHONE (‘Cool’) returns KL. - METAPHONE (‘Dodge’) returns TJ. - METAPHONE (‘David’) returns TFT. - METAPHONE (‘FOX’) returns FKS. - METAPHONE (‘Tough’) returns TF. - METAPHONE (‘Hugh’) returns HF. - METAPHONE (‘Magic’) returns MJK. - METAPHONE(‘GUN’) returns KN. - METAPHONE (‘DHAT’) returns THT. - METAPHONE (‘Chain’) returns XN. - METAPHONE (‘Jen’) returns JN. - METAPHONE (‘Ckim’) returns KM. - METAPHONE (’Kim’) returns KM. - METAPHONE (‘Laura’) returns LR. - METAPHONE (‘Maggi’) returns MK. - METAPHONE (‘Nancy’) returns NNS.

D F G

130

Chapter 6: Functions

Table 6-1. METAPHONE Encoding Guidelines Input P Q R S T Returns F P K R X S X 0* n/a T V W F W n/a X Y Z KS Y n/a S Condition - when followed by H - in all other cases - in all cases - in all cases - when followed by H, IO, IA, or CHW - in all other cases - when followed by IA or IO - when followed by H - when followed by CH - in all other cases - in all cases - when followed by A, E, I, O, or U - in all other cases - in all cases - when followed by A, E, I, O, or U - in all other cases - in all cases Example - METAPHONE (‘Phone’) returns FN. - METAPHONE (‘Pip’) returns PP. - METAPHONE (‘Queen’) returns KN. - METAPHONE (‘Ray’) returns R. - METAPHONE (‘Cash’) returns KX. - METAPHONE (‘Sing’) returns SNK. - METAPHONE (‘Patio’) returns PX. - METAPHONE (‘Thor’) returns 0R. - METAPHONE (‘Glitch’) returns KLTX. - METAPHINE (‘Tim’) returns TM. - METAPHONE (‘Vin’) returns FN. - METAPHONE (‘Wang’) returns WNK. - METAPHONE (‘When’) returns HN. - METAPHONE (‘Six’) returns SKS. - METAPHONE (‘Yang’) returns YNK. - METAPHONE (‘Bobby’) returns BB. - METAPHONE (‘Zack’) returns SK.

*The integer 0.

Skips the initial character and encodes the remaining string if the first two characters of the input string have one of the following values:
− − − −

KN. For example, METAPHONE(‘KNOT’) returns ‘NT’. GN. For example, METAPHONE(‘GNOB’) returns ‘NB’. PN. For example, METAPHONE(‘PNRX’) returns ‘NRKS’. AE. For example, METAPHONE(‘AERL’) returns ‘ERL’.

If a character other than “C” occurs more than once in the input string, encodes the first occurrence only. For example, METAPHONE(‘BBOX’) returns ‘BKS’ and METAPHONE(‘CCOX’) returns ‘KKKS’.

METAPHONE

131

Syntax
METAPHONE( string [,length] ) Argument string Meaning Required. Must be a character string. Passes the value you want to encode. The first character must be a character in the English language alphabet (A-Z). You can enter any valid transformation expression. Skips any non-alphabetic character in string. Optional. Must be an integer greater than zero. Specifies the number of characters in string that you want to encode. You can enter any valid transformation expression. When length is zero or a value greater than the length of string, encodes the entire input string. Default is zero.

length

Return Value
String. NULL if one of the following conditions is true:
♦ ♦ ♦

All values passed to the function are NULL. No character in string is a letter of the English alphabet. string is empty.

Examples
The following expression encodes the first two characters in EMPLOYEE_NAME port to a string:
METAPHONE( EMPLOYEE_NAME, 2 ) Employee_Name John *@#$ P$%%oc&&KMNL Return Value JH NULL PK

The following expression encodes the first four characters in EMPLOYEE_NAME port to a string:
METAPHONE( EMPLOYEE_NAME, 4 ) Employee_Name John 1ABC *@#$ P$%%oc&&KMNL Return Value JHN ABK NULL PKKM

132

Chapter 6: Functions

MIN (Dates)
Availability: Designer

Returns the oldest date found in a port or group. You can apply a filter to limit the rows in the search. You can nest only one other aggregate function within MIN, and the nested function must return a date datatype. MIN is one of several aggregate functions. You use aggregate functions in Aggregator transformations only. For more information, see “Aggregate Functions” on page 50. You can also use MIN to return the minimum numeric value in a port or group.

Syntax
MIN( date [, filter_condition] ) Argument date filter_condition Meaning Required. Date/Time datatype. Passes the values for which you want to return minimum value. You can enter any valid transformation expression. Optional. Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value
Date if the value argument is a date. NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

Nulls
If a single value is NULL, MIN ignores it. However, if all values passed from the port are NULL, MIN returns NULL.

Group By
MIN groups values based on group by ports you define in the transformation, returning one result for each group. If there is no group by port, MIN treats all rows as one group, returning one value.

MIN (Dates)

133

ITEM_NAME='Flashlight' ) ITEM_NAME Flashlight Regulator System Flashlight Diving Hood Halogen Flashlight Flashlight Flashlight RETURN VALUE: Feb 1 1998 ORDER_DATE Apr 20 1998 May 15 1998 Sep 21 1998 Aug 18 1998 Feb 1 1998 Oct 10 1998 NULL 134 Chapter 6: Functions .Example The following expression returns the oldest order date for flashlights: MIN( ORDER_DATE.

you can enable high precision in the session properties to ensure decimal precision up to 28 digits. You can enter any valid transformation expression. For more information on configuring the PowerCenter Server. see “Aggregate Functions” on page 50. or NULL. Note: If the return value is a decimal with precision greater than 15. You can apply a filter to limit the rows in the search. Return Value Numeric value. However. NULL if all values passed to the function are NULL. or if no rows are selected (for example. MIN is one of several aggregate functions. MIN returns NULL. MIN (Numbers) 135 . FALSE. You can also use MIN to return the oldest date in a port or group. and the nested function must return a Numeric datatype. MIN ignores it. You can enter any valid transformation expression. Optional. the PowerCenter Server treats null values as NULLS in aggregate functions. when you configure the PowerCenter Server.MIN (Numbers) Availability: Designer Returns the minimum numeric value found in a port or group. filter_condition] ) Argument numeric_value filter_condition Meaning Required. If you pass an entire port or group of null values. the function returns NULL. However. You use aggregate functions in Aggregator transformations only. You can treat null values as zero in aggregate functions or as NULL. Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE. For more information. if all values passed from the port are NULL. Numeric datatypes. the filter condition evaluates to FALSE or NULL for all rows). you can choose how you want to handle null values in aggregate functions. You can nest only one other aggregate function within MIN. Passes the values for which you want to return minimum value. Note: By default. Nulls If a single value is NULL. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. Syntax MIN( numeric_value [.

MIN treats all rows as one group.00 360.00 162.00 NULL 136 Chapter 6: Functions . returning one value. Example The following expression returns the minimum price for flashlights: MIN ( PRICE. If there is no group by port.Group By MIN groups values based on group by ports you define in the transformation.00 85.00 PRICE 10. ITEM_NAME='Flashlight' ) ITEM_NAME Flashlight Regulator System Flashlight Diving Hood Halogen Flashlight Flashlight Flashlight RETURN VALUE: 10.00 79.00 55. returning one result for each group.

00 15.MOD Availability: Designer Workflow Manager Returns the remainder of a division calculation. Return Value Numeric value of the datatype you pass to the function. NULL if a value passed to the function is NULL. divisor ) Argument numeric_value divisor Meaning Required.5) returns 3. MOD(8.00 9.00 12. Numeric datatype. The divisor cannot be zero. Syntax MOD( numeric_value. Required. MOD 137 . The numeric value you want to divide by.00 25. You can enter any valid transformation expression.00 NULL 20. The remainder of the numeric value divided by the divisor.00 QTY 2 5 2 3 3 NULL 0 RETURN VALUE 0 2 1 0 NULL NULL Error. PowerCenter Server does not write row. The values you want to divide. QTY ) PRICE 10. For example. Example The following expression returns the modulus of the values in the PRICE port divided by the values in the QTY port: MOD( PRICE.

0) produced a NULL rather than an error because the IIF function replaces NULL with the zero in the QTY port.00 QTY 2 5 2 3 3 NULL 0 RETURN VALUE 0 2 1 0 NULL NULL NULL The last row (25.00 9. If the quantity is zero. you can create an expression similar to the following. NULL.00 NULL 20. which returns the modulus of Price divided by Quantity only if the quantity is not zero.00 12. 138 Chapter 6: Functions . the function returns NULL: MOD( PRICE. QTY )) PRICE 10. IIF( QTY = 0.00 25.00 15. 0) produced an error because you cannot divide by zero.The last row (25. To avoid dividing by zero.

Required. The values for which you want to calculate a moving average.MOVINGAVG Availability: Designer Returns the average (row-by-row) of a specified set of rows. five rows at a time. if you want to calculate a moving average for a column of data. or NULL. the filter condition evaluates to FALSE or NULL for all rows). filter_condition Return Value Numeric value. Optionally. However. Must be a positive integer literal greater than zero. NULL if all values passed to the function are NULL. Nulls MOVINGAVG ignores null values when calculating the moving average. You can enter any valid transformation expression. Limits the rows in the search. or if no rows are selected (for example. You can enter any valid transformation expression. you can apply a condition to filter rows before calculating the moving average. you might write an expression such as: MOVINGAVG(SALES. MOVINGAVG 139 . For example. The filter condition must be a numeric value or evaluate to TRUE. rowset [. FALSE. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. Optional. Numeric datatype. the function returns NULL. filter_condition] ) Argument numeric_value rowset Meaning Required. if all values are NULL. Syntax MOVINGAVG( numeric_value. Note: If the return value is a decimal with precision greater than 15. Defines the row set for which you want to calculate the moving average. 5).

8 243 The function returns the average for a set of five rows: 358 based on rows 1 through 5. and 243 based on rows 3 through 7.8 based on rows 2 through 6. 245. 5 ) ROW_NO 1 2 3 4 5 6 7 SALES 600 504 36 100 550 39 490 RETURN VALUE NULL NULL NULL NULL 358 245. based on the first five rows in the Sales port. and thereafter. 140 Chapter 6: Functions . returns the average for the last five rows read: MOVINGAVG( SALES.Example The following expression returns the average order for a Stabilizing Vest.

filter_condition] ) Argument numeric_value rowset Meaning Required. or NULL. Optionally. Syntax MOVINGSUM( numeric_value. if all values are NULL. Must be a positive integer literal greater than zero. For example. Defines the rowset for which you want to calculate the moving sum. FALSE. filter_condition Return Value Numeric value. Numeric datatype. However. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. you can apply a condition to filter rows before calculating the moving sum. the filter condition evaluates to FALSE or NULL for all rows). 5 ) Optional. the function returns NULL. You can enter any valid transformation expression. Limits the rows in the search. Note: If the return value is a Decimal with precision greater than 15. rowset [. MOVINGSUM 141 . The values for which you want to calculate a moving sum. The filter condition must be a numeric value or evaluate to TRUE. five rows at a time. or if the function does not select any rows (for example. NULL if all values passed to the function are NULL. if you want to calculate a moving sum for a column of data. you might write an expression such as: MOVINGSUM( SALES. Required. Nulls MOVINGSUM ignores null values when calculating the moving sum. You can enter any valid transformation expression.MOVINGSUM Availability: Designer Returns the sum (row-by-row) of a specified set of rows.

5 ) ROW_NO 1 2 3 4 5 6 7 SALES 600 504 36 100 550 39 490 RETURN VALUE NULL NULL NULL NULL 1790 1229 1215 The function returns the sum for a set of five rows: 1790 based on rows 1 through 5. based on the first five rows in the Sales port.Example The following expression returns the sum of orders for a Stabilizing Vest. and 1215 based on rows 3 through 7. returns the average for the last five rows read: MOVINGSUM( SALES. 142 Chapter 6: Functions . and thereafter. 1229 based on rows 2 through 6.

the filter condition evaluates to FALSE or NULL for all rows). percentile [. filter_condition Return Value Numeric value. You can nest only one other aggregate function within PERCENTILE. Passes the values for which you want to calculate a percentile. and the nested function must return a Numeric datatype. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. Optionally. However. However. filter_condition ] ) Argument numeric_value percentile Meaning Required. PERCENTILE returns NULL. or if no rows are selected (for example. FALSE. Passes the percentile you want to calculate. Integer between 0 and 100. Limits the rows in the search. For more information. Note: If the return value is decimal with precision greater than 15. when PERCENTILE 143 . Required. you can apply a filter to limit the rows you read to calculate the percentile. Note: By default. PERCENTILE ignores the row. If you pass a number outside the 0 to 100 range. Optional. The filter condition must be a numeric value or evaluate to TRUE. See the following equation for more details. Nulls If a value is NULL. PERCENTILE is one of several aggregate functions. see “Aggregate Functions” on page 50. if all values in a group are NULL. You can enter any valid transformation expression. You can enter any valid transformation expression. You can enter any valid transformation expression. NULL if all values passed to the function are NULL. inclusive. the PowerCenter Server treats null values as NULLs in aggregate functions. If you pass an entire port or group of null values. Syntax PERCENTILE( numeric_value. Numeric datatype. the PowerCenter Server displays an error and does not write the row.PERCENTILE Availability: Designer Calculates the value that falls at a given percentile in a group of numbers. the function returns NULL. You use aggregate functions in Aggregator transformations only. or NULL.

PERCENTILE returns the value of the first element in the list. returning one result for each group.you configure the PowerCenter Server. You can treat null values as zero in aggregate functions or as NULL. you can choose how you want to handle null values in aggregate functions. If i < 1. returning one value. If i is an integer value. PERCENTILE treats all rows as one group. PERCENTILE returns the value of the ith element in the list. Otherwise PERCENTILE returns the value of n: n = [ i th element × ( i – i ) ] + [ i th element × ( i – i ) ] 144 Chapter 6: Functions . If there is no group by port. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. Group By PERCENTILE groups values based on group by ports you define in the transformation. For more information on configuring the PowerCenter Server. Example The PowerCenter Server calculates a percentile using the following logic: ( x + 1 ) × percentile i = ------------------------------------------------100 where: ♦ ♦ ♦ ♦ x is the number of elements in the group of values for which you are calculating a percentile.

0 85000.0 48000.0 86000.0 RETURN VALUE: 106250.0 9000.0 100000.0 NULL 55000.The following expression returns the salary that falls at the 75th percentile of salaries greater than $50. SALARY > 50000 ) SALARY 125000.000: PERCENTILE( SALARY.0 PERCENTILE 145 .0 99000.0 27900. 75.

If the base value is negative.0 729. You can enter any valid transformation expression.594307804838 NULL NULL 0.0 -3. You can enter any valid transformation expression. the exponent must be an integer.0 146 Chapter 6: Functions . the exponent must be an integer. EXPONENT ) NUMBERS 10.0 NULL -6. Example The following expression returns the values in the Numbers port raised to the values in the Exponent port: POWER( NUMBERS.00137174211248285 0. Numeric value.0 -6. This argument is the exponent value. Numeric value.0 5.0 6.0 3. Return Value Double value.POWER Availability: Designer Workflow Manager Returns a value raised to the exponent you pass to the function.5 2.5 3.0 -3.5 RETURN VALUE 100 1838. the function rounds any decimal values to the nearest integer before returning a value. In this case.0 EXPONENT 2.5 NULL 10.00137174211248285 729. This argument is the base value. Required. NULL if you pass a null value to the function. If the base value is negative.265625 982. exponent ) Argument base exponent Meaning Required.0 3.0 -3. Syntax POWER( base.0 5.0 6.

If the base is negative. the exponent must be an integer.5.0 raised to 6 returns the same results as -3.0 raised to 5. otherwise the PowerCenter Server rounds the exponent to the nearest integer value.Note that -3. POWER 147 .

an empty string. REPLACECHR searches the input string for the characters you specify and replaces all occurrences of all characters with the new character you specify. OldCharSet. If OldCharSet is NULL or empty. You can enter any valid transformation expression.REPLACECHR Availability: Designer Workflow Manager Replaces characters in a string with a single character or no character. Must be a character string. Must be a character string. Passes the string you want to search. Syntax REPLACECHR( CaseFlag. If you pass a numeric value. InputString OldCharSet NewChar Return Value String. 'abc'. You can also enter a text literal enclosed within single quotation marks. If you pass a numeric value. The characters you want to replace. NULL if InputString is NULL. You can enter one or more characters. Must be a character string. When CaseFlag is a null value or a zero. the function converts it to a character string. the function is case-sensitive. REPLACECHR removes all occurrences of all characters in OldCharSet in InputString. REPLACECHR returns NULL. NewChar ) Argument CaseFlag Meaning Required. When CaseFlag is a non-zero number. You can enter any valid transformation expression. REPLACECHR uses the first character to replace OldCharSet. InputString if OldCharSet is NULL or empty. You can enter any valid transformation expression. or NULL. REPLACECHR returns InputString. 148 Chapter 6: Functions . Required. You can enter any valid transformation expression. the function is not case-sensitive. the function converts it to a character string. for example. If InputString is NULL. You can enter one character. If NewChar contains more than one character. Empty string if REPLACECHR removes all characters in InputString. InputString. If NewChar is NULL or empty. Required. Required. Determines whether the arguments in this function are casesensitive. Must be an integer.

CUSTOMER_CODE.html HTTP/1.1 GET /companyinfo/index.1" NULL RETURN VALUE 29/Oct/2001:14:13:50 -0700 31/Oct/2000:19:45:46 -0700 GET /news/ index.html HTTP/1.1 NULL The following expression removes multiple characters for each row in the WEBLOG port: REPLACECHR ( 1.html HTTP/1. NULL ) WEBLOG "GET /news/index. CUSTOMER_CODE. ‘A’.html HTTP/1.html HTTP/1. ‘"’.html HTTP/1.html HTTP/1.1 NULL RETURN VALUE GET /news/index. WEBLOG.1" GET /companyinfo/index.1 NULL The following expression changes part of the value of the customer code for each row in the CUSTOMER_CODE port: REPLACECHR ( 1. WEBLOG.html HTTP/1.1 01/Nov/2000:10:51:31 -0700 GET /news/ index.1" [01/Nov/2000:10:51:31 -0700] "GET / news/index.html HTTP/1. ‘]["’.1" "GET /companyinfo/index.1 GET /companyinfo/index. ‘A’. NULL ) WEBLOG [29/Oct/2001:14:13:50 -0700] [31/Oct/2000:19:45:46 -0700] "GET / news/index.html HTTP/1.Example The following expression removes the double quotes from web log data for each row in the WEBLOG port: REPLACECHR( 0. ‘M’ ) CUSTOMER_CODE ABA abA BBC ACC NULL RETURN VALUE MBM abM BBC MCC NULL The following expression changes part of the value of the customer code for each row in the CUSTOMER_CODE port: REPLACECHR ( 0. ‘M’ ) CUSTOMER_CODE ABA abA BBC ACC RETURN VALUE MBM MbM BBC MCC REPLACECHR 149 .

INPUT. The following expression removes multiple characters. including the single quote. ‘A’. 150 Chapter 6: Functions . INPUT. NULL ) CUSTOMER_CODE ABA BBC ACC AAA aaa NULL aaa NULL RETURN VALUE B BBC CC [empty string] The following expression removes multiple numbers for each row in the INPUT port: REPLACECHR ( 1. for each row in the INPUT port: REPLACECHR (1. CHR(39). The single quote is the only character that cannot be used inside a string literal. NULL ) INPUT 12345 4141 111115 NULL RETURN VALUE 235 NULL 5 NULL When you want to use a single quote (‘) in either OldCharSet or NewChar.The following expression changes part of the value of the customer code for each row in the CUSTOMER_CODE port: REPLACECHR ( 1. you must use the CHR function. CUSTOMER_CODE. NULL ) INPUT 'Tom Smith' 'Laura Jones' Tom's NULL RETURN VALUE Tom Smith Laura Jones Toms NULL For more information. ‘14’. see “CHR” on page 68.

If NewString is NULL or empty. the function is case-sensitive. InputString OldString NewString Return Value String.REPLACESTR Availability: Designer Workflow Manager Replaces characters in a string with a single character. . REPLACESTR ignores the OldString argument. or no character. When CaseFlag is a null value or a zero. multiple characters. Must be a character string. Required. You can enter any valid transformation expression. If InputString is NULL. multiple characters. You can enter one or more characters per OldString argument. if you enter multiple OldString arguments. it places the cursor after the replaced characters in InputString before searching for the next match. the function converts it to a character string. If you pass a numeric value. Syntax REPLACESTR ( CaseFlag. REPLACESTR removes all occurrences of OldString in InputString. Passes the strings you want to search. see the examples. REPLACESTR searches the input string for all strings you specify and replaces them with the new string you specify. the function converts it to a character string. You can enter any valid transformation expression. REPLACESTR 151 .. When all OldString arguments are NULL or empty. and one or more OldString arguments is NULL or empty. The function replaces the characters in the OldString arguments in the order they appear in the function. or NULL. etc. For more information. When CaseFlag is a non-zero number. REPLACESTR returns NULL. Determines whether the arguments in this function are casesensitive. the first OldString argument has precedence over the second OldString argument. and the second OldString argument has precedence over the third OldString argument. [OldString2. InputString. 'abc'. When REPLACESTR replaces a string. Must be a character string.. You can enter any valid transformation expression. an empty string. You can enter any valid transformation expression. You can also enter a text literal enclosed within single quotation marks.] NewString ) Argument CaseFlag Meaning Required. REPLACESTR returns InputString. If you pass a numeric value. You must enter at least one OldString argument. Required. When REPLACESTR contains multiple OldString arguments. Must be an integer. Empty string if REPLACESTR removes all characters in InputString. The string you want to replace. You can enter one character. for example. OldString1. Required. OldStringN. the function is not case-sensitive. That is. Must be a character string.

html [empty string] The following expression changes the title for certain values for each row in the TITLE port: REPLACESTR ( 1. Miss Mr. ‘GET ’.1" GET /companyinfo/index.’ ) TITLE Mrs. The following expression changes the title for certain values for each row in the TITLE port: REPLACESTR ( 0. ‘ab’. TITLE. RETURN VALUE Ms. NULL ) WEBLOG "GET /news/index. MRS.1" "GET /companyinfo/index. ‘iss’. ‘s. ‘*’ ) INPUT abc abbc abbbbc bc RETURN VALUE *c ** *bb* * 152 Chapter 6: Functions . ‘bc’. ‘s. INPUT.html /companyinfo/index.html HTTP/1. ‘rs. ‘ HTTP/1.html HTTP/1.html GET NULL NULL RETURN VALUE /news/index.’. MRS. Example The following expression removes the double quotes and two different text strings from web log data for each row in the WEBLOG port: REPLACESTR( 1. WEBLOG. MRS. ‘iss’. ‘"’.’. The following expression shows how the REPLACESTR function replaces multiple OldString arguments for each row in the INPUT port: REPLACESTR ( 1. TITLE. ‘rs.html /companyinfo/index. Ms. InputString if all OldString arguments are NULL or empty.NULL if InputString is NULL. Ms.1’.’ ) TITLE Mrs. Mr. RETURN VALUE Ms.

‘its’ ) INPUT it's mit's mits mits' RETURN VALUE its mits mits mits' For more information. ‘b’ ) INPUT ab bc abc abbc abbcc RETURN VALUE b b bc bb bbc When you want to use a single quote (‘) in either OldString or NewString. ‘bc’. CONCAT(CHR(39). Use both the CHR and CONCAT functions to concatenate a single quote onto a string. REPLACESTR 153 . CONCAT( CHR(39). you must use the CHR function. INPUT. ‘ab’. INPUT. The single quote is the only character that cannot be used inside a string literal.The following expression shows how the REPLACESTR function replaces multiple OldString arguments for each row in the INPUT port: REPLACESTR ( 1. For example: CONCAT( ‘Joan’. see “CHR” on page 68 and “CONCAT” on page 72. ‘s’ )). ‘s car’ )) returns Joan's car The following expression changes a string that includes the single quote. CONCAT(‘it’. for each row in the INPUT port: REPLACESTR ( 1.

the function returns the current date with the time set to 00:00:00 (12AM). If the month is between July and December. 'YY') returns 1/1/1998 00:00:00. If the time is 12:00:00 (12PM) or later. If the month is between January and June. If time has 0 to 29 seconds. For example. This functions can round the following parts of a date: ♦ Year. Rounds the hour portion of the date based on the minutes in the hour. If the day of the month is between 16 and the last day of the month. it rounds to the first day of the next month with the time set to 00:00:00. the function returns January 1 of the input year. the function returns the current hour with the minutes and seconds set to zero. Minute. If the minute portion of the time is between 0 and 29. the function returns the current minutes and sets the seconds to zero. and ROUND(07/1/1998 3:10:15. the function rounds to the next minute and sets the seconds to zero. Hour. Rounds the month portion of a date based on the day of the month. If the day of the month is between 1 and 15. ♦ ♦ ♦ ♦ 154 Chapter 6: Functions . 'MI') returns 05/22/1998 10:16:00. 'HH') returns 04/01/1998 14:00:00. 'MM') returns 5/1/1998 00:00:00. You can also use ROUND to round numbers. Rounds the minute portion of the date based on the seconds. and sets the time to 00:00:00. If the time is between 00:00:00 (12AM) and 11:59:59AM. 'MM') returns 4/1/1998 00:00:00. 'YY') returns 01/01/1998 00:00:00. and ROUND(06/13/1998 22:30:45. the expression ROUND(04/01/1998 11:29:35. the expression ROUND(06/13/1998 2:30:45. If the minute portion is 30 or greater. the expression ROUND(06/30/1998 2:30:55. 'HH') returns 04/01/1998 11:00:00. the function returns January 1 of the next year with the time set to 00:00:00. and ROUND(05/22/1998 10:15:30. the function rounds to the next hour and sets the minutes and seconds to zero. Rounds the year portion of a date based on the month. For example. the function rounds the date to the next day with the time set to 00:00:00 (12AM). and ROUND(4/16/1998 8:24:19. If the time has 30 to 59 seconds. Month. Rounds the day portion of the date based on the time. it rounds the date to the first day of the input month with the time set to 00:00:00. For example. the expression ROUND(4/15/1998 12:15:00. the expression ROUND(05/22/1998 10:15:29. and ROUND(04/01/1998 13:39:00. For example.ROUND (Dates) Availability: Designer Workflow Manager Rounds one part of a date. For example. 'MI') returns 05/22/1998 10:15:00. Day. 'DD') returns 06/13/1998 00:00:00. 'DD') returns 06/14/1998 00:00:00.

Return Value Date with the specified part rounded. You can round only one portion of the date.Syntax ROUND( date [. If you omit the format string.format] ) Argument date format Meaning Required. the function rounds the date to the nearest day. Example The following expressions round the year portion of dates in the DATE_SHIPPED port: ROUND( DATE_SHIPPED. Date/Time datatype. 'YYYY' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Dec 20 1998 3:29:55PM NULL RETURN VALUE Jan 1 1998 12:00:00AM Jan 1 1998 12:00:00AM Jan 1 1999 12:00:00AM NULL The following expressions round the month portion of each date in the DATE_SHIPPED port: ROUND( DATE_SHIPPED. 'YYY' ) ROUND( DATE_SHIPPED. ROUND returns a date in the same format as the source date. You can nest TO_DATE to convert strings to dates before rounding. 'MM' ) ROUND( DATE_SHIPPED. NULL if you pass a null value to the function. 'Y' ) ROUND( DATE_SHIPPED. This is the portion of the date that you want to round. 'MONTH' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Dec 20 1998 3:29:55PM NULL RETURN VALUE Jan 1 1998 12:00:00AM May 1 1998 12:00:00AM Jan 1 1999 12:00:00AM NULL ROUND (Dates) 155 . Optional. Enter a valid format string. 'YY' ) ROUND( DATE_SHIPPED. You can link the results of this function to any port with a Date/Time datatype. 'MON' ) ROUND( DATE_SHIPPED.

'DD' ) ROUND( DATE_SHIPPED. 'DDD' ) ROUND( DATE_SHIPPED. 'DAY' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 12:00:00AM Apr 20 1998 12:00:00AM Dec 21 1998 12:00:00AM Jan 1 1999 12:00:00AM NULL The following expressions round the hour portion of each date in the DATE_SHIPPED port: ROUND( DATE_SHIPPED. 'MI' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 2:11:00AM Apr 19 1998 1:31:00PM Dec 20 1998 3:30:00PM Jan 1 1999 12:00:00AM NULL 156 Chapter 6: Functions . 'D' ) ROUND( DATE_SHIPPED. 'HH12' ) ROUND( DATE_SHIPPED. 'HH' ) ROUND( DATE_SHIPPED. 'DY' ) ROUND( DATE_SHIPPED. 'HH24' ) DATE_SHIPPED Jan 15 1998 2:10:31AM Apr 19 1998 1:31:20PM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 2:00:00AM Apr 19 1998 2:00:00PM Dec 20 1998 3:00:00PM Jan 1 1999 12:00:00AM NULL The following expression rounds the minute portion of each date in the DATE_SHIPPED port: ROUND( DATE_SHIPPED.The following expressions round the day portion of each date in the DATE_SHIPPED port: ROUND( DATE_SHIPPED.

Positive or negative integer. Return Value Numeric value. the function rounds to this number of decimal places. Optional. For example. ROUND(12. -1) returns 20. ROUND(12.0 because the function rounds 0. the function rounds this number of digits to the left of the decimal point.ROUND (Numbers) Availability: Designer Workflow Manager Rounds numbers to a specified number of digits or decimal places. You can also use ROUND to round dates.8) returns 13. ROUND returns NULL. you can enable high precision in the session properties to ensure decimal precision up to 28 digits.44. For example. Numeric datatype.0 and ROUND(15. You can enter any valid transformation expression. If one of the arguments is NULL. If you enter decimal precision.8 to 1 and then evaluates the expression.99. If you enter a positive precision.4. 1) returns 15. -1) returns 10 and ROUND(15. ROUND(12. For example. 0. the function rounds to the nearest integer. You can use operators to perform arithmetic before you round the values. For example.99. ROUND (Numbers) 157 . Note: If the return value is a decimal with precision greater than 15.99. returning an integer. truncating the decimal portion of the number. Syntax ROUND( numeric_value [.99. the function rounds to the nearest integer before evaluating the expression. precision] ) Argument numeric_value precision Meaning Required. If you enter a negative precision.99) returns 13. 1) returns 13. If you omit the precision argument. ROUND(12.

-2 ) PRICE 13242.0 -100.99 -18.0 1400.8 ) PRICE 12.956 NULL You can round digits to the left of the decimal point by passing a negative integer in the precision argument: ROUND( PRICE.99 -108.0 -16.99 56.8678 56.995 -18.9949 -18.0 57. 3 ) PRICE 12.9561 NULL RETURN VALUE 12.3 NULL If you omit the precision argument. 0.0 NULL 158 Chapter 6: Functions .868 56.99 -15.0 56.0 -19. ROUND( PRICE.34 NULL RETURN VALUE 13.95 NULL RETURN VALUE 13. the function rounds to the nearest integer: ROUND( PRICE ) PRICE 12.99 1435. the PowerCenter Server rounds it to the nearest integer before evaluating the expression: ROUND( PRICE.95 NULL RETURN VALUE 13200.9936 15.99 56.Example The following expression returns the values in the Price port rounded to three decimal places.994 15.0 NULL If you pass a decimal value in the precision argument.

use ROUND to round the truncated result of the left hand side of the expression to the expected result. the PowerCenter Server evaluates the left hand side of the expression as 6.999999999999999 because it truncates the result of the first division operation. When the PowerCenter Server runs in low precision mode. The PowerCenter Server evaluates the entire expression as FALSE. To achieve the expected result. The PowerCenter Server evaluates the following expression as TRUE: ROUND(7/3 * 3) = 7 ROUND (Numbers) 159 . This may not be the result you expect. For example.Tip You can also use ROUND to explicitly set the precision of calculated values and achieve expected results. it truncates the result of calculations if the precision of the value exceeds 15 digits. suppose you want to process the following expression in low precision mode: 7/3 * 3 = 7 In this case.

Return Value String of the specified length. RPAD(‘alphabetical’... Syntax RPAD( first_string.. This argument is casesensitive.. for example. 5. Regulator System Safety Knife. Passes the string you want to append to the right-side of the first_string values. NULL if a value passed to the function is NULL. If you omit the second string. Optional.') ITEM_NAME Flashlight Compass Regulator System Safety Knife RETURN VALUE Flashlight. RPAD returns NULL. Example The following expression returns the item name with a length of 16 characters. RPAD counts the length from left to right. 160 Chapter 6: Functions . length [. Any string value. RPAD truncates the string from right to left... 'abc'.RPAD Availability: Designer Workflow Manager Converts a string to a specified length by adding blanks or characters to the end of the string.' to the end of each item name: RPAD( ITEM_NAME. So. ‘x’) would return the string ‘alpha’.. Any string value. The strings you want to change..second_string] ) Argument first_string length second_string Meaning Required. Compass. Must be a positive integer literal..... the function pads the end of the first string with blanks. For example. Enclose the characters you want to add to the end of the string within single quotation marks. Specifies the length you want each string to be. or if length is a negative number. appending the string '. RPAD uses a partial part of the second_string when necessary. 16.... When length is a negative number. if the first string is longer than the length.. '. Required. You can enter any valid transformation expression.

*' ) ITEM_NAME Flashlight Compass Regulator System Safety Knife RETURN VALUE Flashlight*. 16. -5.*’ to the end of each item name: RPAD( ITEM_NAME. '. appending the string ‘*.**..') ITEM_NAME Flashlight Compass Regulator System RETURN VALUE NULL NULL NULL RPAD 161 .**.** Regulator System Safety Knife*. '*.....The following expression returns the item name with a length of 16 characters. Compass*..* The following expression shows how RPAD handles negative values for the length argument for each row in the ITEM_NAME port: RPAD( ITEM_NAME.

RTRIM removes both single. In ASCII mode. If you omit the second string. It returns the string. however. RTRIM removes it. for example. the function removes blanks from the end of the first string. with any matching characters removed. You can enter any valid transformation expression. character-by-character. trim_set Return Value String. you must enclose the characters you want to remove from the end of the string within single quotation marks. RTRIM continues comparing and removing characters until it fails to find a matching character in the trim_set. You can use operators to perform comparisons or concatenate strings before removing blanks from the end of a string. starting with the right side of the string. RTRIM compares the trim_set to each character in the string argument.and double-byte spaces from the end of a string. Also note that RTRIM is case-sensitive. If the character in the string matches any character in the trim_set. Passes the characters you want to remove from the end of the string. Syntax RTRIM( string [. RTRIM removes only single-byte spaces.RTRIM Availability: Designer Workflow Manager Removes blanks or characters from the end of a string. Any string value. 'abc'. If you do not specify a trim_set parameter in your expression: ♦ ♦ In UNICODE mode. You can also enter a text literal. NULL if a value passed to the function is NULL. trim_set] ) Argument string Meaning Required. 162 Chapter 6: Functions . Passes the values you want to trim. The string values with the specified characters in the trim_set argument removed. Optional. If you use RTRIM to remove characters from a string. Any string value.

Tips You can use RTRIM and LTRIM with || or CONCAT to remove leading and trailing blanks after you concatenate two strings. and so on. For example. This is because RTRIM searches. however. for the set of characters you specify in the trim_set argument. RTRIM removes it. When the character in the string fails to match the trim_set. so RTRIM returns the string 'Nelson' and evaluates the next row. if you want to remove trailing blanks and the character ‘t’ from the end of each string in a column of names. RTRIM compares the second character in the trim_set. 't' ) RTRIM 163 . You can also remove multiple sets of characters by nesting RTRIM. RTRIM removes it. In the last example. Bender Steadman RETURN VALUE Nelson Pag Osborn NULL Sawy H.Example The following expression removes the characters ‘re’ from the strings in the LAST_NAME port: RTRIM( LAST_NAME. 're') LAST_NAME Nelson Page Osborne NULL Sawyer H. the last character in Nelson does not match any character in the trim_set argument. If. RTRIM returns the string and evaluates the next row. the last character in the string does not match. Bend Steadman RTRIM removes ‘e’ from Page even though ‘r’ is the first character in the trim_set. character-by-character. If the last character in the string matches the first character in the trim_set. If the second from last character in the string matches the second character in the trim_set. you might create an expression similar to the following: RTRIM( RTRIM( NAMES ).

Use SETCOUNTVARIABLE in the following transformations: ♦ ♦ ♦ ♦ Expression Filter Router Update Strategy The PowerCenter Server does not save the final value of a mapping variable to the repository when any of the following are true: ♦ ♦ ♦ ♦ The session fails to complete. the PowerCenter Server saves the last current value to the repository. The session is configured for a test load. At the end of the session. it determines the total count for all partitions and saves the total to the repository. The session is a debug session. Returns the new current value. The session runs in debug mode and is configured to discard session output. Use SETCOUNTVARIABLE with mapping variables with a Count aggregation type. Syntax SETCOUNTVARIABLE( $$Variable ) Argument $$Variable Meaning Required. Unless overridden. For details on mapping variables. Decreases the current value by one for each row marked for deletion. Increases the current value by one for each row marked for insertion. the PowerCenter Server generates different current values for each partition. see “Mapping Parameters and Variables” in the Designer Guide. Name of the mapping variable you want to set. it uses the saved value as the initial value of the variable for the next time you use this session. 164 Chapter 6: Functions . At the end of a successful session. When used with a session that contains multiple partitions. Keeps the current value the same for each row marked for update or reject. Use mapping variables with a count aggregation type.SETCOUNTVARIABLE Availability: Designer Counts the rows evaluated by the function and increments the current value of a mapping variable based on the count.

The following expression counts the number of current distributors with the mapping variable $$CurrentDistributors and returns the current value to the CUR_DIST port. It increases the count by one for each inserted row. decreases the count for each deleted row.. Darkroom Co. Darkroom Co. Example You have a mapping that updates a slowly changing dimension table containing distributor information. SETCOUNTVARIABLE 165 .com CUR_DIST 23 24 25 25 24 25 At the end of the session. SETCOUNTVARIABLE ($$CurrentDistributors) (row marked for. The next time the session runs.Return Value The current value of the variable. The PowerCenter Server saves the same value for $$CurrentDistributors to the repository for sessions with multiple partitions as for sessions with a single partition. the PowerCenter Server evaluates the initial value to $$CurrentDistributors to ‘25’.) DIST_ID (update) (insert) (insert) (update) (delete) (insert) 000015 000024 000025 000003 000024 000026 DISTRIBUTOR MSD Inc. the PowerCenter Server saves ‘25’ to the repository as the current value for $$CurrentDistributors. Howard’s Supply JNR Ltd. and keeps the count the same for all updated or rejected rows. The initial value of $$CurrentDistributors from the previous session run is 23.. Supply.

YY. You can change the seconds by entering a positive integer between 0 and 59 in the value argument. 'DD'. or YYYY to set the year. You use the SS format string to set the second. Change the minutes by entering a positive integer between 0 and 59 in the value argument. the expression SET_DATE_PART( SHIP_DATE. With SET_DATE_PART you can change the following parts of a date: ♦ Year. For example. the expression SET_DATE_PART( SHIP_DATE. the expression SET_DATE_PART( SHIP_DATE. Hour. HH24) to set the hour. MONTH to set the month. and 24 =12AM) in the value argument. For example. and DAY) to set the day. 2001 ) changes the year to 2001 for all dates in the SHIP_DATE port. DDD. YYY. You can use any of the month format strings: MM. For example. and November) in the value argument. Change the month by entering a positive integer between 1 and 12 (January=1 and December=12) in the value argument. You can use any of the month format strings (D. Minute. Month. Seconds. MON. 'HH'. You can use any of the year format strings: Y. HH12. DD. 'MONTH'. April. September.SET_DATE_PART Availability: Designer Workflow Manager Sets one part of a date/time value to a value you specify. 14 ) changes the hour to 14:00:00 (or 2:00:00PM) for all dates in the SHIP_DATE port. For example. 10 ) changes the day to 10 for all dates in the SHIP_DATE port. the expression SET_DATE_PART( SHIP_DATE. the expression SET_DATE_PART( SHIP_DATE. Day. Change the hour by entering a positive integer between 0 and 24 (where 0=12AM. Change the year by entering a positive integer in the value argument. ♦ ♦ ♦ ♦ ♦ 166 Chapter 6: Functions . the expression SET_DATE_PART( SHIP_DATE. 25 ) changes the minute to 25 for all dates in the SHIP_DATE port. For example. 12=12PM. 'SS'. 10 ) changes the month to October for all dates in the SHIP_DATE port. DY. You can use any of the hour format strings (HH. 59 ) changes the second to 59 for all dates in the SHIP_DATE port. For example. June. 'YY'. 'MI'. You use the MI format string to set the minute. Change the day by entering a positive integer between 1 and 31 (except for the months that have less than 31 days: February.

Required. Return Value Date in the same format as the source date with the specified part changed. 'HH12'. February 30). A positive integer value assigned to the specified portion of the date. Required. 16 ) SET_DATE_PART( DATE_PROMISED. 'HH'. 'HH24'. The format string is not case-sensitive. 16 ) DATE_PROMISED Jan 1 1997 12:15:56AM Feb 13 1997 2:30:01AM Mar 31 1997 5:10:15PM Dec 12 1997 8:07:33AM NULL RETURN VALUE Jan 1 1997 4:15:56PM Feb 13 1997 4:30:01PM Mar 31 1997 4:10:15PM Dec 12 1997 4:07:33PM NULL SET_DATE_PART 167 . Date/Time datatype. the session fails. 16 ) SET_DATE_PART( DATE_PROMISED. A format string specifying the portion of the date to be changed. The integer must be a valid value for the part of the date you want to change.Syntax SET_DATE_PART( date. The date you want to modify. Example The following expressions change the hour to 4PM for each date in the DATE_PROMISED port: SET_DATE_PART( DATE_PROMISED. You can enter any valid transformation expression. value ) Argument date format value Meaning Required. format. NULL if a value passed to the function is NULL. If you enter an improper value (for example.

2000 ) SET_DATE_PART( DATE_PROMISED. PowerCenter Server doesn't write row.The following expressions change the month to June for the dates in the DATE_PROMISED port. 'YYY'. 'YY'.MM'. you can nest multiple SET_DATE_PART functions within the date argument. 7). 'MONTH'. 'YYYY'. Jun 12 1997 8:07:33AM NULL The following expressions change the year to 2000 for the dates in the DATE_PROMISED port: SET_DATE_PART( DATE_PROMISED. 'DD'. such as changing March 31 to June 31: SET_DATE_PART( DATE_PROMISED. 'MM'. The PowerCenter Server displays an error when you try to create a date that does not exist. 'Y'. 'MON'. 2000 ) SET_DATE_PART( DATE_PROMISED. 2000 ) DATE_PROMISED Jan 1 1997 12:15:56AM Feb 13 1997 2:30:01AM Mar 31 1997 5:10:15PM Dec 12 1997 8:07:33AM NULL RETURN VALUE Jan 1 2000 12:15:56AM Feb 13 2000 2:30:01AM Mar 31 2000 5:10:15PM Dec 12 2000 4:07:33PM NULL Tip If you want to change multiple parts of a date at one time. 6 ) SET_DATE_PART( DATE_PROMISED. you might write the following expression to change all of the dates in the DATE_ENTERED port to July 1 1998: SET_DATE_PART( SET_DATE_PART( SET_DATE_PART( DATE_ENTERED. 6 ) DATE_PROMISED Jan 1 1997 12:15:56AM Feb 13 1997 2:30:01AM Mar 31 1997 5:10:15PM Dec 12 1997 8:07:33AM NULL RETURN VALUE Jun 1 1997 12:15:56AM Jun 13 1997 2:30:01AM Error. 'YYYY'. 6 ) SET_DATE_PART( DATE_PROMISED. 1998). For example. 2000 ) SET_DATE_PART( DATE_PROMISED. 1) 168 Chapter 6: Functions .

the PowerCenter Server generates different current values for each partition. Use SETMAXVARIABLE in the following transformations: ♦ ♦ ♦ ♦ Expression Filter Router Update Strategy The PowerCenter Server does not save the final value of a mapping variable to the repository when any of the following conditions are true: ♦ ♦ ♦ ♦ The session fails to complete. When used with a session that contains multiple partitions. The session is configured for a test load. At the end of a successful session. The SETMAXVARIABLE function executes only if a row is marked as insert. SETMAXVARIABLE returns the higher string based on the sort order selected for the session.SETMAXVARIABLE Availability: Designer Sets the current value of a mapping variable to the higher of two values: the current value of the variable or the value you specify. Returns the new current value. For details on mapping variables. the PowerCenter Server saves the final current value to the repository. it uses the saved value as the initial value of the variable for the next session run. At the end of the session. Use SETMAXVARIABLE with mapping variables with a Max aggregation type. When used with a string mapping variable. SETMAXVARIABLE 169 . SETMAXVARIABLE ignores all other row types and the current value remains unchanged. it saves the highest current value across all partitions to the repository. The session runs in debug mode and is configured to discard session output. Unless overridden. The session is a debug session. see “Mapping Parameters and Variables” in the Designer Guide.

The PowerCenter Server evaluates $$MaxItems for each partition. The initial value of $$MaxItems from the previous session run is 22. Required.Syntax SETMAXVARIABLE( $$Variable. value ) Argument $$Variable value Meaning Required. the PowerCenter Server evaluates the initial value to $$MaxItems to ‘35’. the PowerCenter Server saves ‘35’ to the repository as the maximum current value for $$MaxItems. Name of the mapping variable you want to set. The return value is the new current value of the variable. Return Value The higher of two values: the current value of the variable or the value you specified. You can enter any valid transformation expression that evaluates to a datatype compatible with the datatype of the variable. The value you want the PowerCenter Server to compare against the current value of the variable. ITEMS) TRANSACTION 0100002 0100003 0100004 0100005 0100006 0100007 ITEMS 12 5 18 35 5 14 MAX_ITEMS 22 22 22 35 35 35 At the end of the session. it saves the largest value to the repository. Use mapping variables with Max aggregation type. Suppose the same session contains three partitions. SETMAXVARIABLE ($$MAXITEMS. For example. When value is NULL the PowerCenter Server returns the current value of $$Variable. Example The following expression compares the number of items purchased in each transaction with a mapping variable $$MaxItems. Then. the last evaluated value for $$MaxItems in each partition is as follows: Partition Partition 1 Partition 2 Final Current Value for $$MaxItems 35 23 170 Chapter 6: Functions . The next time the session runs. It sets $$MaxItems to the higher of two values and returns the historically highest number of items purchased in a single transaction to the MAX_ITEMS port.

Partition Partition 3 Final Current Value for $$MaxItems 22 Value for $$MaxItems saved to the repository: 35 SETMAXVARIABLE 171 .

SETMINVARIABLE ignores all other row types and the current value remains unchanged. Unless overridden.SETMINVARIABLE Availability: Designer Sets the current value of a mapping variable to the lower of two values: the current value of the variable or the value you specify. When used with a session that contains multiple partitions. SETMINVARIABLE returns the lower string based on the sort order selected for the session. The session is a debug session. The session runs in debug mode and is configured to discard session output. The SETMINVARIABLE function executes only if a row is marked as insert. the PowerCenter Server saves the final current value to the repository. At the end of the session. the PowerCenter Server generates different current values for each partition. For details on mapping variables. The session is configured for a test load. it saves the lowest current value across all partitions to the repository. it uses the saved value as the initial value of the variable for the next session run. Use SETMINVARIABLE with mapping variables with a Min aggregation type. Use SETMINVARIABLE in the following transformations: ♦ ♦ ♦ ♦ Expression Filter Router Update Strategy The PowerCenter Server does not save the final value of a mapping variable to the repository when any of the following conditions are true: ♦ ♦ ♦ ♦ The session fails to complete. At the end of a successful session. 172 Chapter 6: Functions . When used with a string mapping variable. Returns the new current value. see “Mapping Parameters and Variables” in the Designer Guide.

You can enter any valid transformation expression that evaluates to a datatype compatible with the datatype of the variable.25 24.00 22.25 22.00’. SETMINVARIABLE 173 .00 26. The next time the session runs.Syntax SETMINVARIABLE( $$Variable. The initial value of $$MinPrice from the previous session run is 22.00 MIN_PRICE 22.00’ to the repository as the minimum current value for $$MinPrice. SETMINVARIABLE ($$MinPrice. Example The following expression compares the price of an item with a mapping variable $$MinPrice. When value is NULL the PowerCenter Server returns the current value of $$Variable. value ) Argument $$Variable value Meaning Required.00 24. the PowerCenter Server saves ‘22.00 22.75 23.00 22.50.00 22. PRICE) DATE 05/01/2000 09:00:00 05/01/2000 10:00:00 05/01/2000 11:00:00 05/01/2000 12:00:00 05/01/2000 13:00:00 05/01/2000 14:00:00 05/01/2000 15:00:00 05/01/2000 16:00:00 05/01/2000 17:00:00 PRICE 23.50 22.00 At the end of the session. Name of the mapping variable you want to set. Required. The value you want the PowerCenter Server to compare against the current value of the variable. Use with mapping variables with Min aggregation type. It sets $$MinPrice to the lower of two values and returns the historically lowest item price to the MIN_PRICE port.50 22.50 22.50 27. Return Value The lower of two values: the current value of the variable or the value you specified. The return value is the new current value of the variable.50 22. the PowerCenter Server evaluates the initial value to $$MinPrice to ‘22.00 22.75 25.

The PowerCenter Server evaluates $$MinPrice for each partition.Suppose the same session contains three partitions.00 22. it saves the smallest value to the repository.00 174 Chapter 6: Functions .50 22.50 Value for $$MinPrice saved to the repository: 22. For example. the last evaluated value for $$MinPrice in each partition is as follows: Partition Partition 1 Partition 2 Partition 3 Final Current Value for $$MinPrice 22. Then.

Use SETVARIABLE in the following transformations: ♦ ♦ ♦ ♦ Expression Filter Router Update Strategy The PowerCenter Server does not save the final value of a mapping variable to the repository when any of the following conditions are true: ♦ ♦ ♦ ♦ The session fails to complete. SETVARIABLE ignores all other row types and the current value remains unchanged. Name of the mapping variable you want to set. The session runs in debug mode and is configured to discard session output. the PowerCenter Server uses multiple threads to process that pipeline. the current value of a mapping variable may have indeterministic results. The session is configured for a test load. Based on the aggregate type of the variable. value ) Argument $$Variable value Meaning Required. the PowerCenter Server compares the final current value of the variable to the start value of the variable. SETVARIABLE 175 . Use with mapping variables with Max/Min aggregation type. For details on mapping variables. The session is a debug session. You can enter any valid transformation expression that evaluates to a datatype compatible with the datatype of the variable. The value you want to set the current value of the variable to. Syntax SETVARIABLE( $$Variable.SETVARIABLE Availability: Designer Sets the current value of a mapping variable to a value you specify. it saves a final current value to the repository. see “Mapping Parameters and Variables” in the Designer Guide. Required. The SETVARIABLE function executes only if a row is marked as insert or update. At the end of a successful session. If you use this function more than once for the same variable. When you create multiple partitions in a pipeline. You should use SetVariable function only once for each mapping variable in a pipeline. Unless overridden. it uses the saved value as the initial value of the variable for the next session run. Returns the specified value.

176 Chapter 6: Functions . SYSDATE) TRANSACTION 0100002 0100003 0100004 0100005 0100006 TOTAL 534.23 699.01 97.01 97. TIMESTAMP) TRANSACTION 0100002 0100003 0100004 0100005 0100006 TIMESTAMP 10/01/2000 12:01:01 10/01/2000 12:10:22 10/01/2000 12:16:45 10/01/2000 12:23:10 10/01/2000 12:40:31 TOTAL 534. The following expression sets the mapping variable $$Timestamp to the timestamp associated with the row and returns the timestamp to the SET_$$TIMESTAMP port: SETVARIABLE ($$Time. Example The following expression sets a mapping variable $$Time to the system date at the time the PowerCenter Server evaluates the row and returns the system date to the SET_$$TIME port: SETVARIABLE ($$Time.43 323.23 699.50 116.43 323.95 SET_$$TIMESTAMP 10/01/2000 12:01:01 10/01/2000 12:10:22 10/01/2000 12:16:45 10/01/2000 12:23:10 10/01/2000 12:40:31 At the end of the session. The next time the session runs. When value is NULL the PowerCenter Server returns the current value of $$Variable. the PowerCenter Server saves “10/01/2000 12:40:31” to the repository as the last evaluated current value for $$Timestamp. the PowerCenter Server saves “10/10/2000 01:34:37” to the repository as the last evaluated current value for $$Time.95 SET_$$TIME 10/10/2000 01:34:33 10/10/2000 01:34:34 10/10/2000 01:34:35 10/10/2000 01:34:36 10/10/2000 01:34:37 At the end of the session.Return Value Current value of the variable.50 116. the PowerCenter Server evaluates the initial value of $$Timestamp to “10/01/2000 12:40:31”. the PowerCenter Server evaluates all references to $$Time to “10/10/2000 01:34:37”. The next time the session runs.

negative. NULL if NULL.SIGN Availability: Designer Workflow Manager Returns whether a numeric value is positive. Numeric value. 1 for positive values.99 0 NULL RETURN VALUE 1 -1 0 NULL SIGN 177 . 0 for 0. Syntax SIGN( numeric_value ) Argument numeric_value Meaning Required. or 0. Return Value -1 for negative values. You can enter any valid transformation expression. Passes the values you want to evaluate. Example The following expression tells you if the SALES port includes any negative values: SIGN( SALES ) SALES 100 -25.

NULL if a value passed to the function is NULL. You can also use operators to convert a numeric value to radians or perform arithmetic within the SIN calculation. Numeric datatype.999847695156393 NULL You can perform arithmetic on the values passed to SIN before the function calculates the sine. For example: SIN( ARCS * 3.14159265359 / 180 ) DEGREES 0 90 70 30 5 18 89 NULL RETURN VALUE 0 1 0. Example The following expression converts the values in the Degrees port to radians and then calculates the sine for each radian: SIN( DEGREES * 3.SIN Availability: Designer Workflow Manager Returns the sine of a numeric value (expressed in radians).14159265359 / 180 ) 178 Chapter 6: Functions . Numeric data expressed in radians (degrees multiplied by pi divided by 180).939692620785936 0. Passes the values for which you want to calculate the sine.309016994374967 0. Syntax SIN( numeric_value ) Argument numeric_value Meaning Required. You can enter any valid transformation expression.0871557427476639 0.50000000000003 0. Return Value Double value.

Numeric data expressed in radians (degrees multiplied by pi divided by 180). Syntax SINH( numeric_value ) Argument numeric_value Meaning Required. Passes the values for which you want to calculate the hyperbolic sine.376934801486 0.ARCS / 180 ) SINH 179 .897 3.1752011936438 9.66 5. You can enter any valid transformation expression.345 NULL RETURN VALUE 1.45 0 0. Return Value Double value.SINH Availability: Designer Workflow Manager Returns the hyperbolic sine of the numeric value.03225804884884 19.35188478309993 NULL Tip You can perform arithmetic on the values passed to SINH before the function calculates the hyperbolic sine.0 0. NULL if a value passed to the function is NULL. Example The following expression returns the hyperbolic sine for the values in the Angles port: SINH( ANGLES ) ANGLES 1. Numeric datatype.4178051793031 116.0 2. For example: SINH( MEASURES.

and W unless one of them is the first character in string. F. G.SOUNDEX Availability: Designer Workflow Manager Encodes a string value into a four-character string. For example. S. If string encodes to less than four characters. SOUNDEX encodes the first occurrence and skips the remaining occurrences in the set. P. H. both SOUNDEX(‘JohnRB’) and SOUNDEX(‘JohnRBCD’) return ‘J561’. and encodes it in uppercase. SOUNDEX pads the resulting string with zeroes. SOUNDEX works for characters in the English alphabet (A-Z). Assigns a single code to consonants that sound alike. Skips numbers in string. both SOUNDEX(‘John’) and SOUNDEX(‘john’) return ‘J500’. E. J. SOUNDEX encodes characters according to the following list of rules: ♦ ♦ Uses the first character in string as the first character in the return value. X. SOUNDEX Encoding Guidelines for Consonants Code 1 2 3 4 5 6 Consonant B. N R ♦ ♦ Skips the characters A. O. Encodes the first three unique consonants following the first character in string and ignores the rest. For example. For example. ♦ ♦ ♦ 180 Chapter 6: Functions . If string contains a set of consecutive consonants that use the same code listed in Table 6-2 on page 180. V C. For example. both SOUNDEX(‘Joh12n’) and SOUNDEX(‘1John’) return ‘J500’. Table 6-2 lists SOUNDEX encoding guidelines for consonants: Table 6-2. For example. It uses the first character of the input string as the first character in the return value and encodes the remaining three unique consonants as numbers. SOUNDEX(‘J’) returns ‘J000’. Z D. K. Q. U. I. SOUNDEX(‘AbbpdMN’) returns ‘A135’. For example SOUNDEX(‘A123’) returns ‘A000’ and SOUNDEX(‘MAeiouhwC’) returns ‘M000’. T L M.

No character in string is a letter of the English alphabet. Passes the string value you want to encode.♦ Returns NULL if string is NULL. Must be a character string. Example The following expression encodes the values in the EMPLOYEE_NAME port: SOUNDEX( EMPLOYEE_NAME ) EMPLOYEE_NAME John William jane joh12n 1abc NULL Return Value J500 W450 J500 J500 A120 NULL SOUNDEX 181 . Return Value String. or if all the characters in string are not letters of the English alphabet. You can enter any valid transformation expression. Syntax SOUNDEX( string ) Argument string Meaning Required. NULL if one of the following conditions is true: ♦ ♦ ♦ If value passed to the function is NULL. string is empty.

If you pass a negative value or character value.SQRT Availability: Designer Workflow Manager Returns the square root of a non-negative numeric value. the PowerCenter Server displays a Transformation Evaluation Error and does not write the row.54 RETURN VALUE 10 Error. PowerCenter Server does not write row. Return Value Double value. NULL 7. NULL if a value passed to the function is NULL. Example The following expression returns the square root for the values in the Numbers port: SQRT( NUMBERS ) NUMBERS 100 -100 NULL 60. Passes the values for which you want to calculate a square root. Syntax SQRT( numeric_value ) Argument numeric_value Meaning Required. You can enter any valid transformation expression.78074546557076 The value -100 results in an error during the session. You can perform arithmetic on the values passed to SQRT before the function calculates the square root. 182 Chapter 6: Functions . Positive numeric value. since the function SQRT only evaluates positive numeric values.

Note: If the return value is decimal with precision greater than 15. You can treat null values as zero in aggregate functions or as NULL. you can choose how you want to handle null values in aggregate functions. see “Aggregate Functions” on page 50. For more information on configuring the PowerCenter Server. Nulls If a single value is NULL. You can nest only one other aggregate function within STDDEV.filter_condition] ) Argument numeric_value Meaning Required. You can enter any valid transformation expression. STDDEV is one of several aggregate functions. the PowerCenter Server treats null values as NULLS in aggregate functions. However. This function passes the values for which you want to calculate a standard deviation or the results of a function. or NULL. the function returns NULL. STDDEV is used to analyze statistical data.STDDEV Availability: Designer Returns the standard deviation of the numeric values you pass to this function. or if no rows are selected (for example. FALSE. The filter condition must be a numeric value or evaluate to TRUE. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. You can enter any valid transformation expression. You use aggregate functions in Aggregator transformations only. STDDEV ignores it. NULL if all values passed to the function are NULL. For more information. STDDEV returns NULL. filter_condition Return Value Numeric value. the filter condition evaluates to FALSE or NULL for all rows). You can use operators to average values in different ports. Limits the rows in the search. and the nested function must return a Numeric datatype. Syntax STDDEV( numeric_value [. when you configure the PowerCenter Server. Optional. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. STDDEV 183 . Note: By default. if all values are NULL. However. If you pass an entire port or group of null values. Numeric datatypes.

0 2198.88 in the calculation because the filter_condition specifies sales greater than $2. the return value is zero.60361129688 The function does not include the values 1010.000.0 NULL 8953.0 1010.00 ) SALES 2198.0 153.88 3001.0 2198.90 and 153.00 in the TOTAL_SALES port: STDDEV( SALES.0 2198. returning one value. returning one result for each group. If there is no group by port. If there is no standard deviation. SALES > 2000. 184 Chapter 6: Functions .0 RETURN VALUE: 0 The return value is zero because each row contains the same number (no standard deviation exists).Group By STDDEV groups values based on group by ports you define in the transformation.0 RETURN VALUE: 3254.90 2256. The following expression calculates the standard deviation of all rows in the SALES port: STDDEV(SALES) SALES 2198. Example The following expression calculates the standard deviation of all rows greater than $2000. STDDEV treats all rows as one group.

You can enter any valid transformation expression. The number of characters you want SUBSTR to return. the function returns an empty string. You can enter any valid transformation expression. start length Return Value String. NULL if a value passed to the function is NULL. The position in the string where you want to start counting.SUBSTR Availability: Designer Workflow Manager Returns a portion of a string. start [. SUBSTR searches from the first character in the string. Required. the function converts it to a character string. Optional. If you omit the length argument. If the start position is zero. starting at the beginning of the string. SUBSTR returns all of the characters from the start position to the end of the string. SUBSTR 185 . If you pass a negative integer or zero. Passes the strings you want to search. Must be an integer. If you pass a decimal. including blanks. If you pass a numeric value. SUBSTR locates the start position by counting from the beginning of the string. SUBSTR locates the start position by counting from the end of the string. the function rounds it to the nearest integer value.length] ) Argument string Meaning Required. SUBSTR counts all characters. If the start position is a positive number. You can enter any valid transformation expression. Empty string if you pass a negative or zero length value. Must be an integer greater than zero. Must be a character string. Syntax SUBSTR( string. If the start position is a negative number.

5. -8. 1. 3 ) PHONE 809-555-3915 357-687-6708 NULL RETURN VALUE 809 357 NULL The following expressions return the phone number without the area code for each row in the Phone port: SUBSTR( PHONE.Example The following expressions return the area code for each row in the Phone port: SUBSTR( PHONE. 8 ) PHONE 808-555-0269 809-555-3915 357-687-6708 NULL RETURN VALUE 555-0269 555-3915 687-6708 NULL You can also pass a negative start value to return the phone number for each row in the Phone port. 0. The expression still reads the source string from left to right when returning the result of the length argument: SUBSTR( PHONE. 3 ) PHONE 808-555-0269 809-555-3915 357-687-6708 NULL RETURN VALUE 555 555 687 NULL You can nest INSTR in the start or length argument to search for a specific string and return its position. 186 Chapter 6: Functions . 3 ) PHONE 809-555-0269 357-687-6708 NULL RETURN VALUE 809 357 NULL SUBSTR( PHONE.

' ' .-1. SUBSTR returns all the characters from the start position to the end of the string. '#')-1 ) || SUBSTR( CUST_ID. starting from the end of the string. 2.1 ) . 8) returns ‘bcd’ and SUBSTR('abcd'. 8) returns ‘cd’. 1. For example: SUBSTR('abcd'. -2. INSTR(CUST_ID. '#')+1 ) When the length argument is longer than the string.1. INSTR(CUST_ID. SUBSTR 187 .1 ) CUST_NAME PATRICIA JONES MARY ELLEN SHAH RETURN VALUE PATRICIA MARY ELLEN The following expression strips out the character '#' from a string: SUBSTR( CUST_ID.The following expression evaluates a string.INSTR( CUST_NAME. The expression finds the last (right-most) space in the string and then returns all characters preceding it: SUBSTR( CUST_NAME.

You use aggregate functions in Aggregator transformations only. Note: If the return value is decimal with precision greater than 15. Nulls If a single value is NULL. the PowerCenter Server treats null values as NULLS in aggregate functions. Optional. You can treat null values as zero in aggregate functions or as NULL. filter_condition Return Value Numeric value. filter_condition ] ) Argument numeric_value Meaning Required. FALSE. see “Aggregate Functions” on page 50. For more information on configuring the PowerCenter Server. SUM ignores it. SUM returns NULL.SUM Availability: Designer Returns the sum of all values in the selected port. or NULL. Note: By default. Syntax SUM( numeric_value [. However. For more information. Passes the values you want to add. you can choose how you want to handle null values in aggregate functions. If you pass an entire port or group of null values. 188 Chapter 6: Functions . you can apply a filter to limit the rows you read to calculate the total. Limits the rows in the search. You can nest only one other aggregate function within SUM. when you configure the PowerCenter Server. You can enter any valid transformation expression. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. You can use operators to add values in different ports. the function returns NULL. SUM is one of several aggregate functions. However. The filter condition must be a numeric value or evaluate to TRUE. and the nested function must return a Numeric datatype. You can enter any valid transformation expression. you can enable high precision in the session properties to ensure decimal precision up to 28 digits. Numeric datatype. if all values passed from the port are NULL. or if no rows are selected (for example. the filter condition evaluates to FALSE or NULL for all rows). Optionally. NULL if all values passed to the function are NULL.

Example The following expression returns the sum of all values greater than 2000 in the Sales port: SUM( SALES. returning one result for each group. SUM treats all rows as one group. If there is no group by port.DISCOUNT ) SUM 189 . SALES > 2000 ) SALES 2500. returning one value.Group By SUM groups values based on group by ports you define in the transformation.0 Tip You can perform arithmetic on the values passed to SUM before the function calculates the total.0 1900.0 4519.0 NULL 3458.0 1200. For example: SUM( QTY * PRICE .0 RETURN VALUE: 10477.

2899616310952 NULL 190 Chapter 6: Functions . Example The following expression returns the tangent for all values in the Degrees port: TAN( DEGREES * 3.324919696232929 57. Return Value Double value. Syntax TAN( numeric_value ) Argument numeric_value Meaning Required. NULL if a value passed to the function is NULL.19175359259435 0.0874886635259298 0. Numeric data expressed in radians (degrees multiplied by pi divided by 180).14159 / 180 ) DEGREES 70 50 30 5 18 89 NULL RETURN VALUE 2.74747741945531 1.577350269189672 0. Numeric datatype.TAN Availability: Designer Workflow Manager Returns the tangent of a numeric value (expressed in radians). You can enter any valid transformation expression. Passes the numeric values for which you want to calculate the tangent.

897 3.0 2.0 0. Numeric data expressed in radians (degrees multiplied by pi divided by 180). NULL if a value passed to the function is NULL. Numeric datatype.345 NULL RETURN VALUE 0.998676551914886 0.45 0 0. Example The following expression returns the hyperbolic tangent for the values in the Angles port: TANH( ANGLES ) ANGLES 1. For example: TANH( ARCS / 360 ) TANH 191 .999963084213409 0.66 5. Syntax TANH( numeric_value ) Argument numeric_value Meaning Required.761594155955765 0.331933853503641 NULL Tip You can perform arithmetic on the values passed to TANH before the function calculates the hyperbolic tangent.TANH Availability: Designer Workflow Manager Returns the hyperbolic tangent of the numeric value passed to this function. Return Value Double value. You can enter any valid transformation expression. Passes the numeric values for which you want to calculate the hyperbolic tangent.993926947790665 0.

You can convert the date into any format using the TO_CHAR format strings. TO_CHAR also converts numeric values to strings. Date/Time datatype. Return Value String. Example The following expression converts the dates in the DATE_PROMISED port to text in the format MON DD YYYY: TO_CHAR( DATE_PROMISED. Optional. the function returns a string based on the default date format of MM/DD/YYYY HH24:MI:SS. You can enter any valid transformation expression. 'MON DD YYYY' ) DATE_PROMISED Apr 1 1998 12:00:10AM Feb 22 1998 01:31:10PM Oct 24 1998 02:12:30PM NULL RETURN VALUE 'Apr 01 1998' 'Feb 22 1998' 'Oct 24 1998' NULL 192 Chapter 6: Functions . not the format for the values in the date argument. If you omit the format string. NULL if a value passed to the function is NULL. Enter a valid TO_CHAR format string. The format string defines the format of the return value. Syntax TO_CHAR( date [. Passes the date values you want to convert to character strings.format] ) Argument date format Meaning Required.TO_CHAR (Dates) Availability: Designer Workflow Manager Converts dates to character strings.

If you omit the format_string argument, TO_CHAR returns a string in the default date format:
TO_CHAR( DATE_PROMISED ) DATE_PROMISED Apr 1 1998 12:00:10AM Feb 22 1998 01:31:10PM Oct 24 1998 02:12:30PM NULL RETURN VALUE '04/01/1997 00:00:01' '02/22/1997 13:31:10' '10/24/1997 14:12:30' NULL

The following expressions return the day of the week for each date in a port:
TO_CHAR( DATE_PROMISED, 'D' ) DATE_PROMISED 04-01-1997 12:00:10AM 02-22-1997 01:31:10PM 10-24-1997 02:12:30PM NULL RETURN VALUE '3' '7' '6' NULL TO_CHAR( DATE_PROMISED, 'DAY' ) DATE_PROMISED 04-01-1997 12:00:10AM 02-22-1997 01:31:10PM 10-24-1997 02:12:30PM NULL RETURN VALUE 'Tuesday' 'Saturday' 'Friday' NULL

The following expression returns the day of the month for each date in a port:
TO_CHAR( DATE_PROMISED, 'DD' ) DATE_PROMISED 04-01-1997 12:00:10AM 02-22-1997 01:31:10PM 10-24-1997 02:12:30PM NULL RETURN VALUE '01' '22' '24' NULL

TO_CHAR (Dates)

193

The following expression returns the day of the year for each date in a port:
TO_CHAR( DATE_PROMISED, 'DDD' ) DATE_PROMISED 04-01-1997 12:00:10AM 02-22-1997 01:31:10PM 10-24-1997 02:12:30PM NULL RETURN VALUE '091' '053' '297' NULL

The following expressions return the hour of the day for each date in a port:
TO_CHAR( DATE_PROMISED, 'HH' ) TO_CHAR( DATE_PROMISED, 'HH12' ) DATE_PROMISED RETURN VALUE

04-01-1997 12:00:10AM '12' 02-22-1997 01:31:10PM '01' 10-24-1997 02:12:30PM '02' NULL NULL TO_CHAR( DATE_PROMISED, 'HH24' ) DATE_PROMISED RETURN VALUE

04-01-1997 12:00:10AM '00' 02-22-1997 01:31:10PM '13' 10-24-1997 11:12:30PM '23' NULL NULL

The following expression converts date values to MJD values expressed as strings:
TO_CHAR( SHIP_DATE, 'J') SHIP_DATE Dec 31 1999 03:59:59PM Jan 1 1900 01:02:03AM RETURN_VALUE 2451544 2415021

The following expression converts dates to strings in the format MM/DD/YY:
TO_CHAR( SHIP_DATE, ‘MM/DD/RR’) SHIP_DATE 12/31/1999 01:02:03AM 09/15/1996 03:59:59PM 05/17/2003 12:13:14AM RETURN_VALUE 12/31/99 09/15/96 05/17/03

194

Chapter 6: Functions

You can also use the format string SSSSS in a TO_CHAR expression. For example, the following expression converts the dates in the SHIP_DATE port to strings representing the total seconds since midnight:
TO_CHAR( SHIP_DATE, 'SSSSS') SHIP_DATE 12/31/1999 01:02:03AM 09/15/1996 03:59:59PM RETURN_VALUE 3783 86399

In TO_CHAR expressions, the YY format string produces the same results as the RR format string. The following expression converts dates to strings in the format MM/DD/YY:
TO_CHAR( SHIP_DATE, ‘MM/DD/YY’) SHIP_DATE 12/31/1999 01:02:03AM 09/15/1996 03:59:59PM 05/17/2003 12:13:14AM RETURN_VALUE 12/31/99 09/15/96 05/17/03

The following expression returns the week of the month for each date in a port:
TO_CHAR( DATE_PROMISED, 'W' ) DATE_PROMISED 04-01-1997 12:00:10AM 02-22-1997 01:31:10AM 10-24-1997 02:12:30PM NULL RETURN VALUE 01' 04' 04' NULL

The following expression returns the week of the year for each date in a port:
TO_CHAR( DATE_PROMISED, 'WW' ) DATE_PROMISED 04-01-1997 12:00:10PM 02-22-1997 01:31:10AM 10-24-1997 02:12:30AM NULL RETURN VALUE '18' '08' '43' NULL

Tip
You can combine TO_CHAR and TO_DATE to convert a numeric value for a month into the text value for a month using a function such as:
TO_CHAR( TO_DATE( numeric_month, ‘MM’ ), ‘MONTH’ )

TO_CHAR (Dates)

195

TO_CHAR (Numbers)
Availability: Designer Workflow Manager

Converts numeric values to text strings. TO_CHAR also converts dates to strings. TO_CHAR converts numeric values to text strings as follows:

Converts double values to strings of up to 16 digits, with accuracy up to 15 digits. If you pass a number with more than 15 digits, TO_CHAR rounds the number to the sixteenth digit. Returns decimal notation for numbers in the ranges (-1e16,-1e-16] and [1e-16, 1e16). TO_CHAR returns scientific notation for numbers outside these ranges.

Figure 6-1 illustrates that when TO_CHAR converts numbers to strings, it returns scientific notation for all numbers that fall along the bold line. It returns all other numbers in decimal notation.
Figure 6-1. Ranges for TO_CHAR Notation
scientific notation scientific notation scientific notation

-∞

]
-1e16

(
-1e-16

)
0
1e-16

[
1e16

Note: The PowerCenter Server converts the values 1e-16 and -1e16 to scientific notation, but

returns the values 1e-16 and -1e-16 in decimal notation.

Syntax
TO_CHAR( numeric_value ) Argument numeric_value Meaning Required. Numeric datatype. The numeric value you want to convert to a string. You can enter any valid transformation expression.

Return Value
String. NULL if a value passed to the function is NULL.

196

Chapter 6: Functions

Example
The following expression converts the values in the SALES port to text:
TO_CHAR( SALES ) SALES 1010.99 -15.62567 10842764968208837340 1.234567890123456789e-10 1.23456789012345e17 0 33.15 NULL RETURN VALUE ‘1010.99’ ‘-15.62567’ ‘1.084276496820884e+019’

(rounded to 16th digit)

‘0.0000000001234567890123457’ (greater than 1e-16 but less than 1e16) ‘1.23456789012345e17’ ‘0’ ‘33.15’ NULL

(greater than 1e16)

TO_CHAR (Numbers)

197

For example. Enter a valid TO_DATE format string. You can enter any valid transformation expression. You use the TO_DATE format strings to specify the exact format of the source strings. NULL if you pass a null value to this function. The output port must be date/time for TO_DATE expressions. 198 Chapter 6: Functions . you must use the format string 'MON DD YYYY HH12:MI:SSAM'. The format string must match the parts of the string argument exactly. see “Requirements” on page 44. Must be a string datatype. Passes the values that you want to convert to dates. If it does not. If you omit the format string. format] ) Argument string format Meaning Required. If you are converting two-digit years with TO_DATE. if you pass the string 'Mar 15 1998 12:43:10AM'. Syntax TO_DATE( string [. Optional. For details on the TO_DATE format string. If you pass a string that does not have a time value. Return Value Date. Do not use the YYYY format string. TO_DATE always returns a date and time. use either the RR or YY format string. Warning: The format of the TO_DATE string must exactly match the format string including any date separators. You can map the results of this function to any target column with a date datatype. the date returned always includes the time 00:00:00.TO_DATE Availability: Designer Workflow Manager Converts a character string to a date datatype in the same format as the character string. the PowerCenter Server might return inaccurate values or skip the record. the string value must be in the default date of MM/DD/YYYY HH24:MI:SS.

TO_DATE always returns a date and time. 'MM/DD/YY' ) DATE_PROMISED '01/22/98' '05/03/98' '11/10/98' '10/19/98' NULL RETURN VALUE Jan 22 1998 00:00:00 May 3 1998 00:00:00 Nov 10 1998 00:00:00 Oct 19 1998 00:00:00 NULL The following expression returns date and time values for the strings in the DATE_PROMISED port. PowerCenter Server skips this row. The current year on the machine running the PowerCenter Server is 1998: TO_DATE( DATE_PROMISED. the century will be 19. the return values have the time set to 00:00:00.Example The following expression returns date values for the strings in the DATE_PROMISED port. TO_DATE 199 . If you run a session in the twentieth century. the PowerCenter Server returns an error. If you pass a string that does not have a time value. 'MON DD YYYY HH12:MI:SSAM' ) DATE_PROMISED 'Jan 22 1998 02:14:56PM' 'Mar 15 1998 11:11:11AM' 'Jun 18 1998 10:10:10PM' 'October 19 1998 ' NULL RETURN VALUE Jan 22 1998 02:14:56PM Mar 15 1998 11:11:11AM Jun 18 1998 10:10:10PM Error. the century will be 19. If you run a session in the twentieth century. 'J') SHIP_DATE_MJD_STR ‘2451544’ ‘2415021’ RETURN_VALUE Dec 31 1999 00:00:00 Jan 1 1900 00:00:00 Because the J format string does not include the time portion of a date. The current year on the machine running the PowerCenter Server is 1998: TO_DATE( DATE_PROMISED. NULL The following expression converts strings in the SHIP_DATE_MJD_STRING port to date values in the default date format: TO_DATE (SHIP_DATE_MJD_STR. If you pass a string that does not have a time value. the date returned always includes the time 00:00:00.

The following expression converts a string into a four-digit year format. ‘MM/DD/RR’) DATE_STR ‘04/01/98’ ‘08/17/05’ RETURN VALUE 04/01/1998 00:00:00 08/17/2005 00:00:00 The following expression converts a string into a four-digit year format. ‘MM/DD/YY’) DATE_STR ‘04/01/98’ ‘08/17/05’ RETURN VALUE 04/01/1998 00:00:00 08/17/1905 00:00:00 Note: For the second row. The current year is 1998: TO_DATE( DATE_STR. ‘MM/DD/Y’) DATE_STR ‘04/01/8’ ‘08/17/5’ RETURN VALUE 04/01/1998 00:00:00 08/17/1995 00:00:00 The following expression converts a string into a four-digit year format. The current year is 1998: TO_DATE( DATE_STR. The current year is 1998: TO_DATE( DATE_STR. The current year is 1998: TO_DATE( DATE_STR. 'MM/DD/YYYY SSSSS') DATE_STR ‘12/31/1999 3783’ ‘09/15/1996 86399’ RETURN_VALUE 12/31/1999 01:02:03 09/15/1996 23:59:59 200 Chapter 6: Functions . The following expression converts a string into a four-digit year format. ‘MM/DD/YYY’) DATE_STR RETURN VALUE ‘04/01/998’ 04/01/1998 00:00:00 ‘08/17/995’ 08/17/1995 00:00:00 The following expression converts strings that includes the seconds since midnight to date values: TO_DATE( DATE_STR. RR returns the year 2005 and YY returns the year 1905.

‘MM/DD/YYYY HH24:MI:SS’ ). --if none of the above ERROR( ‘NOT A VALID DATE’) ) You can combine TO_CHAR and TO_DATE to convert a numeric value for a month into the text value for a month using a function such as: TO_CHAR( TO_DATE( numeric_month. ‘MONTH’ ) TO_DATE 201 . TO_DATE( CLOSE_DATE. For example: DECODE( TRUE. if true. --if true.‘MM/DD/YYYY’). if true. ‘MM’ ). ‘MON DD YYYY’).‘MM/DD/YYYY’ ). --test first format IS_DATE( CLOSE_DATE. convert to date TO_DATE( CLOSE_DATE. --test third format. convert to date IS_DATE( CLOSE_DATE.‘MM/DD/YYYY HH24:MI:SS’ ). --test second format.‘MON DD YYYY’). TO_DATE( CLOSE_DATE. convert to date IS_DATE( CLOSE_DATE.If your target accepts different date formats. you can use TO_DATE and IS_DATE with the DECODE function to test for acceptable formats.

3Grove' RETURN VALUE 15. Must be a string or numeric datatype. 3 ) IN_TAX '15.348 NULL 0 202 Chapter 6: Functions . Must be an integer literal between 0 and 28. You can enter any valid transformation expression. Optional. TO_DECIMAL ignores leading spaces. If you omit this argument. inclusive. The datatype is decimal with precision of 10 and scale of 3: TO_DECIMAL( IN_TAX.TO_DECIMAL Availability: Designer Converts a string or numeric value to a decimal value. NULL if a value passed to the function is NULL. Return Value Decimal of precision and scale between 0 and 28. inclusive. Specifies the number of digits allowed after the decimal point. the function returns a value with the same scale as the input value.2' '118. Note: If the return value is decimal with precision greater than 15.200 118. Example This expression uses values from the port IN_TAX. Zero if the value in the selected port is an empty string or a non-numeric character. you can enable high precision in the session properties to ensure decimal precision up to 28 digits.348' NULL 'A12.679 60. Passes the values you want to convert to decimals. Syntax TO_DECIMAL( value [. scale] ) Argument value scale Meaning Required.6789' '60.

Passes the values you want to convert to double values.2 118. TO_FLOAT ignores leading spaces. NULL if a value passed to this function is NULL.348 NULL 0 TO_FLOAT 203 .TO_FLOAT Availability: Designer Workflow Manager Converts a string or numeric value to a double-precision floating point number (the Double datatype). You can enter any valid transformation expression. Zero if the value in the port is blank or a non-numeric character.2' '118. Return Value Double value.3Grove' RETURN VALUE 15. Syntax TO_FLOAT( value ) Argument value Meaning Required. Must be a string or numeric datatype.6789' '60. Example This expression uses values from the port IN_TAX: TO_FLOAT( IN_TAX ) IN_TAX '15.348' NULL 'A12.6789 60.

NULL if the value passed to the function is NULL.87’ RETURN VALUE 15 60 118 NULL 0 123 -15 -15 ‘-15. Zero if the value passed to the function contains alphanumeric characters. flag] ) Argument value flag Meaning Required. String or numeric datatype. TO_INTEGER truncates the decimal portion when the flag is TRUE or a non-zero number. TO_INTEGER rounds the value to the nearest integer when the flag is FALSE or zero. TO_INTEGER syntax contains an optional argument that allows you to choose to round the number to the nearest integer or truncate the decimal portion.348' NULL 'A12. You can enter any valid transformation expression. or the constants TRUE or FALSE. Optional. Passes the value you want to convert to an integer. Syntax TO_INTEGER( value [. TO_INTEGER ignores leading spaces.6789’ ‘-15. Example The following expressions use values from the port IN_TAX: TO_INTEGER( IN_TAX. Return Value ♦ ♦ ♦ Integer. The flag must be an integer literal.2' '118.23’ 204 Chapter 6: Functions . or if you omit this argument. TRUE ) IN_TAX '15.TO_INTEGER Availability: Designer Workflow Manager Converts a string or numeric value to an integer.3Grove' ‘ 123.6789' '60. Specifies whether to truncate or round the decimal portion.

6789’ ‘-15.348' NULL 'A12.2' '118.TO_INTEGER( IN_TAX.23’ TO_INTEGER 205 .3Grove' ‘ 123.6789' '60. FALSE) IN_TAX '15.87’ RETURN VALUE 16 60 118 NULL 0 124 -16 -15 ‘-15.

The date values you want to truncate. 'MM') returns 4/1/1997 00:00:00. If you truncate the year portion of the date. 'HH') returns 4/1/ 1997 13:00:00. For example. 'HH') returns 4/1/1997 11:00:00. the expression TRUNC(6/13/1997 2:30:45. The format string is not case-sensitive. Day. Minute. For example. For example. the function returns the first day of the month with the time set to 00:00:00. the function returns the date with the minutes and seconds set to zero. 'YY') returns 1/1/1997 00:00:00. the function returns Jan 1 of the input year with the time set to 00:00:00. and TRUNC(12/1/1997 3:10:15. Month. If you truncate the month portion of a date. the function truncates the time portion of the date.format] ) Argument date format Meaning Required. 'MM') returns 4/1/1997 00:00:00. and TRUNC(5/22/1997 10:18:30. For example. 'YY') returns 1/1/1997 00:00:00. Enter a valid format string. the expression TRUNC(4/1/1997 11:29:35. the expression TRUNC(6/30/1997 2:30:55. month. Date/Time datatype. 'DD') returns 12/13/1997 00:00:00. If you omit the format string. the expression TRUNC(5/22/1997 10:15:29. If you truncate the hour portion of a date. hour. Hour. 'MI') returns 5/22/1997 10:18:00. 'MI') returns 5/22/1997 10:15:00. setting it to 00:00:00. and TRUNC(12/13/1997 22:30:45. 206 Chapter 6: Functions . or minute. You can also use TRUNC to truncate numbers. the function returns the date with the seconds set to zero. You can enter any valid transformation expression that evaluates to a date. the expression TRUNC(4/15/1997 12:15:00. If you truncate the minute portion of a date. and TRUNC(4/1/1997 13:39:00. You can truncate the following date parts: ♦ Year. If you truncate the day portion of a date. 'DD') returns 6/ 13/1997 00:00:00. and TRUNC(4/30/1997 3:15:46. Optional. day. the function returns the date with the time set to 00:00:00. For example. ♦ ♦ ♦ ♦ Syntax TRUNC( date [.TRUNC (Dates) Availability: Designer Workflow Manager Truncates dates to a specific year.

'Y' ) TRUNC( DATE_SHIPPED. 'MON' ) TRUNC( DATE_SHIPPED. Example The following expressions truncate the year portion of dates in the DATE_SHIPPED port: TRUNC( DATE_SHIPPED.Return Value Date. 'YY' ) TRUNC( DATE_SHIPPED. 'MM' ) TRUNC( DATE_SHIPPED. NULL if a value passed to the function is NULL. 'YYY' ) TRUNC( DATE_SHIPPED. 'MONTH' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Jun 20 1998 3:50:04AM Dec 20 1998 3:29:55PM NULL RETURN VALUE Jan 1 1998 12:00:00AM Apr 1 1998 12:00:00AM Jun 1 1998 12:00:00AM Dec 1 1998 12:00:00AM NULL TRUNC (Dates) 207 . 'YYYY' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Jun 20 1998 3:50:04AM Dec 20 1998 3:29:55PM NULL RETURN VALUE Jan 1 1998 12:00:00AM Jan 1 1998 12:00:00AM Jan 1 1998 12:00:00AM Jan 1 1998 12:00:00AM NULL The following expressions truncate the month portion of each date in the DATE_SHIPPED port: TRUNC( DATE_SHIPPED.

'HH24' ) DATE_SHIPPED Jan 15 1998 2:10:31AM Apr 19 1998 1:31:20PM Jun 20 1998 3:50:04AM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 2:00:00AM Apr 19 1998 1:00:00PM Jun 20 1998 3:00:00AM Dec 20 1998 3:00:00PM Dec 31 1998 11:00:00AM NULL The following expression truncates the minute portion of each date in the DATE_SHIPPED port: TRUNC( DATE_SHIPPED. 'MI' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Jun 20 1998 3:50:04AM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 2:10:00AM Apr 19 1998 1:31:00PM Jun 20 1998 3:50:00AM Dec 20 1998 3:29:00PM Dec 31 1998 11:59:00PM NULL 208 Chapter 6: Functions . 'DAY' ) DATE_SHIPPED Jan 15 1998 2:10:30AM Apr 19 1998 1:31:20PM Jun 20 1998 3:50:04AM Dec 20 1998 3:29:55PM Dec 31 1998 11:59:59PM NULL RETURN VALUE Jan 15 1998 12:00:00AM Apr 19 1998 12:00:00AM Jun 20 1998 12:00:00AM Dec 20 1998 12:00:00AM Dec 31 1998 12:00:00AM NULL The following expressions truncate the hour portion of each date in the DATE_SHIPPED port: TRUNC( DATE_SHIPPED. 'D' ) TRUNC( DATE_SHIPPED. 'DDD' ) TRUNC( DATE_SHIPPED. 'DD' ) TRUNC( DATE_SHIPPED. 'HH12' ) TRUNC( DATE_SHIPPED.The following expressions truncate the day portion of each date in the DATE_SHIPPED port: TRUNC( DATE_SHIPPED. 'DY' ) TRUNC( DATE_SHIPPED. 'HH' ) TRUNC( DATE_SHIPPED.

TRUNC truncates the decimal portion of numeric_value and returns an integer. Return Value Numeric value. TRUNC (Numbers) 209 .TRUNC (Numbers) Availability: Designer Workflow Manager Truncates numbers to a specific digit. Optional. TRUNC changes the specified digits to the left of the decimal point to zeros. Passes the values you want to truncate. Numeric datatype. NULL if one of the arguments is NULL. If you omit the precision argument. If precision is a negative integer. Syntax TRUNC( numeric_value [. You can also use TRUNC to truncate dates. If you pass a decimal precision value. precision If precision is a positive integer. Can be a positive or negative integer. Note: If the return value is decimal with precision greater than 15. TRUNC returns numeric_value with the number of decimal places specified by precision. You can enter any valid transformation expression that evaluates to an integer. The integer specifies the number of digits to truncate. precision] ) Argument numeric_value Meaning Required. the PowerCenter Server rounds numeric_value to the nearest integer before evaluating the expression. You can enter any valid transformation expression that evaluates to a Numeric datatype. you can enable high precision in the session properties to ensure decimal precision up to 28 digits.

99 NULL RETURN VALUE 12.0 56.865 56.99 -18. 3 ) PRICE 12.95 15.0 -180.99 56.0 NULL 210 Chapter 6: Functions . -1 ) PRICE 12.99 -187.9995 -18.86 56.9563 15.0 NULL TRUNC( PRICE ) PRICE 12.9928 NULL RETURN VALUE 12.8652 56.992 NULL TRUNC( PRICE.Example The following expressions truncate the values in the Price port: TRUNC( PRICE.0 50.95 1235.956 15.99 NULL RETURN VALUE 10.0 15.0 -18.0 1230.999 -18.

String datatype. If your data contains multibyte characters. Syntax UPPER( string ) Argument string Meaning Required. Example The following expression changes all names in the FIRST_NAME port to uppercase: UPPER( FIRST_NAME ) FIRST_NAME Ramona NULL THOMAS PierRe Bernice RETURN VALUE RAMONA NULL THOMAS PIERRE BERNICE UPPER 211 .UPPER Availability: Designer Workflow Manager Converts lowercase string characters to uppercase. Passes the values you want to change to uppercase text. You can enter any valid transformation expression. NULL if a value passed to the function is NULL. the return value depends on the code page and data movement mode of the PowerCenter Server. Return Value Uppercase string.

Formula The function uses the following formula to calculate the variance: where: ♦ ♦ xi is one of the numeric values. Return Value Double value. n is the number of elements in the set of numeric values. Numeric datatype. Passes the values for which you want to calculate a variance. Optional. 212 Chapter 6: Functions . For more information. or NULL. You can enter any valid transformation expression. see “Aggregate Functions” on page 50. or if no rows are selected (for example. Syntax VARIANCE( numeric_value [. If n is 1. VARIANCE is used to analyze statistical data. You can nest only one other aggregate function within VARIANCE. the filter_condition evaluates to FALSE or NULL for all rows). You use aggregate functions in Aggregator transformations only. the variance is 0.VARIANCE Availability: Designer Returns the variance of a value you pass to it. and the nested function must return a Numeric datatype. FALSE. NULL if all values passed to the function are NULL. You can enter any valid transformation expression. VARIANCE is one of several aggregate functions. Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE. filter_condition ] ) Argument numeric_value filter_condition Meaning Required.

when you configure the PowerCenter Server. the function returns NULL.0 2256.0 NULL 8953. or if no rows are selected. Example The following expression calculates the variance of all rows in the TOTAL_SALES port: VARIANCE( TOTAL_SALES ) TOTAL_SALES 2198. You can treat null values as zero in aggregate functions or as NULL.0 RETURN VALUE: 10592444.6666667 VARIANCE 213 . VARIANCE treats all rows as one group.0 3001. Note: By default. If there is not a group by port. VARIANCE treats all rows as one group. If you pass an entire port or group of null values.Nulls If a single value is NULL. returning one result for each group. VARIANCE returns NULL. However. you can choose how you want to handle null values in aggregate functions. VARIANCE ignores it. However. returning one value. if all values passed to the function are NULL. see “Installing and Configuring the PowerCenter Server on UNIX” or “Installing and Configuring the PowerCenter Server on Windows” in the Installation and Configuration Guide. Group By VARIANCE groups values based on group by ports you define in the transformation. If there is no group by port. returning one value. For more information on configuring the PowerCenter Server. the PowerCenter Server treats null values as NULLs in aggregate functions.

214 Chapter 6: Functions .

225 Special Functions. 226 Test Functions. 222 Numeric Functions. 227 Variable Functions. 223 Scientific Functions. 220 Date Functions. 215 . 219 Data Cleansing Functions.Appendix A Function Quick Reference This appendix provides a quick reference for all the functions available in PowerCenter. 228 For details on each function. see “Functions” on page 49. 216 Character Functions. 217 Conversion Functions. ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ Aggregate Functions.

filter_condition ] ) MEDIAN( numeric_value [. percentile [. Available in the Designer. Returns the last record in a group. Available in the Designer. Returns the median of all values in a selected port. Returns the standard deviation for a group. in a group. Available in the Designer. filter_condition ] ) or COUNT( * [. found in a group. Returns the maximum value. filter_condition ] ) STDDEV( numeric_value [. FIRST LAST MAX MEDIAN MIN PERCENTILE STDDEV SUM VARIANCE 216 Appendix A: Function Quick Reference . Available in the Designer. filter_condition ] ) FIRST( value [. Available in the Designer. filter_condition ] ) MAX( value [. Available in the Designer. filter_condition ] ) SUM( numeric_value [.Aggregate Functions Function AVG COUNT Syntax AVG( numeric_value [. or latest date. Returns the sum of all records in a group. Returns the first record in a group. Returns the minimum value. filter_condition ] ) MIN( value [. filter_condition ] ) COUNT( value [. or earliest date. filter_condition ] ) LAST( value [. filter_condition ] ) Description Returns the average of all values in a group. filter_condition ] ) VARIANCE( numeric_value [. Returns the number of records with non-null value. Available in the Designer. Available in the Designer. Available in the Designer. Available in the Designer. Returns the variance of all records in a group. Available in the Designer. found in a group. Calculates the value that falls at a given percentile in a group of numbers. filter_condition ] ) PERCENTILE( numeric_value.

trim_set ] ) REPLACECHR REPLACECHR( InputString. In ASCII mode. Available in the Designer and the Workflow Manager. including trailing blanks. Informatica recommends using the CHRCODE function instead of the ASCII function to create new expressions. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. If you use the ASCII function in existing expressions. returns the numeric Unicode value of the first character of the string passed to the function. In Unicode mode. second_string ] ) LTRIM LTRIM( string [. Available in the Designer and the Workflow Manager. counting from left to right. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Concatenates two strings. search_value [. Available in the Designer and the Workflow Manager. This function is identical in behavior to the CHRCODE function. to set a string to a specified length. second_string ) INITCAP( string ) INSTR INSTR( string. Removes blanks or characters from the beginning of a string. OldCharSet. In Unicode mode. Returns the ASCII or Unicode character corresponding to the specified numeric value. returns the numeric ASCII value of the first character of the string passed to the function. however. returns the numeric ASCII value of the first character of the string passed to the function. CHR CHR( numeric_value ) CHRCODE CHRCODE ( string ) CONCAT INITCAP CONCAT( first_string.Character Functions Function ASCII Syntax ASCII ( string ) Description In ASCII mode. returns the numeric Unicode value of the first character of the string passed to the function. start [. Available in the Designer and the Workflow Manager. it will still work correctly. This function is identical in behavior to the ASCII function. NewChar ) Character Functions 217 . Converts uppercase string characters to lowercase. Replaces characters in a string with a single character or no character. Adds a set of blanks or characters to the beginning of a string. Returns the position of a character set in a string. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. length [. occurrence ] ] ) LENGTH LENGTH( string ) LOWER LPAD LOWER( string ) LPAD( first_string. Capitalizes the first letter in each word of a string and converts all other letters to lowercase. Returns the number of characters in a string.

Available in the Designer and the Workflow Manager.. Available in the Designer and the Workflow Manager. length ] ) UPPER( string ) 218 Appendix A: Function Quick Reference . Available in the Designer and the Workflow Manager. second_string ] ) Description Replaces characters in a string with a single character. OldString1. Returns a portion of a string.] NewString ) RPAD( first_string. Available in the Designer and the Workflow Manager.. start [. Available in the Designer and the Workflow Manager. Removes blanks or characters from the end of a string. length [. trim_set ] ) SUBSTR( string. [OldString2. . Converts lowercase string characters to uppercase. or no character. RPAD RTRIM SUBSTR UPPER RTRIM( string [.Function REPLACESTR Syntax REPLACESTR ( InputString. OldStringN. Converts a string to a specified length by adding blanks or characters to the end of the string. multiple characters.

format ] ) TO_DATE( string [. scale ] ) TO_FLOAT( value ) TO_INTEGER TO_INTEGER( value ) Conversion Functions 219 . Converts any value (except binary) to an integer by rounding the decimal portion of a value. Converts any value (except binary) to a double-precision floating point number (the Double datatype).Conversion Functions Function TO_CHAR TO_DATE Syntax TO_CHAR( numeric_value ) TO_CHAR( date [. Available in the Designer and the Workflow Manager. format ] ) Description Converts numeric values and dates to text strings. Converts a character string to a date datatype in the same format as the character string. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Converts any value (except binary) to a decimal. Available in the Designer. TO_DECIMAL TO_FLOAT TO_DECIMAL( value [. Available in the Designer and the Workflow Manager.

Converts any value (except binary) to a decimal. Replaces characters in a string with a single character or no character. Available in the Designer and the Workflow Manager. Returns a portion of a string. REPLACECHR REPLACESTR REPLACECHR( InputString. Returns whether a value consists entirely of spaces. Replaces characters in a string with a single character. multiple characters.Data Cleansing Functions Function INSTR IS_DATE IS_NUMBER IS_SPACES ISNULL LTRIM METAPHONE Syntax INSTR( string. Removes blanks or characters from the beginning of a string. format ] ) RTRIM SOUNDEX SUBSTR TO_CHAR TO_DATE TO_DECIMAL TO_DECIMAL( value [. Encodes a string value into a four-character string. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Returns whether a value is a valid date. NewChar ) REPLACESTR ( InputString. search_value [.. format ] ) TO_DATE( string [. trim_set ] ) METAPHONE( string [. It encodes both uppercase and lowercase letters in uppercase. start [. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. trim_set ] ) SOUNDEX( string ) SUBSTR( string.. OldCharSet. or no character. . OldString1. counting from left to right. OldStringN. Available in the Designer and the Workflow Manager. occurrence ] ] ) IS_DATE( value ) IS_NUMBER( value ) IS_SPACES( value ) ISNULL( value ) LTRIM( string [. Available in the Designer and the Workflow Manager. Available in the Designer.length] ) Description Returns the position of a character set in a string. Available in the Designer and the Workflow Manager. Converts a character string to a date datatype in the same format as the character string. [OldString2. length ] ) TO_CHAR( numeric_value ) TO_CHAR( date [. Available in the Designer and the Workflow Manager. Encodes characters of the English language alphabet (A-Z). Available in the Designer and the Workflow Manager. Returns whether a value is NULL. Converts numeric values and dates to text strings. scale ] ) 220 Appendix A: Function Quick Reference . start [. Removes blanks or characters from the end of a string. Returns whether a string is a valid number. Available in the Designer and the Workflow Manager.] NewString ) RTRIM( string [. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager.

Converts any value (except binary) to an integer by rounding the decimal portion of a value. TO_INTEGER TO_INTEGER( value ) Data Cleansing Functions 221 .Function TO_FLOAT Syntax TO_FLOAT( value ) Description Converts any value (except binary) to a double-precision floating point number (the Double datatype). Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager.

the PowerCenter Server assumes the date is in the current century. and returns a date in the same format as the specified date. Available in the Designer and the Workflow Manager. value ) TRUNC( date [. Returns the length of time between two dates. Returns the date of the last day of the month for each date in a port. Available in the Designer and the Workflow Manager. DATE_COMPARE DATE_DIFF DATE_COMPARE( date1. amount ) Description Adds a specified amount to one part of a date/time value. format. date2. measured in the specified increment (years. format. or seconds).Date Functions Function ADD_TO_DATE Syntax ADD_TO_DATE( date. Rounds one part of a date. Returns the earliest date found in a group. format ] ) SET_DATE_PART( date. Available in the Designer and the Workflow Manager. hours. days. format ) GET_DATE_PART GET_DATE_PART( date. Returns the latest date found in a group. filter_condition ) ROUND( date [. Available in the Designer and the Workflow Manager. format ] ) 222 Appendix A: Function Quick Reference . date2 ) DATE_DIFF( date1. month. Available in the Designer. filter_condition ) MIN( date. Returns the specified part of a date as an integer value. or minute. minutes. Available in the Designer and the Workflow Manager. Note: If you do not specify the year as YYYY. months. Available in the Designer and the Workflow Manager. Truncates dates to a specific year. format ) LAST_DAY MAX MIN ROUND SET_DATE_PART TRUNC LAST_DAY( date ) MAX( date. based on the default date format of MM/DD/YYYY HH24:MI:SS. Sets one part of a date/time value to a specified value. day. hour. Available in the Designer. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Returns a value indicating the earlier of two dates.

filter_condition ] ) POWER( base. or 0. Available in the Designer and the Workflow Manager. filter_condition ] ) MOVINGSUM( numeric_value. CEIL CEIL( numeric_value ) CUME EXP CUME( numeric_value [.71828183. Returns the logarithm of a numeric value. recordset [. Available in the Designer and the Workflow Manager. exponent ) MOD( numeric_value. Available in the Designer and the Workflow Manager. Available in the Designer. Notes whether a numeric value is positive. Available in the Designer and the Workflow Manager. Returns a value raised to the specified exponent. Returns a running total of all numeric values. Available in the Designer and the Workflow Manager. Returns the average (record-by-record) of a specified set of records. Available in the Designer. Returns the smallest integer greater than or equal to the specified numeric value. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. recordset [. filter_condition ] ) EXP( exponent ) FLOOR FLOOR( numeric_value ) LN LN( numeric_value ) LOG MOD LOG( base. Returns e raised to the specified power (exponent). Returns the sum (record-by-record) of a specified set of records. exponent ) ROUND SIGN ROUND( numeric_value [. Available in the Designer. divisor ) MOVINGAVG MOVINGSUM POWER MOVINGAVG( numeric_value. where e=2. precision ] ) SIGN( numeric_value ) Numeric Functions 223 . Returns the largest integer less than or equal to the specified numeric value. Available in the Designer and the Workflow Manager. Returns the natural logarithm of a numeric value. Available in the Designer and the Workflow Manager. Rounds numbers to a specified digit. Available in the Designer and the Workflow Manager. Returns the remainder of a division calculation. negative.Numeric Functions Function ABS Syntax ABS( numeric_value ) Description Returns the absolute value of a numeric value.

Function SQRT Syntax SQRT( numeric_value ) Description Returns the square root of a positive numeric value. TRUNC TRUNC( numeric_value [. Truncates numbers to a specific digit. precision ]) 224 Appendix A: Function Quick Reference . Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager.

Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Returns the hyperbolic sin of a numeric value (expressed in radians).Scientific Functions Function COS COSH SIN SINH TAN TANH Syntax COS( numeric_value ) COSH( numeric_value ) SIN( numeric_value ) SINH( numeric_value ) TAN( numeric_value ) TANH( numeric_value ) Description Returns the cosine of a numeric value (expressed in radians). Returns the hyperbolic tangent of a numeric value (expressed in radians). Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager. Scientific Functions 225 . Available in the Designer and the Workflow Manager. Returns the sin of a numeric value (expressed in radians). Available in the Designer and the Workflow Manager. Returns the hyperbolic cosine of a numeric value (expressed in radians). Returns the tangent of a numeric value (expressed in radians).

value2 [. default ] ) ERROR( string ) Description Stops the session and issues a specified error message. value2]… ) 226 Appendix A: Function Quick Reference . first_search. search1. search2.Special Functions Function ABORT DECODE ERROR Syntax ABORT( string ) DECODE( value. Searches a port for the specified value. Available in the Designer. Searches for a value in a lookup source column. second_result ]…[. first_result [. value2 ] ) LOOKUP LOOKUP( result. Available in the Designer. second_search. Causes the PowerCenter Server to skip a record and issue the specified error message. Returns one of two values you specify. Available in the Designer. Available in the Designer and the Workflow Manager. based on the results of a condition. Informatica recommends using the Lookup transformation. IIF IIF( condition. value1 [. Available in the Designer and the Workflow Manager.

Available in the Designer and the Workflow Manager. Returns whether a value is NULL. Test Functions 227 . Available in the Designer and the Workflow Manager. Returns whether a string is a valid number. Returns whether a value consists entirely of spaces.Test Functions Function IS_DATE IS_NUMBER IS_SPACES ISNULL Syntax IS_DATE( value ) IS_NUMBER( value ) IS_SPACES( value ) ISNULL( value ) Description Returns whether a value is a valid date. Available in the Designer and the Workflow Manager. Available in the Designer and the Workflow Manager.

Available in the Designer.Variable Functions Function SETCOUNTVARIABLE Syntax SETCOUNTVARIABLE( $$Variable ) Description Counts the rows evaluated by the function and increments the current value of a mapping based on the count. Available in the Designer. Returns the specified value. Sets the current value of a mapping variable to the higher of two values: the current value of the variable or the value specified. value ) SETVARIABLE SETVARIABLE( $$Variable. Available in the Designer. value ) 228 Appendix A: Function Quick Reference . Sets the current value of a mapping variable to a value you specify. Returns the new current value. SETMAXVARIABLE SETMAXVARIABLE( $$Variable. Returns the new current value. Available in the Designer. value ) SETMINVARIABLE SETMINVARIABLE( $$Variable. Sets the current value of a mapping variable to the lower of two values: the current value of the variable or the value specified.

Index A ABORT function description 58 ABS function description 59 absolute values obtaining 59 ADD_TO_DATE function description 60 aggregate functions AVG 65 COUNT 76 description 50 FIRST 91 LAST 111 list of 216 MAX (dates) 125 MAX (numbers) 126 MEDIAN 128 MIN (dates) 133 MIN (numbers) 135 null values 18. 120. 211 229 . 52 PERCENTILE 143 STDDEV 183 SUM 188 VARIANCE 212 AND reserved word 10 arithmetic date/time values 47 arithmetic operators description 23 using strings in expressions 23 using to convert data 23 ASCII See also Installation and Configuration Guide See also Workflow Administration Guide CHR function 68 converting ASCII values 68 converting characters to ASCII values 63 converting to Unicode values 70 ASCII function description 63 average aggregate functions for determining 65 returning 139 AVG function description 65 C calendars date types supported 34 capitalization strings 99.

case converting to uppercase 211 CEIL function description 67 character functions ASCII 63 CHR 68 CHRCODE 70 CONCAT function 72 INITCAP 99 INSTR 100 LENGTH 115 list of 52 LOWER 120 LPAD 121 LTRIM 123 METAPHONE 130 REPLACECHR 148 REPLACESTR 151 RPAD 160 RTRIM 162 SOUNDEX 180 SUBSTR 185 summary 217 UPPER 211 character strings converting from dates 192 converting to dates 198 characters adding to strings 121. 68. 68 capitalization 99. 211 counting 185 encoding 130. 162 replacing multiple 151 replacing one 148 returning number 115 Unicode characters 63. 69 CHRCODE function description 70 comments adding to expressions 9 comparison operators description 25 using strings in expressions 25 CONCAT function description 72 inserting single quotes using 73 concatenating strings 24. 70 CHR function description 68 inserting single quotes 6. 72 constants DD_INSERT 13 DD_REJECT 14 DD_UPDATE 15 definition 2 FALSE 16 NULL 17 TRUE 19 conversion functions description 53 summary 219 TO_CHAR (dates) 192 TO_CHAR (numbers) 196 TO_DATE 198 TO_DECIMAL 202 TO_FLOAT 203 TO_INTEGER 204 converting date strings 35 COS function description 74 COSH function description 75 cosine calculating 74 calculating hyperbolic cosine 75 COUNT function description 76 CUME function description 79 D data cleansing functions description 53 summary 220 datatypes Date/Time 34 date functions ADD_TO_DATE 60 DATE_COMPARE 81 DATE_DIFF 82 GET_DATE_PART 94 LAST_DAY 113 MAX (dates) 125 MIN (dates) 133 ROUND 154 230 Index . 180 removing from strings 123. 160 ASCII characters 63. 120.

SET_DATE_PART 166 summary 222 TRUNC (Dates) 206 date/time values adding 60 DATE_COMPARE function description 81 DATE_DIFF function description 82 dates See also date functions converting to character strings 192 default format 37 flat files 37 format strings 39 functions 54 Julian 34 Modified Julian 34 overview 34 performing arithmetic 47 relational databases 37 rounding 154 truncating 206 year 2000 35 DD_DELETE constant description 12 reserved word 10 update strategy example 12 DD_INSERT constant description 13 reserved word 10 update strategy example 13 DD_REJECT constant description 14 reserved word 10 update strategy example 14 DD_UPDATE constant description 15 reserved word 10 update strategy example 15 decimal arithmetic See high precision decimal values converting 202 DECODE function description 85 internationalization 3 default date format defined 37 default value See also Designer Guide ERROR function 88 division calculation returning remainder 137 documentation conventions xxv description xxiv online xxv double precision values floating point numbers 203 E empty string testing for 115 encoding characters 130. 180 ERROR function default value 88 description 88 EXP function description 90 exponent values calculating 90 returning 146 expressions See also Designer Guide adding comments 9 conditional 16 in transformations 2 overview 3 syntax 5 using operators 22 using SYSDATE 29 :EXT reference qualifier description 6 reserved word 10 F FALSE constant description 16 reserved word 10 filter conditions aggregate functions 52 null values 18 Filter transformation See also Transformation Guide using ISNULL function 103 FIRST function description 91 Index 231 .

44 TO_CHAR function 40 TO_DATE function 43 functions aggregate 50. 223 scientific 55. 216 categories 50 character 52. 220 date 54. 226 test 56. 222 definition 2 internationalization 3 numeric 55. 44 matching 44 Modified Julian day 40. 225 special 55. 219 data cleansing 53. 217 conversion 53. 227 variable 56 MOVINGAVG function 139 MOVINGSUM function 141 PERCENTILE function 143 ROUND function 157 STDDEV function 183 SUM function 188 TO_DECIMAL function 202 TRUNC function 209 hyperbolic cosine function 75 hyperbolic sine function 179 hyperbolic tangent function 191 I IIF function description 96 internationalization 3 Informatica documentation xxiv Webzine xxvi INITCAP function description 99 internationalization 3 INSTR function description 100 integers converting other values 204 internationalization functions affected 3 invalid expression 3 sort order 3 IS_DATE function description 104 format strings 43 IS_NUMBER function description 107 IS_SPACES function description 109 ISNULL function description 103 G GET_DATE_PART function description 94 Gregorian calendar in date functions 34 H high precision See also Workflow Administration Guide ABS function 59 AVG function 65 CUME function 79 MAX function 126 MEDIAN function 128 MIN function 135 232 Index J J format string using with IS_DATE 45 using with TO_CHAR 42 using with TO_DATE 45 .flat files dates 37 floating point number See double precision values FLOOR function description 93 format from character string to date 198 from date to character string 192 format strings dates 39 definition 34 IS_DATE function 43 Julian day 40.

44 month returning last day 113 MOVINGAVG function description 139 MOVINGSUM function description 141 multiple searches example of TRUE constant 19 N negative values SIGN 177 nested expressions operators 22 NOT reserved word 10 NULL constant description 17 reserved word 10 M mapping parameters See also Designer Guide definition 2 Index 233 .Julian dates in date functions 34 Julian day format string 40. 44 L LAST function description 111 LAST_DAY function description 113 LENGTH function description 115 empty string test 115 literals single quotes in 69. 73 single quotes requirement 6 :LKP reference qualifier description 6 reserved word 10 LN function description 116 local variables definition 2 description 31 LOG function description 117 logarithm returning 116. 117 logical operators description 26 LOOKUP function description 118 Lookup transformation See also Designer Guide instead of LOOKUP function 118 LOWER function description 120 internationalization 3 LPAD function description 121 LTRIM function description 123 mapping variables See also Designer Guide definition 2 mappings See Designer Guide MAX (dates) function description 125 internationalization 3 MAX (numbers) function description 126 internationalization 3 MEDIAN function description 128 METAPHONE description 130 milliseconds truncating 34 MIN (dates) function description 133 internationalization 3 MIN (numbers) function description 135 internationalization 3 minimum value returning 133 MOD function description 137 Modified Julian day format string 40.

52 checking for 103 filter conditions 18 in comparison expressions 17 ISNULL 103 logical operators 26 operators 18 string operator 24 numbers rounding 157 truncating 209 numeric functions ABS 59 CEIL 67 CUME 79 description 55 EXP 90 FLOOR 93 LN 116 LOG 117 MOD 137 MOVINGAVG 139 MOVINGSUM 141 POWER 146 ROUND (numbers) 157 SIGN 177 SQRT 182 summary 223 TRUNC (numbers) 209 numeric values converting to text strings 196 returning absolute value 59 returning cosine 74 returning hyperbolic cosine of 75 returning hyperbolic sine 179 returning hyperbolic tangent 191 returning logarithms 116. 117 returning minimum 135 returning sine 178 returning square root 182 returning standard deviation 183 returning tangent 190 SIGN 177 operators arithmetic 23 comparison operators 25 definition 2 logical operators 26 null values 18 string operators 24 using strings in arithmetic 23 using strings in comparison 25 OR reserved word 10 P PERCENTILE function description 143 ports syntax 6 positive values SIGN 177 POWER function description 146 PowerCenter Server handling nulls in comparison expressions 17 PowerMart 3.5 functions LOOKUP 118 primary key constraint null values 17 PROC_RESULT variable reserved word 10 Q quotation marks inserting single using CHR function 6 R reference qualifiers description 6 relational databases dates 37 REPLACECHR function description 148 REPLACESTR function description 151 reserved words list 10 O operator precedence expressions 22 234 Index .null values aggregate functions 18.

47 SET_DATE_PART function description 166 SETCOUNTVARIABLE function description 164 SETMAXVARIABLE function description 169 SETMINVARIABLE function description 172 SETVARIABLE function description 175 SIGN function description 177 SIN function description 178 sine returning 178.return values definition 2 syntax 6 ROUND (dates) function description 154 ROUND (numbers) function description 157 rounding dates 154 numbers 157 rows avoiding spaces 109 counting 76 returning average 139 returning first row 91 returning last row 111 returning sum 141 running total 79 skipping 88 RPAD function description 160 RR format string description 35 difference between YY and RR 36 using with IS_DATE 45 using with TO_CHAR 42 using with TO_DATE 45 RTRIM function description 162 running total returning 79 S scientific functions COS function 74 COSH 75 description 55 SIN 178 SINH 179 summary 225 TAN 190 TANH 191 :SD reference qualifier description 6 reserved word 10 :SEQ reference qualifier description 6 reserved word 10 sessions stopping 58 $$$SessStartTime description 28 example using in date functions 28 SESSSTARTTIME variable description 29 reserved word 10 using in date functions 29. 179 single quotes in string literals CHR function 69 using CHR and CONCAT functions 73 SINH function description 179 skipping rows 88 sort order internationalization 3 SOUNDEX description 180 :SP reference qualifier description 6 reserved word 10 spaces avoiding in rows 109 removing with DD_REJECT 14 special functions ABORT 58 DECODE 85 description 55 ERROR 88 IIF 96 LOOKUP 118 summary 226 Index 235 .

73 single quotes requirement 6 string operators description 24 strings adding blanks 121 adding characters 121 capitalization 99.SPOUTPUT reserved word 10 SQRT function description 182 square root returning 182 SSSSS format string using with IS_DATE 46 using with TO_CHAR 42 using with TO_DATE 46 standard deviation returning 183 STDDEV function description 183 stopping sessions 58 string conversion dates 35 string literals single quotes in 69. 188 SUM function description 188 syntax expression 5 general rules 7 ports 6 return values 6 SYSDATE variable description 29 example 29 reserved word 10 system variables description 28 T TAN function description 190 tangent returning 190. 120. 211 character set 100 concatenating 24. 191 TANH function description 191 TC_COMMIT_AFTER variable description 31 TC_COMMIT_BEFORE variable description 31 TC_CONTINUE_TRANSACTION variable description 31 TC_ROLLBACK_BEFORE variable description 31 :TD reference qualifier description 6 reserved word 10 test functions description 56 IS_DATE 104 IS_NUMBER 107 IS_SPACES 109 ISNULL 103 summary 227 text strings converting numeric values 196 TO_CHAR (dates) function description 192 examples 41 format strings 40 TO_CHAR (numbers) function description 196 TO_DATE function description 198 examples 45 format strings 43 TO_DECIMAL function description 202 TO_FLOAT function description 203 236 Index . 72 converting character strings to dates 198 converting dates to characters 192 converting length 160 converting numeric values to text strings 196 number of characters 115 removing blanks 123 removing blanks and characters 162 removing characters 123 replacing multiple characters 151 replacing one character 148 returning portion 185 SUBSTR function description 185 sum returning 141.

TO_INTEGER function description 204 transaction control variables description 31 transformation expressions null constraints 17 overview 3 transformation language compared to SQL 5 operators 22 overview 2 reserved words 10 transformation language components overview 2 transformation language updates boolean expressions 17 comparison expressions 17 transformations See Designer Guide TRUE constant description 19 reserved word 10 TRUNC (dates) function description 206 TRUNC (numbers) function description 209 truncating date/time values 34 dates 206 numbers 209 V variable functions description 56 SETCOUNTVARIABLE 164 SETMAXVARIABLE 169 SETMINVARIABLE 172 SETVARIABLE 175 with multiple partitions 56 variables $$$SessStartTime 28 local variables 31 SESSSTARTTIME 29 SYSDATE 29 system variables 28 TC_COMMIT_AFTER 31 TC_COMMIT_BEFORE 31 TC_CONTINUE_TRANSACTION 31 TC_ROLLBACK_BEFORE 31 transaction control variables 31 WORKFLOWSTARTTIME 29 VARIANCE function description 212 W webzine xxvi workflow variables definition 2 WORKFLOWSTARTTIME variable description 29 reserved word 10 using in date functions 30 U Unicode See also Installation and Configuration Guide See also Workflow Administration Guide converting characters to Unicode values 63 converting to ASCII values 70 converting Unicode values 68 update strategy DD_DELETE example 12 DD_INSERT example 13 DD_REJECT example 14 DD_UPDATE example 15 UPPER function description 211 internationalization 3 Y year 2000 dates 35 YY format string difference between RR and YY 36 using with IS_DATE 45 using with TO_CHAR 42 using with TO_DATE 45 Index 237 .

238 Index .

Sign up to vote on this title
UsefulNot useful