Created
April 28, 2019 02:25
-
-
Save franciscohanna92/c78a48eb739a833cc9102b7ea1f71436 to your computer and use it in GitHub Desktop.
Stored procedure with error handling live template for Intellij Datagrip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use $database$ | |
DELIMITER $$ | |
drop procedure if exists $procedureName$ $$ | |
create procedure $procedureName$() | |
begin | |
declare exit handler for sqlexception | |
begin | |
get diagnostics condition 1 @sqlstate = returned_sqlstate , @errno = mysql_errno , @text = message_text ; | |
set @full_error = concat('ERROR ', @errno, @`sqlstate`, @text); | |
select @full_error; | |
end; | |
start transaction ; | |
$END$ | |
select concat('yay') as success; | |
commit; | |
end$$ | |
/* Finally, reset the delimiter to the default ; */ | |
DELIMITER ; | |
call $procedureName$(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment