Copy link to clipboard
Copied
HI All,
I am using oracle 11 and CF 10.
How can I handle a division calculation in a query of query when the divider is zero?
<cfquery name="calculateDiv" dbtype="query">
SELECT 25/0 AS value_1, 35/5 as value_2, 40/0 as value_3
FROM dual
</cfquery>
I cannot use decode, NULLIF.
Thanks!
Copy link to clipboard
Copied
The short version is that you can't.
I'd try to get the DB to do it instead, if poss: QoQ ain't that good at anything more than the basics.
--
Adam
Copy link to clipboard
Copied
Like Adam said, try to do it in the db. if you cannot, then instead of the QofQ just do a CFLOOP over the resultset - that will allow you to use any CF code you want to determine which values are null, and replace whatever resultset values with a new calculated value.
-reed
Copy link to clipboard
Copied
I cannot do it in the DB but this is a good idea, thanks!
The issue is i am join two queries in one query.
Best,
Copy link to clipboard
Copied
Why is joining two queries an issue?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more