Skip to main content
Inspiring
July 18, 2012
Question

query of query issue

  • July 18, 2012
  • 2 replies
  • 1124 views

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!

    This topic has been closed for replies.

    2 replies

    Inspiring
    July 18, 2012

    Why is joining two queries an issue?

    Inspiring
    July 18, 2012

    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

    Inspiring
    July 18, 2012

    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

    jfb00Author
    Inspiring
    July 18, 2012

    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,