1. Registered User
Join Date
Aug 2008
Posts
464

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. Registered User
Join Date
Jun 2004
Location
Liverpool, NY USA
Posts
2,520
What is your function DIV doing. That is NOT an oracle function.

3. Registered User
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. Registered User
Join Date
Nov 2003
Posts
2,993
Originally Posted by shajju
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
•