List:General Discussion« Previous MessageNext Message »
From:Rolando Edwards Date:May 19 2009 8:05pm
Subject:RE: What is wrong with this SYNTAX?
View as plain text  
DELIMITER $$

CREATE TRIGGER bgp.tglobal BEFORE UPDATE on bgp.global
  FOR EACH ROW BEGIN
  IF STRCMP(NEW.Variable_name,'ASN') != 0 THEN
     set NEW.Variable_name=NULL;
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN
     set NEW.Variable_name=NULL (<<-- Missing Semicolon)
  ELSEIF STRCMP(NEW.Variable_name, 'ASN') != 0 THEN (<<-- Same as IF)
     set NEW.Value=CONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN (<<-- Same as First ELSEIF)
     set NEW.Value=INET_NTOA(INET_ATON(NEW.Value));
  ENDIF (<<-- Missing Semicolon)
  END;

DELIMITER ;

Rolando A. Edwards
MySQL DBA (CMDBA)

155 Avenue of the Americas, Fifth Floor
New York, NY 10013
212-625-5307 (Work)
201-660-3221 (Cell)
AIM & Skype : RolandoLogicWorx
redwards@stripped

-----Original Message-----
From: Rolando Edwards [mailto:redwards@stripped] 
Sent: Tuesday, May 19, 2009 12:40 PM
To: Alex Katebi; mysql@stripped
Subject: RE: What is wrong with this SYNTAX?

DELIMITER $$

CREATE TRIGGER bgp.tglobal BEFORE UPDATE on bgp.global
  FOR EACH ROW BEGIN
  IF STRCMP(NEW.Variable_name,'ASN') != 0 THEN
     set NEW.Variable_name=NULL;
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN
     set NEW.Variable_name=NULL (<<-- Missing Semicolon)
  ELSEIF STRCMP(NEW.Variable_name, 'ASN') != 0 THEN (<<-- Same as IF)
     set NEW.Value=CONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN (<<-- Same as First ELSEIF)
     set NEW.Value=INET_NTOA(INET_ATON(NEW.Value));
  ENDIF
  END;

DELIMITER ;

Rolando A. Edwards
MySQL DBA (CMDBA)

155 Avenue of the Americas, Fifth Floor
New York, NY 10013
212-625-5307 (Work)
201-660-3221 (Cell)
AIM : RolandoLogicWorx
Skype : RolandoLogicWorx
redwards@stripped


-----Original Message-----
From: Alex Katebi [mailto:alex.katebi@stripped] 
Sent: Tuesday, May 19, 2009 10:33 AM
To: mysql@stripped
Subject: What is wrong with this SYNTAX?

It is complaining about near STRCMP.

  CREATE TRIGGER bgp.tglobal BEFORE UPDATE on bgp.global
  FOR EACH ROW BEGIN
  IF STRCMP(NEW.Variable_name,'ASN') != 0 THEN
     set NEW.Variable_name=NULL;
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN
     set NEW.Variable_name=NULL
  ELSEIF STRCMP(NEW.Variable_name, 'ASN') != 0 THEN
     set NEW.Value=CONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
  ELSEIF STRCMP(NEW.Variable_name, 'RouterId') != 0 THEN
     set NEW.Value=INET_NTOA(INET_ATON(NEW.Value));
  ENDIF
  END

Thanks in advance!
Alex

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1

Thread
What is wrong with this SYNTAX?Alex Katebi19 May
  • RE: What is wrong with this SYNTAX?Rolando Edwards19 May
    • RE: What is wrong with this SYNTAX?Rolando Edwards19 May