MySQL Forums
Forum List  »  Triggers

Re: Trigger to Combine Elements of Other Row Data?
Posted by: Devart Team
Date: March 02, 2011 12:37AM

There is no syntax errors and I have created this trigger successfully, without any errors.

What error do you have?

One thing, trigger is a source object, BEGIN..END clause contains of code. To avoid problems with source code and object definitions, special statement delimiters should be used, which are different from semicolon. For example -

DELIMITER $$

CREATE TRIGGER add_bigchart_url
BEFORE INSERT ON stockanalysis
FOR EACH ROW
BEGIN
  IF NEW.bigcharturl IS NULL THEN
    SET NEW.bigcharturl = CONCAT('http://bigcharts.marketwatch.com/charts/big.chart?symb=';, NEW.ticker, '&compidx=aaaaa:0&ma=3&maval=50,,200&uf=0&lf=1&lf2=0&lf3=0&type=2&size=2&state=8&sid=2773712&style=320&time=8&freq=1&comp=NO_SYMBOL_CHOSEN&nosettings=1&rand=9193&mocktick=1');
  END IF;
END$$

DELIMITER ;

Devart Company,
MySQL management tools
http://www.devart.com/dbforge/mysql/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Trigger to Combine Elements of Other Row Data?
1454
March 02, 2011 12:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.