OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Update not returning any warning on failure

From: Sujay Koduri (SujayKandale.com)
Date: Tue Jul 05 2005 - 15:24:20 CDT


         
I have a problem working with the stored procs.

The stored proc looks like this

create procedure unit_swap()
BEGIN
  DECLARE b INT DEFAULT 7;
  DECLARE c INT;
  DECLARE CONTINUE HANDLER FOR 1176 SET b = 1111;
  DECLARE CONTINUE HANDLER FOR NOT FOUND, SQLEXCEPTION, SQLWARNING SET b =
1111;

     UPDATE EMP SET STYLE='CCCC' WHERE ID='999';
     IF b = 1111 THEN
        INSERT INTO EMP (ID) VALUES ('999');
     END IF;
     
     COMMIT;

END;

The problem here is that even if update fails, meaning even if ID '999'
doesn't exist, MySQL doesn't report any error or warning (NOT FOUND error
handler is not catching this). So I have no way to declare error handler for
this statement and then taking the action accordingly. (INSETTING OR ANY
OTHER THING)

Any help on this is extremely useful.

Thank you
sujay

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql