1

In my mysql stored procedure I want try catch block but it gives error in my mysql stored procedure .

I want my select query to be in try block and if it executes correctly I want other query to execute.

code statement for mysql

BEGIN
 begin try 
     select userId into user from users ;
 end try
 begin catch 
    select 1;
 end catch 
 begin finally
   select postId from photo where userId=user;
 end finally 
END

but it gives error is there any try catch block for mysql.

1 Answer 1

0

I think you're mixing up Java (other language?) with MySQL's stored procedure language. Look here and here. Check out this by Guy Harrison, the guy who wrote this book.

1
  • adding links in answers is dangerous as links might go away.
    – theking2
    Dec 16, 2023 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.