MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Rhino Date:December 19 2005 9:10pm
Subject:Re: Declare Cursor Question
View as plain text  
----- Original Message ----- 
From: "Tripp Bishop" <dyne_erg@stripped>
To: <mysql@stripped>
Sent: Monday, December 19, 2005 3:45 PM
Subject: Re: Declare Cursor Question


> Howdy all,
>
> I've got a question about declaring cursors. In
> particular is there a way to allow the select
> statement used to populate the cursor be variable?
> I've tried a couple of the obvious approaches with no
> luck. Failing that, is there a way to have a cursor be
> an input parameter to a stored procedure? Seems like
> the answer is "no" but I had to ask.
>
You haven't specified which version of MySQL you are using. If you are on 
Version 4.1.3 or above, you can use SQL Prepared Statements: see 
http://dev.mysql.com/doc/refman/4.1/en/sqlps.html,  especially the example. 
This should give you the effect you want.

If you are on an earlier version of MySQL and don't mind doing some C 
programming, a C API with similar functionality was created in an earlier 
version, although I'm not sure which one. See 
http://dev.mysql.com/doc/refman/4.1/en/c-api-prepared-statement-function-overview.html 
for more information.

Rhino 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date: 16/12/2005

Thread
sequential idJoseph Alotta15 Dec
  • Re: sequential idJørn Dahl-Stamnes15 Dec
  • Declare Cursor QuestionTripp Bishop15 Dec
    • Re: Declare Cursor QuestionGleb Paharenko16 Dec
      • Re: Declare Cursor QuestionTripp Bishop19 Dec
        • Re: Declare Cursor QuestionRhino19 Dec
          • Re: Declare Cursor QuestionTripp Bishop19 Dec
  • Re: sequential idXiaobo Chen15 Dec
    • Re: sequential idXiaobo Chen15 Dec
  • Re: sequential idXiaobo Chen15 Dec
Re: sequential idJoseph Alotta16 Dec