MySQL stored procedure return true or false -
i have update store procedure updates fields in table. want stored procedure return true if update query successful otherwise false if fails execute query. i'm searching different threads can't find same type of problem. below stored procedure.
create definer=`peter`@`%` procedure `do_update_bill_penalty`( penalty_code_ varchar(255), penalty_type_ varchar(255), penalty_rate_ varchar(255), charge_per_day_ varchar(255), total_charge_ varchar(255), total_net_due varchar(255), user_ varchar(255), client_ varchar(255), accountnumber_ varchar(255), job_date_ varchar(255) ) begin update `bill` set `bill_status` = 'ovd', `bill_status_description` = 'overdue', `penalty_code` = penalty_code_, `penalty_type` = penalty_type_, `penalty_rate` = penalty_rate_, `charge_per_day` = charge_per_day_, `penalty_charge` = total_charge_, `total_amount_due` = total_net_amount_, `bill_modifiedby` = user_ `bill_client` = client_ , `bill_account_number` = accountnumber_ , `bill_reading_date` = job_date_; end
you need start better definition of "successful".
if want know if rows updated makes your's duplicate of question (the integer value can explifitly or implicitly cast boolean.
if want know if exception occurred, add handler (there lots of examples here on so) change value of flag
Comments
Post a Comment