What is wrong with this SYNTAX?

What is wrong with this SYNTAX?

am 19.05.2009 16:33:22 von Alex Katebi

--0016e6476110060307046a44cb2e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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

--0016e6476110060307046a44cb2e--

RE: What is wrong with this SYNTAX?

am 19.05.2009 18:39:42 von Rolando Edwards

DELIMITER $$

CREATE TRIGGER bgp.tglobal BEFORE UPDATE on bgp.global
FOR EACH ROW BEGIN
IF STRCMP(NEW.Variable_name,'ASN') !=3D 0 THEN
set NEW.Variable_name=3DNULL;
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Variable_name=3DNULL (<<-- Missing Semicolon)
ELSEIF STRCMP(NEW.Variable_name, 'ASN') !=3D 0 THEN (<<-- Same as IF)
set NEW.Value=3DCONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN (<<-- Same as Fi=
rst ELSEIF)
set NEW.Value=3DINET_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@logicworks.net


-----Original Message-----
From: Alex Katebi [mailto:alex.katebi@gmail.com]=20
Sent: Tuesday, May 19, 2009 10:33 AM
To: mysql@lists.mysql.com
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') !=3D 0 THEN
set NEW.Variable_name=3DNULL;
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Variable_name=3DNULL
ELSEIF STRCMP(NEW.Variable_name, 'ASN') !=3D 0 THEN
set NEW.Value=3DCONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Value=3DINET_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=3Dgcdmg-mysql-2@m.gmane.o rg

RE: What is wrong with this SYNTAX?

am 19.05.2009 22:05:28 von Rolando Edwards

DELIMITER $$

CREATE TRIGGER bgp.tglobal BEFORE UPDATE on bgp.global
FOR EACH ROW BEGIN
IF STRCMP(NEW.Variable_name,'ASN') !=3D 0 THEN
set NEW.Variable_name=3DNULL;
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Variable_name=3DNULL (<<-- Missing Semicolon)
ELSEIF STRCMP(NEW.Variable_name, 'ASN') !=3D 0 THEN (<<-- Same as IF)
set NEW.Value=3DCONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN (<<-- Same as Fi=
rst ELSEIF)
set NEW.Value=3DINET_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@logicworks.net

-----Original Message-----
From: Rolando Edwards [mailto:redwards@logicworks.net]=20
Sent: Tuesday, May 19, 2009 12:40 PM
To: Alex Katebi; mysql@lists.mysql.com
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') !=3D 0 THEN
set NEW.Variable_name=3DNULL;
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Variable_name=3DNULL (<<-- Missing Semicolon)
ELSEIF STRCMP(NEW.Variable_name, 'ASN') !=3D 0 THEN (<<-- Same as IF)
set NEW.Value=3DCONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN (<<-- Same as Fi=
rst ELSEIF)
set NEW.Value=3DINET_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@logicworks.net


-----Original Message-----
From: Alex Katebi [mailto:alex.katebi@gmail.com]=20
Sent: Tuesday, May 19, 2009 10:33 AM
To: mysql@lists.mysql.com
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') !=3D 0 THEN
set NEW.Variable_name=3DNULL;
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Variable_name=3DNULL
ELSEIF STRCMP(NEW.Variable_name, 'ASN') !=3D 0 THEN
set NEW.Value=3DCONVERT(CONVERT(NEW.Value, UNSIGNED), CHAR);
ELSEIF STRCMP(NEW.Variable_name, 'RouterId') !=3D 0 THEN
set NEW.Value=3DINET_NTOA(INET_ATON(NEW.Value));
ENDIF
END

Thanks in advance!
Alex

--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dredwards@logicworks=
..net


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg