Solved

Opening and appending file names in plsql

Posted on 2014-03-24
6
393 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 143

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 35

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

705 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