Skip to Content
avatar image
Former Member

Number Format

Hi,

I have a number of variable length at the source, now i need to just consider only the last five digits of the number to map it to target, could anybody help me with this. the source field length is always greater than 5.Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 11, 2007 at 05:32 AM

    Hi,

    Write a simple User Defined Function.

    String inputNumber;
    
    Int len= inputNumber.length();
    String output= inputNumber.substr(len-6,len-1);
    return output

    Regards

    Bhavesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 11, 2007 at 05:33 AM

    Hi,

    You can use a simple UDF to do this. It will work even if its a number.

    The input to the UDFs' will always be string.

    input: a,

    put this code in your UDF,

    return a.substring(a.length()-5,a.length());

    This should work.

    Regards,

    P.Venkat

    Add comment
    10|10000 characters needed characters exceeded