How can I create a text file from an Oracle trigger?

Posted on 2009-02-11
Last Modified: 2012-05-06
I need to urgently create an Oracle trigger that will write a text file every time a table is updated. The Oracle databse is a Unix box, but I need to access the text-file from a Windows box.
I know SQL but I have never written a trigger before.
Please help...many thanks
Question by:eddiecon
    LVL 14

    Expert Comment

    does the oracle box have a connection to the unix box?

    I would have the data saved into a oracle table.

    then from there send it to the other box.
    LVL 14

    Accepted Solution

    here is a sample of a trigger

        CREATE OR REPLACE TRIGGER orders_after_update
            ON orders
            FOR EACH ROW

            v_username varchar2(10);


            -- Find username of person performing UPDATE into table
            SELECT user INTO v_username
            FROM dual;

            -- Insert record into audit table
            INSERT INTO orders_audit
             ( order_id,
               username )
             ( :new.order_id,
               v_username );


    Author Comment

    Good idea, thanks!

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now