You could always try a subselect inside your primary query, or use DB2's 'FETCH FIRST X ROWS ONLY' to get only 1 row, not sure why you are using a cursor for it?
Chris Peterson -----Original Message----- From: Dan Plesse [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 25, 2006 12:49 PM To: CF-Talk Subject: Re: DB2 Cursor question With JDBC I always had to set the object fist to allow that to happen. On 10/24/06, Loathe <[EMAIL PROTECTED]> wrote: > > Let's try this again. > > Asume the following table: > > aftest.tperdet > > mac_id (varchar) > parno (varchar) > ident (char) > > How would I write a cursor to say, pull a single row, and just return > that record? > > Again, this is just a proof of concept, never had to use them before, > just trying to get a cursor that will execute from a query block, that > I can also test using a native Java class I am writing. > > > -----Original Message----- > > From: Loathe [mailto:[EMAIL PROTECTED] > > Sent: Monday, October 23, 2006 9:38 PM > > To: CF-Talk > > Subject: DB2 Cursor question > > > > > > Never really had to user cursors before now, thank god. > > > > Now I have to :( > > > > So we are comparing performance across several different drivers and > such. > > > > Right now I'm stuck on getting something that will even run. > > > > I'm trying this: > > > > <cftry> > > <cfquery name="tryCursor" datasource="mpestest"> > > Declare CursorPas Cursor for > > Select > > par_pas_nr > > From > > pas_data_ref > > Where > > pas_nr = 'F3LQ' > > > > open CursorPas > > fetch CursorPas into myField > > close CursorPas > > </cfquery> > > <cfcatch type="any"> > > <cfset myVar = cfcatch.rootCause.Sqlca.getMessage()> > > <cftrace var="#myVar#" inline="true" /> > > <cfdump var="#cfcatch#"> > > <cftrace var="#cfcatch#" inline="true" /> > > <cfabort> > > </cfcatch> > > > > </cftry> > > <cfdump var="#tryCursor#"> > > > > To see if we can execute cursors inline, becuase we cannot use > > stored procedures. > > > > Is there something wrong with that? > > > > I don't even know, this is cobbeled together from a couple different > > sources. > > > > Generated SQL: > > > > Declare CursorPas Cursor for Select par_pas_nr From > > aftest.pas_data_ref Where pas_nr = 'F3LQ' open CursorPas fetch > > CursorPas into myField close CursorPas > > > > SQL Code: -199 > > SQL State: 42601 > > > > TIA > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258033 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

