Solved

Opening and appending file names in plsql

Posted on 2014-03-24
6
385 Views
Last Modified: 2014-04-21
I have a directory which contains a list of  sql files,

I need to open each one of them in a loop
append text to the beginning of the file and end of the file.

Text in the beginning : Spool "file_name".log

Name of the file should be from corresponding file names.

Text in the end : Spool off

How can I do this.
0
Comment
Question by:sakthikumar
6 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39949823
I presume that you don't need this to be done with oracle (pl/sql), but with any scripting tool?
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39949837
I totally agreee with Guy: this can & should be done via OS "tools", like shell/bash script (Linux) or batch-/wsh-file-/script (Windows)!
0
 
LVL 34

Expert Comment

by:johnsone
ID: 39949982
Isn't this a repeat of your other question:

http://www.experts-exchange.com/Database/Oracle/Q_28395132.html
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:sakthikumar
ID: 39964570
In the other question, I got answers for Unix, but I want to check answers for Oracle also.
0
 

Author Comment

by:sakthikumar
ID: 39964598
If this is not possible from ORACLE PLSQL, I will delete this question.
0
 
LVL 13

Accepted Solution

by:
Alexander Eßer [Alex140181] earned 500 total points
ID: 39964709
It IS possible. Totally unneccessary in this situation, but nevertheless possible.
The point is, you'll need something to be able to get all the desired files (filenames) that you want to process. Thus you'd have to exec a host command. This could be possible using one of these (I prefer the oscommand):
http://www.oracle-base.com/articles/8i/shell-commands-from-plsql.php
http://sourceforge.net/projects/plsqlexecoscomm/

So you'd exec a 'ls -a' for example, parse the return/output (list of filenames) and then do your file writing using utl_file...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

914 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

18 Experts available now in Live!

Get 1:1 Help Now