Unanswered: Pushing Data from a Query to A flat file in UNIX folder.
I am new to working on Oracle in Unix. I have table which has details abt Purchase Orders. I want to push the detail of a Particular Query on a Purchase Order number to a flat file and save the file in directory in Unix. Is there any means to do it. Once I get this procedure what I plan to do is create a job which will regularly push the details of the query results into the flat file and save it. Hope it is something similiar to the Spool on/off in Oracle NT. Can anyone please help me.
There are several ways to do this. I guess it really depends on how you want to approach the problem.
If it can be done outside of the database with cron as the scheduler:
-Perl is a great tool for this
-So is java
-write a tiny script that logs on, executes a query, and exits. Redirect the output to a file. ie
select count(*) Num_Sessions from v$session;
Setup cron to fire this off:
sqlplus uname/password@db @test.sql >test.txt
You can use tail and head to chop off the server info.