Question regarding RAISE EXCEPTION mechanism
Posted in 1999
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting
Hi All, Thanks to all who have helped so far with this issue. I would like a stored procedure to return me an error code if it encounters a locking problem in the DB, i.e. it tries to delete a record but that record is locked by another use and therefore the procedure fails. I know how to issue the RAISE EXCEPTION in the SP but I dont know what exception to raise. Is there a list of return codes that the raise exception can return to the calling program and if so where can I find this list? Thanks, Jack
Just raise the sqlcode and sqlerrd[1] which will have the lock codes in them already! Also you could have the SP execute SET LOCK MODE TO WAIT 5; which would eliminate most lock errors. Art S. Kagel Jack Murphy wrote: > > Hi All, > > Thanks to all who have helped so far with this issue. > > I would like a stored procedure to return me an error code if it encounters > a locking problem in the DB, i.e. it tries to delete a record but that > record is locked by another use and therefore the procedure fails. > > I know how to issue the RAISE EXCEPTION in the SP but I dont know what > exception to raise. Is there a list of return codes that the raise > exception can return to the calling program and if so where can I find this > list? > > Thanks, > > Jack