0

I am trying to rollback the stored procedure which is created in mysql, tables as employee, dept as usual. the rollback is not working correctly.

not sure how to make it work.

--liquibase formatted sql
--changeset tester_1:test_id_4 endDelimiter:$$ rollbackEndDelimiter:$$


create procedure get_emp_details( empid varchar(50) )
BEGIN
select * from employee where id=empid;
END;
$$
--rollback drop procedure get_emp_details;
--rollback create procedure get_emp_details( emid varchar(75))
--rollback BEGIN
--rollback select * from employee;
--rollback END;
--rollback $$

failed as follows

Unexpected error running Liquibase: You have an error in your SQL

syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

'create procedure get_emp_details( emid varchar(75)) BEGIN select * from employe' at

line 2 [Failed SQL: (1064) drop procedure get_emp_details; create procedure get_emp_details( emid varchar(75)) BEGIN select * from employee; END$$]

Liquibase version i am using is 4.11

  • 1) You cannot rollback a creation of database objects, you need to use drop statement for that. 2) The error message indicates that the syntax error is before the create statement, so you must have something before the create statement that triggers the syntax error. – Shadow Jun 20 '22 at 12:14
  • @Shadow , i am not sure where is the mistake , when create procedure for changeset works , not sure why after drop procedure it does not work – Juliana Ashok Jun 20 '22 at 13:03
  • Refer to [this forum post](https://forum.liquibase.org/t/how-to-rollback-stored-procedure-using-sql-format/5623). This might help. – Rakhi Agrawal Jun 22 '22 at 09:35

0 Answers0