MySQL Forums
Forum List  »  Triggers

I cannot put instruction < PREPARE > in a trigger
Posted by: benhamou ariel
Date: February 21, 2006 01:16PM

here my table :
CREATE TABLE `test` (
`id_test` int(8) NOT NULL auto_increment,
`designation` varchar(100) default NULL,
`val_date` date default NULL,
PRIMARY KEY (`id_test`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

here my trigger
create trigger test AFTER INSERT ON test
FOR EACH ROW
BEGIN
DECLARE F VARCHAR(255);
SET F=CONCAT(NEW.id_test,'_',UNIX_TIMESTAMP(Now()));
SET @S=CONCAT('select * INTO OUTFILE ''e:/maj/',F,'.txt'' FIELDS TERMINATED BY '';'' LINES TERMINATED BY ''\r\n'' from test where id_test=',NEW.id_test);

PREPARE stmt FROM @S;
EXECUTE stmt;
DROP PREPARE stmt;
END;


at the time of creation it marks :
"Dynamic SQL is not allowed in stored function or trigger"


my goal is to create a file following an action, with a site to use it later

Options: ReplyQuote


Subject
Views
Written By
Posted
I cannot put instruction < PREPARE > in a trigger
3367
February 21, 2006 01:16PM


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.