views:

44

answers:

1

I am having a great deal of trouble porting some stored procedures to regular MySQL statements.

We have stuff like this example

http://dev.mysql.com/doc/refman/5.0/en/stored-programs-defining.html

BEGIN SET @x = 0; REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT; END

Where many statements are executed. Several If statements and variable declarations, the whole 9 yards. But for some reason I can't just copy and paste the logic of the stored procedure into MySQL's query browser and execute it nor will it execute in a query execution via a C# program

I tried porting these queries via parameterized queries in C# but I still get a "check the manual error" every time =O

I really need help i can't find an answer anywhere on the internet. Am I completely screwed trying to get sequential execution without stored procedures?

Is the only way to do this to port the logic to the actual program? (I really don't want to do this)

A: 

Edit: I have reading comprehension issues. This link says that the looping constructs only work within stored programs, so you are out of luck I think.

Brad
yeah I didn't know that. I thought you could have some state in compound statements. I figured this out just after you made your post. I can't believe this never came up for me until now.Thanks though. You have a correct answer so marked as answered for future generations =)
brian
i meant to say some state in a compound query*. Apparently compound queries don't even exist. well I'm an idiot.
brian
I didn't know you couldn't do this either. Having come from a SQL Server background, I am surprised every now and then by something like this that I take for granted in SQL Server but is lacking in MySQL.
Brad