mysql - The insert query in stored procedure is not running -
the insert query in stored procedure not running. no error occurs query fails insert record. may know issue?
    create definer=`root`@`localhost` procedure `trip`(in trip int, in rate int, in remark varchar(1000))     begin         update booking set status = "2" trip= trip;             select rate rate, remark remark, t.driver_id = @driver_id trip_offer t t.trip = trip;          insert rating(trip_id, u_id, rate, remark, crt_tms) values(trip, @driver_id, rate, remark, now());     end 
i suspect have several issues.
one definite problem mysql cannot distinguish between variables (parameters stored procedure) , columns. should always use prefix variables. second, not clear trying do. best guess:
delimiter $$  create definer=`root`@`localhost` procedure `trip`(     in p_trip int,     in p_rate int,     in p_remark varchar(1000)) begin     update booking set status = "2" trip = v_trip;         insert rating(trip_id, u_id, rate, remark, crt_tms)          select t.trip, t.driver_id, v_rate, v_remark, now()         trip_offer t         t.trip = v_trip; end;$$  delimiter $$ 
Comments
Post a Comment