Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am using following query
select a,b, (a/b) as c
from table 1
But query fails with ODBC read failed message and query works fine when I remove a/b. I also tried casting the a/b as numeric but that does not work either. Is there a way I can divide the columns in sql query itself instead calculating it in Qlikview expression.?
Thank you
Try:
(Cast(a as int) / Cast(b as int)) As c.
Getting the same error
Error: QVX_UNEXPECTED_END_OF_DATA: SQL##f - SqlState: 22012, ErrorCode: 1476, ErrorMsg: [Oracle][ODBC][Ora]ORA-01476: divisor is equal to zero
Well, as you should know, divide by zero will always fail, no matter what programming language/tool you're using.
So how about:
SELECT
a,
b,
a/ALT(b>0,b,1)
FROM table1
Ok. It seems like your divisor is zero.
Try this:
IsNull(Cast(a as int) / NullIf(Cast(b as int),0),0)
Of course, this is the SQL code.
Hi,
You can also use NVL() or Decode()
Or do calculation using QlikView Functions.
Regards