Skip navigation
Currently Being Moderated

query of query issue

Jul 18, 2012 5:30 AM

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!

 
Replies
  • Currently Being Moderated
    Jul 18, 2012 5:49 AM   in reply to jfb00

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 6:02 AM   in reply to Adam Cameron.

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 6:52 AM   in reply to jfb00

    Why is joining two queries an issue?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points