Getting SQLSTATE in stored procedure

Getting SQLSTATE in stored procedure

am 16.05.2005 05:45:11 von Ken Resander

------=_NextPart_000_0027_01C55A0C.B7A61730
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

How do I get SQLSTATE in a procedure?

For example:

CREATE PROCEDURE myproc()
BEGIN
DECLARE CURSOR c1 Select.......;
.....
DECLARE var1, var2,...varN INT;
OPEN c1;
LOOP
FETCH c1 INTO var1, var2, VarN;

END LOOP;
CLOSE c1;
END;

SQL 1999 standard defines a statement GET DIAGNOSTICS EXCEPTION... for =
this; DB2 uses a special predefined variable SQLSTATE (I think), but =
what is needed for MySQL?



------=_NextPart_000_0027_01C55A0C.B7A61730--