delimiter |
create PROCEDURE loan_vou
(in act char, IN appl smallint, IN doc_dt date, IN ln_amt float(12,2), IN cq_no varchar(15),
IN cq_dt date, IN mem_id smallint, IN Ireg smallint, OUT rtn INT)
BEGIN
DECLARE doc_no smallint;
select ifnull(max(doc_no),0) into doc_no from voucher where reg = Ireg;
if (doc_no = 0 ) Then
select st_no into doc_no from voucher_type where sr_no = Ireg;
end if
--select doc_no;
END;
|
delimiter ;

Error : 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 'END' at line 11 

Please help me out i am a learner.