[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Writing my first MYSQL trigger because I thought it would the quick and dirty solution to a little task. However I need to use "SELECT ... INTO OUTFILE filename" Where the filename changes. The files will only exist fleetingly as something is waiting to eat them, but since it could go a bit mad, I need to make sure the names are unique, I don't really care as long as I can specify path and extension "1" "2" "3" would be fine. A quick Google shows this is a known "bug", and a lot of work-arounds are given, but which one is the right syntax of workaround to use in a trigger (or did I choose the wrong method)? Frustrated as the rest of it worked fine once I got the syntax correct and fixed my typos and I really want to be done and dusted on this project. Basically CREATE trigger after update on table1 ...create a cursor IF NEW.blah <> OLD.blah THEN loop over cursor set fname here as unique I can chuck some noise in from the variables if needed select "Some text", OLD.blahblah INTO OUTFILE fname end loop END IF END; The cursor will likely only ever have 0, 1 or 2 rows, although in theory it could be more, so I only write one or two files for each updates. I can make a reasonably unique fname, but I can't find the syntax for passing the fname to the OUTFILE. -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/listfaq