php - Stored Procedure in phpmyadmin -
i first timer in using phpmyadmin
. not aware in stored procedure working in code. don't know how make stored procedure in phpmyadmin
.
this code:
delimiter $$ create procedure sp_1_service_card_report(in service_card_no int) begin declare error_1 int; select count(service_card.customer_id) error_1 service_card service_card.id = 27; declare error_2 int; select count(service_card.serial_no_id) error_2 service_card service_card.id = 27; if error_1 > 0 , error_2 > 0 select service_card.id yes service_card service_card.id=27; else select service_card.customer_id no service_card.id=27; end if ; end $$ delimiter ;
this error:
mysql said: documentation
1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'declare error_2 int;
select count(service_card.serial_no_id)
' @ line 11
can guys me this? spent 1 hour searching answers here on stackoverflow.
thanks.
declare
statements must placed @ first , have select
typo in query @ end of procedure:
delimiter $$ create procedure sp_1_service_card_report(in service_card_no int) begin declare error_1 int; declare error_2 int; select count(service_card.customer_id) error_1 service_card service_card.id = 27; select count(service_card.serial_no_id) error_2 service_card service_card.id = 27; if error_1 > 0 , error_2 > 0 select service_card.id yes service_card service_card.id=27; else select service_card.customer_id no service_card service_card.id=27; end if ; end $$ delimiter ;
Comments
Post a Comment