OK,

MySQL does not support the Stored Procedure ... yet.
So how do I convert the following SQL as a Stored Proc into MySQL ?

Assume I have the following Stored Proc :
-- Start snippet
CREATE PROCEDURE aTest
AS BEGIN

-- Select some columns from table and table b, 
-- then put them into a temp table t1
SELECT [ ... ]
INTO #t1
FROM a ,b
WHERE a.a1 = b.b1

-- Do a bit calculation from each row of temp table t1.
-- Store the result into temp table t2
DECLARE c1_t1 CURSOR FOR
    SELECT *
    FROM #t1
OPEN c1_t1
FETCH c1_t1 INTO [ ... ]
while ( @@sqlstatus = 0 )
begin
    -- Perform the business rules 
    INSERT INTO #t2 VALUES ( [ ... ] )
    FETCH c1_t1 INTO [ ... ]
end 
CLOSE c1_t1

SELECT [ ... ]
INTO #t3
FROM c ,#t2
WHERE [ ... ]

SELECT *
FROM #t3

END

-- End snippet

How can I 'convert' that Stored Proc into a MySQL ?
Any help would be appreciate.

Thanks.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to