Error in PROCEDURE [closed]

1

I'm new to creating PROCEDURE. I'm trying to create this PROCEDURE plus this error.

DELIMITER //

DROP PROCEDURE IF EXISTS 'P_lgs';
CREATE PROCEDURE 'P_lgs' ( idcod INT, dt VARCHAR(20), ip VARCHAR(20), msg VARCHAR(250), mail VARCHAR(250) ) 
BEGIN
  DECLARE numid INT DEFAULT 0;
  IF idcol <> 0 THEN 
    numid = idcol;
  END IF ;

  INSERT INTO 'logs'(logs_cod,logs_dt,logs_ip,logs_mensagem,logs_email) VALUE(numid,dt,ip,msg,mail);
END //

DELIMITER ;
    
asked by anonymous 15.06.2015 / 14:00

2 answers

1

@Welguri, try this:

 BEGIN
  DECLARE numid INT DEFAULT 0
  IF idcol <> 0 THEN 
    numid = idcol

INSERT INTO 'logs'(logs_cod,logs_dt,logs_ip,logs_mensagem,logs_email) VALUE(numid,dt,ip,msg,mail)
END //
    
15.06.2015 / 14:26
1

So no there was more error .

DELIMITER //

DROP PROCEDURE IF EXISTS P_lgs;//
CREATE PROCEDURE P_lgs ( IN idcod INT, IN dt VARCHAR(20), IN ip VARCHAR(20), IN msg VARCHAR(250), IN mail VARCHAR(250) ) 
BEGIN
  DECLARE numID INT DEFAULT 0;
  IF idcol = '' THEN 
    SELECT numID=0;
  ELSE
    SELECT numID=idcol;
  END IF;

  INSERT INTO LOGS(logs_cod, logs_dt, logs_ip, logs_mensagem, logs_email) VALUES(numID, dt, ip, msg, mail);
END //

DELIMITER ;
    
15.06.2015 / 15:42