Usually I write scripts and sometimes I execute easy SQL queries, but now I have to implement a stored procedure,
which is very difficult to me.
I have a table which Looks like this
What I want to do is, execute the sp with the Parameters NAME, YEARMONTH, COMMENT and update the table column USERCOMMENT for the desired NAME, YEARMONTH
Now I have wirtten the following sp which works fine and update the USERCOMMENT, but If I try to replace the static values in the where clause, it happens that all table items where updated with the user comment.
Have I anything to do that the sp accepts the other Parameters too?
Another question is, what does it mean that a sp Returns a result set?
Should I execute a simple select Statement with the Parameters at the end?
Thanks for your help
CREATE PROCEDURE UPDATE_COMMENT
(IN YEARMONT CHAR(7),
IN NAME CHAR(32),
IN USERCOMMENT CHAR(16))
MODIFIES SQL DATA
IF USERCOMMENT != '' THEN
SET USERCOMMENT = USERCOMMENT
WHERE YEARMONTH = '2013-08' and NAME = 'Application1';