Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: blank fields....

    Hi guys (oracle 9i)

    Hoping you can help me understand this.

    I wrote an equation like:
    Code:
    ROUND(DIV((NVL(col1,0)+NVL(col2,0)+NVL(col3,0)+NVL(col4,0)) ,(NVL(col5,0)+NVL(col6,0)+NVL(col7,0)+NVL(col8,0)))
     ,3) * 100 as ABCD
    The result gave me lots of blank fields and some fields with values.

    I then re-wrote the equation like:
    Code:
    ROUND(DECODE((NVL(col5,0)+NVL(col6,0)+NVL(col7,0)+NVL(col8,0)),0,0,
    DIV((NVL(col1,0)+NVL(col2,0)+NVL(col3,0)+NVL(col4,0)) , (NVL(col5,0)+NVL(col6,0)+NVL(col7,0)+NVL(col8,0))),3))*100
    as ABCD
    And this time got zeros in place of the blanks but where there was a value from the output of the first equation, now there's a blank.

    Am I missing something?

    Regards

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    What is your function DIV doing. That is NOT an oracle function.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Aug 2008
    Posts
    464
    oh OK. DIV is dividing. It's SQL. No?

    Anway, the problem seems to have rectified itself. Not getting any discrepancies now after using 'DECODE'. Only zeros in place of the blanks which is what I wanted.

    Thanks

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by shajju View Post
    DIV is dividing. It's SQL. No?
    No it's not SQL.
    Definitely not in Oracle. I'm surprised DIV didn't give you an error.

    To divide you just write column1/column2

Posting Permissions

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