Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    74

    Unanswered: How transform the return value of the round to a non-prefix and non-suffix string?

    Hello, everyone
    1.
    $ db2 "select char(round(3234.235, 5)) from sysibm.sysdummy1"

    1
    ----------
    03234.235

    1 record(s) selected.

    2.
    1
    ----------------
    013435.56464000

    1 record(s) selected.

    3.
    $ db2 "select char(round(1233435.56463621, 5)) from sysibm.sysdummy1"

    1
    ------------------
    01233435.56464000

    1 record(s) selected.


    But I want to get the following value
    3234.235
    13435.56464
    1233435.56464

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Try this ..

    values(replace(ltrim(rtrim(replace('01233005.56464 000','0',' '))),' ','0'))

    I hope there is a simpler method
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    i dont understand why u r using char


    C:\Program Files\IBM\SQLLIB\BIN>db2 values (round(1233435.56463621, 5))

    1
    ------------------
    1233435.56464000

  4. #4
    Join Date
    Jan 2003
    Posts
    74
    Thank you for your help! sathyaram_s is right!!
    I am doing a project that migrate the stored procedure and function from Oracle to DB2. I found many difference between them!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •