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
- Original Message -
From: Tripp Bishop [EMAIL PROTECTED]
To: mysql@lists.mysql.com
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
: 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
Hello.
Surround your code inside the IF statement with BEGIN...END. For example
this works for me:
drop procedure if exists testcursor;
DELIMITER //
CREATE PROCEDURE testcursor(IN city_name varchar(255))
DETERMINISTIC
BEGIN
declare tval int;
IF (INSTR(city_name, ',') 0) THEN
begin
Howdy all.
I need to define a cursor in a stored procedure but I
don't know what the nature of the select statement is
going to be until runtime. I need to do something like
the code below:
IF (INSTR(city_name, ',') 0) THEN
DECLARE cur_neighborhood CURSOR FOR
SELECT DISTINCT neighborhood