I'm trying to create a procedure that changes between insert and update in phpmyadmin but it returns an error in the line of if EXISTS, then I tried to create it by the graphical panel and it returns error in the last line always ... Does anyone know what's wrong?
Error when I try the panel (Without sql)
Errorwhentryingpersql
Query
CREATE PROCEDURE SEND_ITEMS(
IN i_item_id int(11),
IN i_customer_id VARCHAR(11),
IN i_quantity SMALLINT)
AS
BEGIN
IF(EXISTS(SELECT item_id,customer_id FROM wpcheap_items_selected WHERE (item_id = i_item_id AND customer_id = i_customer_id)))
THEN Update wpcheap_items_selected SET quantity = i_quantity WHERE (item_id = i_item_id AND customer_id = i_customer_id)
ELSE
INSERT INTO wpcheap_items_selected(item_id,customer_id,quantity) VALUES (i_item_id, i_customer_id, i_quantity)
END