mysql - StoredProcedure not workng correctly -
what doing here updating records when record_id=0 , activity_id=0 condition fails..but result getting is updating records regardless of condition where activity_id = activity_id (in update tms_activity line)
this procedure wrote in mysql
create procedure `emptimesheet_savetasks`(in user_id int(11), in date date, in record_id int(11), in task_id int(10), in hours double, in description longtext, in updated_by_id int(11), in project_id int(11), in project_name varchar(50), in task_name varchar(50), in activity_id int(11), in deleted_id varchar(100) ) begin if record_id = 0 insert ignore tms_timesheet(user_id, date, is_freezed) values (user_id,date,0); set @id = (select record_id tms_timesheet user_id= user_id , date=date); insert tms_activity (timesheet_id, task_id, hours, description, updated_on, updated_by_id,project_id,project_name,task_name ) values (@id ,task_id,hours ,description, current_timestamp( ) ,user_id,project_id,project_name ,task_name ); else if activity_id = 0 insert tms_activity ( timesheet_id, task_id, hours, description, updated_on, updated_by_id,project_id,project_name,task_name ) values (record_id ,task_id,hours ,description, current_timestamp( ) ,user_id, project_id ,project_name,task_name); else update tms_activity set task_id=task_id, hours=hours, description=description, updated_on=current_timestamp( ), updated_by_id=user_id,project_id=project_id,task_name=task_name,project_name=project_name *****where activity_id = activity_id;***** end if; end if; if deleted_id!='' delete tms_activity activity_id in (deleted_id); end if; end
i solved myself solution quiet weird me because when changed parameter name activity_id activityid,it worked..i dont know reason how happened , why..but solved error
Comments
Post a Comment