trigger question.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • decoy@system102.com

    #1

    trigger question.

    Hi everyone,
    I have an Oracle trigger that writes any updates to a specified table
    to a file on the filesystem (using pl/sql). How can this be done using
    triggers in mySQL 5+?

    Thanks in advance for your help.

  • Bill Karwin

    #2
    Re: trigger question.

    decoy@system102 .com wrote:[color=blue]
    > Hi everyone,
    > I have an Oracle trigger that writes any updates to a specified table
    > to a file on the filesystem (using pl/sql). How can this be done using
    > triggers in mySQL 5+?[/color]

    I haven't tried this, but I would recommend experimenting with
    "SELECT ... INTO OUTFILE".
    See http://dev.mysql.com/doc/mysql/en/select.html.

    Tip: you can use SELECT without querying a table. E.g., the following
    works:
    SELECT "literal string" INTO OUTFILE

    The question is whether it works inside a trigger in MySQL 5.0.x. The
    only definitive answer is to try it and see.

    Note that this feature works only if the specified output file cannot
    previously exist. This prevents SQL queries from clobbering critical
    system files, such as /etc/passwd or database tables. This might make
    it awkward for your triggers to write incremental updats.

    Alternatively, you could try using the MySQL query log or binary log to
    record changes automatically, and then write some other application to
    filter the log. See http://dev.mysql.com/doc/mysql/en/binary-log.html

    Also read
    http://dev.mysql.com/doc/mysql/en/st...e-logging.html for
    logging issues related specifically to triggers.

    Regards,
    Bill K.

    Comment

    Working...