a Developers Functions

Embed Size (px)

Citation preview

  • 8/2/2019 a Developers Functions

    1/18

    InformaticaDevelopersFunctions

    &

    Examples

  • 8/2/2019 a Developers Functions

    2/18

    INDEX

    Character Functions:

    1.1 LENGTH:1.2 LPAD:1.3 LTRIM:1.4 RPAD:1.5 RTRIM:1.6 SUBSTR:

    2 Conversion Functions:

    2.1 TO_CHAR:2.2 TO_DATE:2.3 TO_DECIMAL:

    2.4 TO_FLOAT:2.5 TO_INTEGER:

    3 Date Functions:

    3.1 ADD_TO_DATE3.2 DATE_COMPARE3.3 DATE_DIFF3.4 GET_DATE_PART3.5 LAST_DAY3.6 MAX3.7 MIN3.8 ROUND3.9 SET_DATE_PART3.10 TRUNC

    4 Special Functions:

    4.1 DECODE4.2 IIF4.3 ERROR:4.4 LOOKUP:

    5 Test Functions:

    5.1 ISNULL5.2 IS_DATE

    5.3 IS_NUMBER5.4 IS_SPACES

  • 8/2/2019 a Developers Functions

    3/18

    Character Functions:

    LENGTH:

    The LENGTH function returns the number of characters in a string, including

    trailing blanks. It is available in the Designer and the Workflow Manager.

    LENGTH (string)

    Example: The following expression returns the length of each customer name:

    LENGTH (CUSTOMER_NAME)

    CUSTOMER_NAME------------RETURN VALUE

    Leonardo------------------------8

    NULL ---------------------------NULLEdwin Britto ---------------------12

    1.2 LPAD:

    The LPAD function adds a set of blanks or characters to the beginning of a string,

    to set a string to a specified length. It is available in the Designer and the WorkflowManager.

    LPAD (first_string, length [, second_string])

    Example: The following expression standardizes numbers to five digits by paddingthem with leading zeros.

    LPAD (NUM, 5, '0')

    NUM ----------------------------RETURN VALUE

    1 --------------------------------00001

    250 -----------------------------00250

    1.3 LTRIM:

    The LTRIM function removes blanks or characters from the beginning of a string. It is

    available in the Designer and the Workflow Manager.

    LTRIM (string [, trim_set])

    LTRIM (string) removes the leading spaces or blanks from the string. WhenLTRIM function is used with a trim set, which is optional, it removes the characters

    in the trim set from the string.

    Example: The following expression removes the leading zeroes in the port

    ITEM_CODE.

    LTRIM (ITEM_CODE,'0')

    ITEM_CODE -----------------RETURN VALUE

    006 ---------------------------6

  • 8/2/2019 a Developers Functions

    4/18

    0803 --------------------------803

    * The LTRIM function can be nested when needed to remove multiple characters.

    1.4 RPAD:

    The RPAD function converts a string to a specified length by adding blanks or characters

    to the end of the string. It is available in the Designer and the Workflow Manager.RPAD( first_string, length [, second_string ] )

    Example: The following expression returns the string with a length of 5 characters,

    appending the string ':' to the end of each word:RPAD (WORD, 5, ':)

    WORD ------------------------RETURN VALUE

    Date -------------------------- Date:Time --------------------------Time:

    1.5 RTRIM:

    The RTRIM function removes blanks or characters from the end of a string. It is

    available in the Designer and the Workflow Manager.RTRIM (string [, trim_set])

    The RTRIM function can be combined with the LENGTH function if the trailingblanks are to be ignored. It can also be nested when needed to remove multiple

    characters.

    RTRIM (string) removes the trailing spaces or blanks from the string. When

    RTRIM function is used with a trimset, which is optional, it removes the characters

    in the trimset from the string.

    For example,

    RTRIM (ITEM_CODE,'10')

    The above expression removes the characters 10 in the port ITEM_CODE.ITEM_CODE -----------------------------RETURN VALUE

    0610 -------------------------------------06

    380 ---------------------------------------38

    In the second example the function removes the trailing zero since the RTRIM

    compares the first character in the trimset with the last character of the string, sinceit does not match it takes the second character in the trimset and compares with last

    character of the string. Since it matches it removes it.

  • 8/2/2019 a Developers Functions

    5/18

    1.6 SUBSTR:

    The SUBSTR function returns a portion of a string. It is available in the Designerand the Workflow Manager.

    SUBSTR( string, start [, length ] )

    The SUBSTR may not give the desired result if the string on which it is used is not

    trimmed. Though it is always a good practice to trim the strings before using them

    in any expression, it becomes extremely important to trim them if they are used in a

    SUBSTR function.

    For example, if there is a function

    SUBSTR (NAME, 2,2)

    It will not return the 2,3 characters of the NAME if the port has leading spaces. Inthis case LTRIM becomes essential.

    SUBSTR(LTRIM(NAME),2,2)

    The SUBSTR function can also be used to get the last few characters as described

    below.

    SUBSTR(NAME,-3,3)

    This function will return the last three characters of the string. But it may not return

    the required last three characters if the port has trailing blanks, hence RTRIM isessential.

    SUBSTR(RTRIM(NAME),-3,3)Hence it is always better to trim the strings before using them in a SUBSTR

    function.

    SUBSTR(LTRIM(RTRIM(NAME)),3,2)

    The above expression will get the 3,4 character of the port NAME irrespective of

    whether the port has leading or trailing blanks or not.

  • 8/2/2019 a Developers Functions

    6/18

    Conversion Functions:

    2.1 TO_CHAR:

    The TO_CHAR function converts numeric values and dates to text strings. It is available in theDesigner and the Workflow Manager.TO_CHAR( numeric_value )TO_CHAR (date [, format ] )

    Example : The following expression converts the values in the SALES port to text:TO_CHAR (SALES )SALES --------------------RETURN VALUE1800.03 ------------------'1800.03'-22.57891 -----------------'-22.57891'

    The following expression converts the dates in the DATE_PROMISED port to text in the format MONDD YYYY:TO_CHAR (DATE_PROMISED, 'MON DD YYYY' )

    DATE_PROMISED ----------------------RETURN VALUEApr 1 1998 12:00:10AM -----------------'Apr 01 1998'

    If we omit the format_string argument, TO_CHAR returns a string in the default date formatMM/DD/YYYY.

    We can use Conversion functions with DATE functions in order to do some calculations.The following composite expression converts the string DATE_PROMISED to date, adds 1 to it andthen converts the same to text string with the format YYYYMMDD.

    TO_CHAR(ADD_TO_DATE(TO_DATE(DATE_PROMISED),'DD',1),'YYYYMMDD')

    Test functions can also be used with Conversion functions.The following expression uses IS_DATE along with TO_CHAR.IS_DATE(TO_CHAR(DATE_PROMISED,'YYYYMMDD'))

    * TO_CHAR returns NULL if invalid Date is passed to the function.

    2.2 TO_DATE:

    The TO_DATE function converts a character string to a date datatype in the same format as thecharacter string. It is available in the Designer and the Workflow Manager.TO_DATE( string [, format ] )

    Example : The following expression returns date values for the strings in the DATE_PROMISED port.TO_DATE always returns a date and time. If we pass a string that does not have a time value, the datereturned always includes the time 00:00:00. If we execute a session in the twentieth century, thecentury will be 19. The current year on the machine running the Informatica Server is 1998:

  • 8/2/2019 a Developers Functions

    7/18

    TO_DATE( DATE_PROMISED, 'MM/DD/YY' )DATE_PROMISED -------------------RETURN VALUE'12/28/81' ----------------------------Dec 28 1981 00:00:00NULL --------------------------------NULL

    The format of the string must exactly be the format given in the TO_DATE function.* TO_DATE function fails if invalid date entries are given. To avoid this we must use IS_DATE functionto check if the string has a valid date to be converted.

    2.3 TO_DECIMAL:

    The TO_DECIMAL function converts any value (except binary) to a decimal. It is available in theDesigner.TO_DECIMAL( value [, scale ] )

    Example : This expression uses values from the port IN_TAX. The datatype is decimal with precisionof 10 and scale of 3:

    TO_DECIMAL( IN_TAX, 3 )IN_TAX ------------------------RETURN VALUE'15.6789' ------------------------15.678NULL ---------------------------NULL'A12.3Grove'-------------------- 0

    We can also use two conversion functions together in a single expression.The following expression uses the functions TO_DECIMAL and TO_CHAR.TO_DECIMAL(TO_CHAR(DATE_PROMISED,'YYYYMMDD'))

    2.4 TO_FLOAT:

    The TO_FLOAT function converts any value (except binary) to a double-precision floating pointnumber (the Double datatype). It is available in the Designer and the Workflow Manager.TO_FLOAT( value )

    Example : This expression uses values from the port IN_TAX:TO_FLOAT( IN_TAX )IN_TAX ------------------------RETURN VALUE'15.6789' ------------------------15.6789NULL ---------------------------NULL

    2.5 TO_INTEGER:

    The TO_INTEGER function converts any value (except binary) to an integer by rounding the decimalportion of a value. It is available in the Designer and the Workflow Manager.TO_INTEGER( value )

    Example : This expression uses values from the port IN_TAX:TO_INTEGER( IN_TAX )IN_TAX -------------------------RETURN VALUE'15.6789' -------------------------16'60.2' -----------------------------60

  • 8/2/2019 a Developers Functions

    8/18

    Date Functions:

    Date Format Strings in the Transformation ReferenceD, DD, DDD, DAY, DY, J

    Days (01-31). We can use any of these format strings to specify the entire day portion of a date. Forexample, if we pass 12-APR-1997 to a date function, we can use any of these format strings specify12.

    HH, HH12, HH24Hour of day (0 to 23), where zero is 12 AM (midnight). We can use any of these formats to specify theentire hour portion of a date. For example, if we pass the date 12-APR-1997 2:01:32 PM, we can useHH, HH12, or HH24 to specify the hour portion of the date.

    MIMinutes.

    MM, MON, MONTHMonth portion of date (0 to 59). We can use any of these format strings to specify the entire monthportion of a date. For example, if we pass 12-APR-1997 to a date function, we can use MM, MON, orMONTH to specify APR.

    SS , SSSSSecond portion of date (0 to 59).

    Y, YY, YYY, YYYY , RRYear portion of date (1753 to 9999). We can use any of these format strings to specify the entire yearportion of a date. For example, if we pass 12-APR-1997 to a date function, we can use Y, YY, YYY, orYYYY to specify 1997.

    3.1 ADD_TO_DATE

    The ADD_TO_DATE function adds a specified amount to one part of a date/time value, and returns adate in the same format as the specified date.Note: If we do not specify the year as YYYY, the Informatica Server assumes the date is in the currentcentury. It is available in the Designer and the Workflow Manager.

    ADD_TO_DATE( date, format, amount )

    Example : The following expression adds one month to each date in the DATE_SHIPPED port. If wepass a value that creates a day that does not exist in a particular month, the Informatica Server returnsthe last day of the month. For example, if we add one month to Jan 31 1998, the Informatica Serverreturns Feb 28 1998.

    Also note, ADD_TO_DATE recognizes leap years and adds one month to Jan 29 2000:ADD_TO_DATE( DATE_SHIPPED, 'MM', 1 )

  • 8/2/2019 a Developers Functions

    9/18

    DATE_SHIPPED ----------------RETURN VALUEJan 12 1998 12:00:30AM --------Feb 12 1998 12:00:30AM

    The following expression subtracts 10 days from each date in the DATE_SHIPPED port:ADD_TO_DATE( DATE_SHIPPED, 'D', -10 )DATE_SHIPPED --------------RETURN VALUEJan 1 1997 12:00:30AM -------Dec 22 1996 12:00AM

    The following expression subtracts 15 hours from each date in the DATE_SHIPPED port:ADD_TO_DATE( DATE_SHIPPED, 'HH', -15 )

    DATE_SHIPPED ------------------RETURN VALUEJan 1 1997 12:00:30AM ------------Dec 31 1996 9:00:30AM

    In ADD_TO_DATE function, if the argument passed evaluates to a date that does not exist in aparticular month, the Informatica Server returns the last day of the month.The following expression reveals this.

    ADD_TO_DATE( DATE_SHIPPED, 'MON', 3 )DATE_SHIPPED -------------------RETURN VALUEJan 31 1998 6:24:45PM ------------Apr 30 1998 6:24:45PM

    3.2 DATE_COMPARE

    The DATE_COMPARE function returns a value indicating the earlier of two dates. It is available in theDesigner and the Workflow Manager.DATE_COMPARE( date1, date2 )

    Example : The following expression compares each date in the DATE_PROMISED and

    DATE_SHIPPED ports, and returns an integer indicating which date is earlier:DA DATE_COMPARE ( DATE_PROMISED, DATE_SHIPPED )DATE_PROMISED ---------DATE_SHIPPED ----------------RETURN VALUEJan 1 1997 ------------------Jan 13 1997 --------------------- -1Feb 1 1997 ------------------Feb 1 1997 ---------------------- 0Dec 22 1997 -----------------Dec 15 1997 --------------------- 1

    3.3 DATE_DIFF

    The DATE_DIFF function returns the length of time between two dates, measured in the specifiedincrement (years, months, days, hours, minutes, or seconds). It is available in the Designer and theWorkflow Manager.DATE_DIFF( date1, date2, format )

    Example: The following expressions return the number of days between the DATE_PROMISED andthe DATE_SHIPPED ports:DATE_DIFF DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'D' )DATE_DIFF DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'DD' )

  • 8/2/2019 a Developers Functions

    10/18

    DATE_PROMISED ------------DATE_SHIPPED --------------RETURN VALUEJan 1 1997 12:00:00AM -------Mar 29 1997 12:00:00PM ----- -87.5Mar 29 1997 12:00:00PM----- Jan 1 1997 12:00:00AM --------- 87.5

    We can combine DATE functions and TEST functions so as to validate the dates.For example, while using the DATE functions like DATE_COMPARE and DATE_DIFF, the dates givenas inputs can be validated using the TEST function IS_DATE and then passed to them if valid.

    3.4 GET_DATE_PART

    The GET_DATE_PART function returns the specified part of a date as an integer value, based on thedefault date format of MM/DD/YYYY HH24:MI:SS. It is available in the Designer and the WorkflowManager.GET_DATE_PART( date, format )

    Example: The following expressions return the day for each date in the DATE_SHIPPED port:GE GET_DATE_PART ( DATE_SHIPPED, 'D' )GEGET_DATE_PART ( DATE_SHIPPED, 'DD' )

    DATE_SHIPPED -----------------RETURN VALUEMar 13 1997 12:00:00AM-------- 13June 3 1997 11:30:44PM---------- 3NULL NULL

    3.5 LAST_DAY

    The LAST_DAY function returns the date of the last day of the month for each date in a port. It isavailable in the Designer and the Workflow Manager.LAST_DAY( date )

    Example : The following expression returns the last day of the month for each date in theORDER_DATE port:LAST_DAY( ORDER_DATE )

    ORDER_DATE -------------------------------------RETURN VALUEApr 1 1998 12:00:00AM ---------------------------Apr 30 1998 12:00:00AMJan 6 1998 12:00:00AM ---------------------------Jan 31 1998 12:00:00AMDATE functions combine with Conversion functions also.The following expression has LAST_DAY and TO_DATE functions nested or combined together.LAST_DAY( TO_DATE( GIVEN_DATE, 'DD-MON-YY' ))

    3.6 MAX

    The MAX function returns the latest date found in a group. It is available in the Designer.MAX( date, filter_condition )We can return the maximum date for a port or group.Example: The following expression returns the maximum order date for flashlights:MAX( ORDERDATE, ITEM_NAME='Flashlight' )

    ITEM_NAME -----------ORDER_DATEFlashlight ---------------Apr 20 1998Regulator ---------------System May 15 1998Flashlight ---------------Sep 21 1998

  • 8/2/2019 a Developers Functions

    11/18

    Diving Hood ------------Aug 18 1998Halogen Flashlight ------Feb 1 1998Flashlight ---------------Oct 10 1998

    RETURN VALUE: Oct 10 1998

    3.7 MIN

    The MIN function returns the earliest date found in a group. It is available in the Designer.MIN( date, filter_condition )

    Example: The following expression returns the oldest order date for flashlights:MIN( ORDER_DATE, ITEM_NAME='Flashlight' )

    ITEM_NAME --------------ORDER_DATEFlashlight -------------------Apr 20 1998Regulator System -----------May 15 1998Flashlight -------------------Sep 21 1998Diving Hood ----------------Aug 18 1998

    Halogen Flashlight ----------Feb 1 1998Flashlight -------------------Oct 10 1998RETURN VALUE: ----------Feb 1 1998

    3.8 ROUND

    The ROUND function rounds one part of a date. It is available in the Designer and the WorkflowManager.ROUND( date [, format ] )

    Example: The following expressions round the month portion of each date in the DATE_SHIPPED

    port.ROUND( DATE_SHIPPED, 'MM' )ROUND( DATE_SHIPPED, 'MON' )

    DATE_SHIPPED ---------------RETURN VALUEJan 15 1998 2:10:30AM --------Jan 1 1998 12:00:00AM

    Similarly the ROUND function can be used to round off Year, Day or Time portions.

    3.9 SET_DATE_PART

    The SET_DATE_PART function sets one part of a date/time value to a specified value. It is available inthe Designer and the Workflow Manager.SET_DATE_PART( date, format, value )

    Example: The following expressions change the month to June for the dates in the DATE_PROMISEDport. The Informatica Server displays an error when we try to create a date that does not exist, such aschanging March 31 to June 31:SET_DATE_PART( DATE_PROMISED, 'MM', 6 )SET_DATE_PART( DATE_PROMISED, 'MON', 6 )

  • 8/2/2019 a Developers Functions

    12/18

    DATE_PROMISED -----------------RETURN VALUEJan 1 1997 12:15:56AM -------------Jun 1 1997 12:15:56AMNULL -------------------------------NULL

    Similarly the SET_DATE_PART function can be used to round off Year, Day or Time portions.

    3.10 TRUNC

    The TRUNC function truncates dates to a specific year, month, day, hour, or minute. It is available inthe Designer and the Workflow Manager.TRUNC( date [, format ] )

    Example: The following expressions truncate the year portion of dates in the DATE_SHIPPED port:TRUNC( DATE_SHIPPED, 'Y' )TRUNC( DATE_SHIPPED, 'YY' )

    DATE_SHIPPED ---------------RETURN VALUEJan 15 1998 2:10:30AM --------Jan 1 1998 12:00:00AM

    Similarly the TRUNC function can be used to truncate Month , Day or Time portions.The functions TRUNC & ROUND can be nested in order to manipulate dates.

  • 8/2/2019 a Developers Functions

    13/18

    Special Functions:

    4.1 DECODE

    The DECODE function searches a port for the specified value. It is available in the Designer and theWorkflow Manager.DECODE( value, first_search, first_result [, second_search, second_result ][, default ] )

    Example: We might use DECODE in an expression that searches for a particular ITEM_ID and returnsthe ITEM_NAME:

    DECODE( ITEM_ID, 10, 'Flashlight',14, 'Regulator',20, 'Knife',40, 'Tank','NONE' )

    ITEM_ID RETURN VALUE10 Flashlight14 Regulator17 NONE

    4.2 IIF

    The IIF function returns one of two values we specify, based on the results of a condition. It is availablein the Designer and the Workflow Manager.

    IIF( condition, value2 [, value2 ] )

    Example : IIF( SALES =90,'A',(IIF(MARKS>= 75,'B',(IIF(MARKS>=65,'C',(IIF(MARKS>=55,'D',IIF(MARKS>=45,'E','F'))))))))

    The same result can be obtained withDECODE(TRUE,MARKS>=90,'A',MARKS>=75,'B',MARKS>=65,'C',MARKS>=55,'D',MARKS>=45,'E',

    'F')

    When the number of conditions increase we will be able to appreciate the simplicity of the DECODEfunction and the complexity of the IIF function.In both the cases , If MARKS>90 it will return 'A' though it satisfies all the conditions given. It isbecause it returns when the first condition is satisfied. Therefore even if a port satisfies two or more theconditions it will take only the first one. Therefore Ordering is important in IIF and DECODE functions.

  • 8/2/2019 a Developers Functions

    14/18

    4.3 ERROR:

    The ERROR function causes the Informatica Server to skip a record and throws an error messagedefined by the user. It is available in the Designer.ERROR( string )

    Example : The following example shows how you can reference a mapping that calculates the averagesalary for employees in all departments of your company, but skips negative values. The followingexpression nests the ERROR function in an IIF expression so that if the Informatica Server finds anegative salary in the Salary port, it skips the row and displays an error:

    IIF( SALARY

    SALARY ------------RETURN VALUE

    10000 ------------- 10000

    -15000 ----------'Error. Negative salary found. Row skipped.'

    The below example combines two special functions, a test Function and a conversion function.IIF(IS_DATE(DATE_PROMISED,'MM/DD/YY'),TO_DATE(DATE_PROMISED),ERROR('Invalid Date'))

    4.4 LOOKUP:

    The LOOKUP function searches for a particular value in a lookup source column. It is available in theDesigner.

    LOOKUP( result, search1, value1 [, search2, value2] )

    Example : The following expression searches the lookup source :TD.SALES for a specific item ID andprice, and returns the item name if both searches find a match:

    LOOKUP( :TD.SALES.ITEM_NAME, :TD.SALES.ITEM_ID, 10, :TD.SALES.PRICE, 15.99 )

    ITEM_NAME ----------ITEM_ID -------------PRICE

    Regulator ----------------5 ----------------------100.00

    Flashlight -----------------10 --------------------15.99

  • 8/2/2019 a Developers Functions

    15/18

    Test Functions:

    5.1 ISNULL

    The ISNULL function returns whether a value is NULL. It is available in the Designer and the WorkflowManager.

    ISNULL( value )

    Example : The following example checks for null values in the items table:

    ISNULL ISNULL ( ITEM_NAME )

    ITEM_NAME -------------RETURN VALUE

    Flashlight------------------- 0 (FALSE)

    NULL -----------------------1 (TRUE)

    '' -----------------------------0 (FALSE) Empty string is not NULL

    5.2 IS_DATE

    The IS_DATE function returns whether a value is a valid date. It is available in the Designer and theWorkflow Manager. IS_DATE( value ) Example : The following expression checks the INVOICE_DATEport for valid dates:

    IS_DATE( INVOICE_DATE )

    This expression returns data similar to the following:

    INVOICE_DATE -----------------RETURN VALUE

    NULL ------------------------------NULL

    180 ---------------------------------0 (FALSE)

    '04/01/98' --------------------------0 (FALSE)

    '04/01/1998 00:12:15' ------------- 1 (TRUE)

    '02/31/1998 12:13:55' ---------------0 (FALSE) (February does not have 31 days)

    'John Smith' --------------------------0 (FALSE)

    This function can also be used to validate a date for a specified format for which the syntax is

    IS_DATE( value, format )

    If the format is not specified, MM/DD/YYYY is taken as the default format.

  • 8/2/2019 a Developers Functions

    16/18

    5.3 IS_NUMBER

    The IS_NUMBER returns whether a string is a valid number. It is available in the Designer and theWorkflow Manager.

    IS_NUMBER( value )

    Example : The following expression checks the ITEM_PRICE port for valid numbers:IS_NUMBER( ITEM_PRICE )

    ITEM_PRICE --------------RETURN VALUE

    123.00 ----------------------1 (True)

    -3.45e+3 --------------------1 (True)

    '' -----------------------------0 (False) Empty string

    +123abc ----------------------0 (False)

    ABC --------------------------0 (False)

    -ABC-------------------------- 0 (False)

    NULL -------------------------NULL

    5.4 IS_SPACES

    The IS_SPACES function returns whether a value consists entirely of spaces. It is available in theDesigner and the Workflow Manager.

    IS_SPACES( value )

    Example : The following expression checks the ITEM_NAME port for rows that consist entirely ofspaces:

    IS_SPACES IS_SPACES ( ITEM_NAME )

    ITEM_NAME ----------------------RETURN VALUE

    Flashlight--------------------------- 0 (False)

    -------------------------- 1 (True)

    Regulator system-------------------- 0 (False)

  • 8/2/2019 a Developers Functions

    17/18

    Appendix:

    LENGTH: LENGTH (CUSTOMER_NAME)

    LPAD: LPAD (NUM, 5, '')LTRIM: LTRIM (ITEM_CODE,'')

    RPAD: RPAD (WORD, 5, ':)

    RTRIM: RTRIM (ITEM_CODE,'1')

    SUBSTR: SUBSTR( string, start [, length ] )

    good practice to trim the strings SUBSTR (NAME, 2,2)

    SUBSTR(LTRIM(NAME),2,2)SUBSTR(NAME,-3,3)

    SUBSTR(RTRIM(NAME),-3,3)

    SUBSTR(LTRIM(RTRIM(NAME)),3,2)The SUBSTR function returns a portion of a string.

    Conversion Functions:

    TO_CHAR: TO_CHAR (SALES )

    TO_CHAR (DATE_PROMISED, 'MON DD YYYY' )

    TO_DATE: DATE( DATE_PROMISED, 'MM/DD/YY' )TO_DECIMAL: TO_DECIMAL( value [, scale ] )

    TO_FLOAT: TO_FLOAT( value )

    TO_INTEGER: TO_INTEGER( IN_TAX )

    Date Functions:

    ADD_TO_DATE: ADD_TO_DATE( DATE_SHIPPED, 'MM', 1 )

    DATE_COMPARE: DATE_COMPARE ( DATE_PROMISED, DATE_SHIPPED )DATE_DIFF: DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'D' )

    GET_DATE_PART: GET_DATE_PART( date, format )

    LAST_DAY :LAST_DAY( ORDER_DATE )

    MAX :MAX( ORDERDATE, ITEM_NAME='Flashlight' )MIN: MIN( ORDER_DATE, ITEM_NAME='Flashlight' )

    ROUND: ROUND( DATE_SHIPPED, 'MM' )

    SET_DATE_PART :SET_DATE_PART( DATE_PROMISED, 'MM', 6 )TRUNC :TRUNC( date [, format ] )

    Special Functions

    DECODE function searches a port for the specified value. It is available in the Designer and

    the Workflow Manager.

    The IIF function returns one of two values we specify, based on the results of a condition. Itis available in the Designer and the Workflow Manager.

  • 8/2/2019 a Developers Functions

    18/18

    The ERROR function causes the Informatica Server to skip a record and throws an error

    message defined by the user. It is available in the Designer.

    The LOOKUP function searches for a particular value in a lookup source column. It is

    available in the Designer.

    Test FunctionsISNULLIS_SPACES