Skip navigation
Currently Being Moderated

simple oracle query not working in cf9

Mar 28, 2012 11:12 AM

when running in oracle 10g, this query returns correctly one row:

 

WITH myResults  AS

(

   SELECT 1 AS myLevel, 'someString' AS myData

   FROM dual

)

SELECT *

FROM myResults;

 

Returns:

 

MYLEVELMYDATA
1someString

 

When put inside a cfquery on a cf9 page, returns nothing!

 

<cfset qryRan = "false">

<cfif isDefined('myQry.recordCount')>

    <cfset qryRan = "true">

</cfif>

Qry: <cfoutput>#qryRan#</cfoutput>

 

Returns:

Qry: false

 
Replies
  • Currently Being Moderated
    Mar 29, 2012 12:25 AM   in reply to ion

    I think the problem is with your logic, not the query. Doing this:

     

    <cfquery name="x" datasource="##" username="##" password="##">

    WITH myResults  AS

    (

       SELECT 1 AS myLevel, 'someString' AS myData

       FROM dual

    )

    SELECT *

    FROM myResults

    </cfquery>

     

    <cfdump var="#x#">

     

    Shows the results as expected.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2012 6:07 AM   in reply to ion

    If you read the error message, you'll realise none of this is down to Oracle and by no means is that error message "the same thing". Did you add the name="x" attribute to the query? You can't just run half the code and expect it to work.

     
    |
    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