IT Community - Software Programming, Web Development and Technical Support

Storing the output from trigger in a text file

This is a discussion on Storing the output from trigger in a text file within the Database Support forums, part of the Web Development category; How to store store the output from a trigger in text file CREATE OR REPLACE TRIGGER TRG_EMP_ENTRy AFTER INSERT OR ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-20-2007, 07:55 AM
sureshbabu sureshbabu is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: India
Posts: 101
sureshbabu is on a distinguished road
Send a message via AIM to sureshbabu Send a message via MSN to sureshbabu Send a message via Yahoo to sureshbabu Send a message via Skype™ to sureshbabu
Smile Storing the output from trigger in a text file

How to store store the output from a trigger in text file

CREATE OR REPLACE TRIGGER
TRG_EMP_ENTRy
AFTER INSERT OR UPDATE OR DELETE ON
STUDENT
FOR EACH ROW
DECLARE
vMsg VARCHAR2 (30) := 'Statement Level Trigger Fired';
vInHandle utl_file.file_type;
BEGIN
IF INSERTING THEN
DBMS_OUTPUT.put_line (vmsg || ' When Inserting');
ELSIF UPDATING THEN
DBMS_OUTPUT.put_line (vmsg || ' When Updating');
END IF;
END;

plz tell me how to store the output in a text file..
Any idea.......
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2007, 02:01 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Storing the output from trigger in a text file

Hi,

In MYSQL

May be this helps you

Code:
DROP TRIGGER trg_test;
CREATE TRIGGER trg_test AFTER INSERT ON table1 FOR EACH ROW
BEGIN
 SELECT field1,field2 INTO OUTTFILE '<Destination Path with file extension' FIELDS TERMINATED BY '|' FROM table1 WHERE field_id = 10;
END;
OUtput:
Name|Value
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 09:03 AM
Selena Selena is offline
D-Web Trainee
 
Join Date: Jul 2007
Location: Bangalore.
Posts: 9
Selena is on a distinguished road
Default Re: Storing the output from trigger in a text file

Hi murali,

I tried this, i can write the output to a file,but get an error file already exists on the second process.

Can u tell me what to do for this?
__________________
Selna.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-27-2007, 06:44 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Storing the output from trigger in a text file

Hi,

Because we are creating new file everytime the Trigger fires and the file is in the same name.

I think wont be a good one by writing into file using a Trigger.

A Result set from the query can be written to the outfile once.
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/database-support/2345-storing-output-trigger-text-file.html
Posted By For Type Date
mixcat: Blogs, Photos, Videos and more on Technorati This thread Refback 07-20-2007 10:00 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read the text from a .pdf file? vadivelanvaidyanathan Software Testing 0 01-28-2008 10:15 PM
convert Excel file to CSV(or text) file using java mobilegeek Java Programming 2 09-06-2007 06:42 AM
Use of Text output value Shanthi Testing Tools 1 08-25-2007 02:37 AM
how to open and retrive text file(.txt)? una_noche Java Server Pages (JSP) 1 08-17-2007 03:27 AM
How to convert a word document/text document/PDF file into an image file? kingmaker C# Programming 0 07-16-2007 11:23 PM


All times are GMT -7. The time now is 06:54 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0