Functions List

download Functions List

of 8

Transcript of Functions List

  • 8/3/2019 Functions List

    1/8

    Informatica Functions List

    Function Type S.No. Function Name Function Description Example

    Character

    Functions

    1.1 ASCII(string) ASCII function returns the

    numeric ASCII/Unicode value

    of the first character of thestring passed to the function.

    Input: ASCII('ABC')

    Returns: 65

    1.2 CHOOSE(index, string1 [,

    string 2..])

    CHOOSE function chooses a

    string based on a given

    position. If the value matches

    the position, it is returned.

    Input: CHOOSE(1,

    'ABC', 'DEF', 'GHI')

    Returns: ABC

    1.3 CHR(numerical_value) It returns the ASCII/Unicodecharacter corresponding to a

    numerical value.

    INPUT: CHR(65)Returns: A

    1.4 CHRCODE(string) It returns the ASCII/Unicode

    value of the first character ofthe string passed to the

    function.

    Input: ASCII('ABC')

    Returns: 65

    1.5 CONCAT(string1,

    string2)

    It concatenates two strings. Input: Concat('Tata',

    'Group')

    Returns: TataGroup

    1.6 INDEXOF(valueToSearch, string1, [string2...],

    caseFlag)

    Finds the index (postion) of avalue among a list of values

    Input:INDEXOF(Item,

    'Pen', 'Paper', 'Pencil')

    Returns:

    pen: 0Pen: 1

    Paper: 2

    Pencil:3

    1.7 INITCAP(String) Capitalizes the first letter of each word and converts all

    others to lower case.

    Input:INITCAP('aBC')

    Returns:

    'Abc'1.8 INSTR(string,

    searchValue [, start [,

    occurrence]])

    Returns the position of a

    character in a string counting

    from left to right.

    Input:

    INSTR('Tata

    Consultancy

  • 8/3/2019 Functions List

    2/8

    Services', 'a', 1, 2)

    Returns: 4

    1.9 LENGTH(string) It returns the number of characters in the input string,

    Input:LENGTH('Tata

    Consultancy

    Services')Returns: 24

    1.10 LOWER(String) It converts all the characters of

    the string to lower case.

    Input:

    LOWER('TATA')

    Returns: 4

    1.11 LPAD(first_string, length

    [,secondstring])

    It sets a set of blanks or

    characters in the beginning ofa string.

    Input:

    LPAD('Abc', 6, 'x')Returns:

    xxxAbc

    1.12 LTRIM(String [,

    trim_set])

    Removes blanks or characters

    from the beginning of a string.

    Input

    LTRIM('mAbc', 'm')Returns: Abc

    LTRIM('mAbc', 'A')

    Returns: mAbc

    1.13 REPLACECHR(CaseFlag

    , String, oldCharSet,NewChar)

    Searches the string for a

    specified character andreplaces all occurrences with a

    new character specified

    Input:

    REPLCECHR(0,'ABC', '', NULL)

    Returns: ABC

    1.14 REPLACESTR(CaseFlag,

    String, oldString,

    NewString)

    Searches the string for a list of

    words and replaces them with

    the new string.

    REPLACESTR(0,

    Title, 'rs.', 'iss', 's')

    Returns:

    Mrs. : Ms.

    Miss: Ms.Mr.: Mr.

    MRS.: Ms.

    1.15 REVERSE(string) Reverses the input string Input:

    REVERSE('tata')

    Returns:

    'atat'

  • 8/3/2019 Functions List

    3/8

    1.16 RPAD(first_string, length

    [,secondstring])

    It sets a set of blanks or

    characters at the end of a

    string.

    RPAD('Abc', 6, 'x')

    Returns:

    Abcxxx

    1.17 RTRIM(String [,

    trim_set])

    Removes blanks or characters

    from the end of a string.

    Input

    RTRIM('Abcm', 'm')Returns: Abc

    LTRIM('Abcde', 'de')

    Returns: Abc

    1.18 SUBSTR(string, start

    [,length])

    Returns a portion of a string.

    Includes counting of blanks

    Input:

    SUBSTR('TataConsultancy

    Services', 5, 11)

    Returns

    Consultancy

    1.19 UPPER(string) Converts all the lower case

    characters of the string toupper case

    Input:

    UPPER('tata')

    Returns:

    TATA

    Conversion

    Functions

    2.1 TO_BIGINT(value

    [,flag])

    Converts a string or a

    numerical value to a BIGINTvalue.

    If flag is true or any number

    other than zero, it truncates thedecimal value.

    If flag is false or 0, it does not

    truncate the decimal value.

    Input:

    TO_BIGINT('123,176,123,456.12,

    TRUE)

    Returns:

    123,176,123,456

    2.2 TO_CHAR(date

    [,format])

    TO_CHAR(numerical_val

    ue)

    It converts Date or Numeric

    type data to character type.

    Input:

    TO_CHAR(Apr 12011 00:00:00,

    'MMM DD YYYY')

    Returns:

    'Apr 1 2011 00:00:00'

    INPUT:

    TO_CHAR(12)

  • 8/3/2019 Functions List

    4/8

    Returns:

    '12'

    2.3 TO_DATE(string, format) It converts string type to a date

    data type

    Input:

    TO_DATE('01/01/201

    2', 'DD/MM/YYYY)

    Returns:

    JAN 01 201200:00:00

    2.4 TO_DECIMAL(string,scale)

    Converts string or numericaldata to decimal value.

    Scale tells us the number of

    digits after decimal value.

    Input:TO_DECIMAL('121.

    2343', 2)

    Returns: 121.23

    Input:

    TO_DECIMAL('ABC', 2)

    Returns: 0

    2.5 TO_FLOAT(string) Converts string or numerical

    data to a double precision

    floating point value.

    Input:

    TO_FLOAT('2123.23

    4')

    Returns:

    2123.234

    2.6 TO_INTEGER(string[,flag])

    Converts the string ornumerical value to integer

    type.

    Flag specifies whether to

    truncate or round the decimalvalue. It truncates when the

    flag is TRUE or any number

    other than zero.

    Input:TO_INTEGER(212.

    3, 1)

    Returns:212

    Encoding

    Functions

    3.1 AES_DECRYPT(value,

    key)

    Returns encrypted data to

    string format using AESalgorithm.

    Value is the value to be

    decrypted. Key is the same

    Input:

    AES_DECRYPT( SSN_ENCRYPT,

    SUBSTR( SSN,1,3 ))

    Returns:

  • 8/3/2019 Functions List

    5/8

    which is used to encrypt the

    value.

    07FB945926849D2B

    1641E708C85E4390

    = 832-17-1672

    3.2 AES_ENCRYPT(value,

    key)

    Returns data in encrypted

    format using AES algorithm

    Input:

    AES_ENCRYPT( SSN, SUBSTR( SSN,1,3

    ))

    Returns:

    832-17-1672 =

    07FB945926849D2B

    1641E708C85E4390

    3.3 COMPRESS(value) Compresses data using zlibdata compressing algorithm.

    3.4 CRC32 Returns a 32-bit Cyclic

    Redundancy Check Value to

    find data transmission errors.

    3.5 DEC_BASE64(value) Decodes a base 64 encoded

    value and returns a string withthe binary data representation

    of the data.

    3.6 DECOMPRESS(value) Decompresses data using zlib

    compression algorithm.

    3.7 ENC_BASE64(value) Encodes data by converting

    binary data to string data usingMIME encoding.

    3.8 MD5 Calculates the checksum of the

    input value.MD5 is a one-way

    cryptographic hash function

    with a 128-bit hash value.Returns 32 bit character string.

  • 8/3/2019 Functions List

    6/8

    Numerical

    Functions

    4.1 ABS(numerical_value) Returns the absolute value of a

    numerical value.

    Input:

    ABS(12-24)

    Returns:12

    4.2 CEIL(numerical_value) Returns the smallest integer

    greater than or equal to the

    value specified.Equal if the value specified is

    integer

    Input:

    CEIL(3.1)

    Returns:

    4

    4.3 CONVERT_BASE(value,

    source_base, dest_base)

    Converts a number from one

    base to another base value.

    Input:

    CONVERT_BASE(7,

    10, 2)

    Returns:

    00000111

    4.4 CUME(numerical_value[,filter])

    Returns a cumulative sum. Input:CUME( expense)

    Returns:

    100 100100 200

    200 400

    4.5 EXP(value) Calculates the exponent of e.

    ie. value of e raised to powerthe specified value

    Input:

    EXP(2)

    Returns:

    7.3890561

    4.6 FLOOR(value) Returns the largest integer

    value less than or equal to thevalue specified. Equal if the

    value specified is an integer.

    Input:

    FLOOR(12.1)

    Returns:

    12

    4.7 LN(numerical_value) Returns the natural logarithm

    of a number

    Input:

    LN(3)

    Returns:

    1.098612

  • 8/3/2019 Functions List

    7/8

    4.8 LOG(base, exponent) Returns the logarithm of a

    number.

    Input

    LOG(10,10)

    Returns:1

    4.9 MOD(numerical_value,

    divisor)

    Returns the remainder of a

    division calculation.

    Input:

    MOD(10, 3)

    Returns:

    1

    4.10 MOVINGAVG(numeric_

    value, rowset [,

    filter_condition])

    Returns the average (row-by-

    row) of a specified set of rows.

    Input:

    MOVINGAVG( SAL

    ES, 5 )

    Returns:

    100 NULL100 NULL

    100 NULL

    100 NULL200 120

    200 140

    4.11 MOVINGSUM(MOVIN

    GSUM( SALES, 5 ))

    Returns the sum ( row by row)

    of a specified set of rows.

    Input:

    MOVINGSUM(SAL

    ES, 5)

    Returns:

    100 NULL100 NULL

    100 NULL

    100 NULL

    200 600200 700

    4.12 POWER(base, exponent) Returns the raised to the valueof a number passed.

    Input:POWER(10, 2)

    Returns:100

    4.13 RAND(seed) Returns a random number

    between 0 and 1

    Seed is numeric starting value

    Input:

    RAND(1)

  • 8/3/2019 Functions List

    8/8

    to generate the random numberReturns:

    Any random vale

    between 0 and 1.

    4.14 ROUND(numeric_value

    [,precision])

    It rounds the numerical value

    nearest to the decimal value.Precision tells to which

    decimal place to round.

    Input:

    ROUND(12.1)

    Returns:

    12

    4.15 SIGN(numeric_value) Returns whether a number is

    positive, negative or 0.-1 for negative

    0 for 0

    1 for positive

    Input:

    SIGN(123)SIGN(-123)

    Returns:1

    -1

    4.16 SQRT(numeric_value) Calculates the square root of a

    non negative number

    Input:

    SQRT(100)

    Returns:

    10

    4.17 TRUNC(numeric_value

    [,precision])

    Truncates numbers to a

    specific digit.

    Input:

    TRUNC(9.9992, 3)

    Returns:

    9.999