MySQL Forums :: Stored Procedures :: Need help with Stored Procedure coding after migration from SQL Server
Need help with Stored Procedure coding after migration from SQL Server
Posted by: tcee sutton
Date: February 11, 2013 09:07AM
I am migrating my stored procedure from SQL SERVER to MYSQL and although my code doesn't cause any errors when I execute, I feel something is wrong with the code as it is not working as it should.
Can someone take a look at this code and see if there are any coding issues? Thank you in advance for your help.
MYSQL SERVER STORED PROCEDURE:
SET SQL_MODE = ANSI_QUOTES$$
/****** Object: StoredProcedure [a7user].[toggleConstraintsState] Script Date: 02/07/2013 19:23:08 ******/
DROP PROCEDURE IF EXISTS a7user_toggleConstraintsState;
CREATE PROCEDURE `a7user_toggleConstraintsState`(
DECLARE referentialConstraints Cursor FOR SELECT tc.constraint_name,tc.table_name from INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc;
SET `sql` = 'ALTER TABLE ' + `tableName` + ' NOCHECK CONSTRAINT ' + `constraintName`;
SET `sql` = 'ALTER TABLE ' + `tableName` + ' WITH CHECK CHECK CONSTRAINT ' + `constraintName`;
constraint_loop:While (FETCH_STATUS =0) DO
Fetch referentialConstraints INTO `constraintName`, `tableName`;
IF (toggleState = 0) THEN
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.