Skip to main content
Inspiring
March 28, 2012
Answered

simple oracle query not working in cf9

  • March 28, 2012
  • 1 reply
  • 1318 views

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

This topic has been closed for replies.
Correct answer ion

yes, the query always had the name attribute set

it was definitely the oracle driver, i've install v10.1 in parallele with 8.1, recreated my datasources and everything works fine now

thanks for the reply

1 reply

Owainnorth
Inspiring
March 29, 2012

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.

ionAuthor
Inspiring
March 29, 2012

thanks but it does the same thing, returns:

Variable X is undefined. 

 

37 : </cfquery>

38 : 

39 : <cfdump var="#x#"><cfabort>

i looked at the oracle driver on the cf machine, and it's version 8 (the db is 10g). i'll upgrade the driver and see if it works

thanks

Owainnorth
Inspiring
March 29, 2012

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.