Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 399
  • Last Modified:

Opening and appending file names in plsql

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
sakthikumar
Asked:
sakthikumar
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I presume that you don't need this to be done with oracle (pl/sql), but with any scripting tool?
0
 
Alexander Eßer [Alex140181]Software DeveloperCommented:
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
 
johnsoneSenior Oracle DBACommented:
Isn't this a repeat of your other question:

http://www.experts-exchange.com/Database/Oracle/Q_28395132.html
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
sakthikumarAuthor Commented:
In the other question, I got answers for Unix, but I want to check answers for Oracle also.
0
 
sakthikumarAuthor Commented:
If this is not possible from ORACLE PLSQL, I will delete this question.
0
 
Alexander Eßer [Alex140181]Software DeveloperCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now