Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Post Unanswered: SQL: Numeric Conversion in DB2 Queries

    Hi,

    I have a DB2 Query in which i have to multiply Two columns.
    i.e., Select Column1 * Column2 From Table Name
    In this table the Column 1 is numeric but Column 2 is character having the values 1.56.
    Now what is the inbuilt reserved word which i can use to convert '1.56' string to 1.56.

    In Oracle we have To_number.But i am unable to find any such Reserved Word in DB2. Please Help.

    Thanks & Regards,
    Ragi

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Ragi,
    Look at the numeric functions: INTEGER, DECIMAL, FLOAT, DOUBLE. Each one will take your string and return a numberic of the datatype of the function name.

    HTH

    Andy

  3. #3
    Join Date
    Dec 2003
    Posts
    2

    Smile

    Originally posted by ARWinner
    Ragi,
    Look at the numeric functions: INTEGER, DECIMAL, FLOAT, DOUBLE. Each one will take your string and return a numberic of the datatype of the function name.

    HTH

    Andy
    Hi Andy,

    SELECT 3 * DECIMAL('12.2',3,1) FROM <Table> Works fine.
    Thanks A Lot.
    Appreciate Your Help!!!

    Regards,
    Ragi

Posting Permissions

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