0

I have this query in SQL Developer running on a Oracle 11g XE database:

variable PDL VARCHAR2(256 BYTE);  
set feedback off 
set verify off 
begin
  :PDL := '&1'; 
end;
/ 
set feedback on 
spool c:\lexmark\spool.txt; 
select PRINTERNAME, SERVERNAME, DOCUMENT, PAGES, updatetime
from DESKTOP_JOBS
where SERVERNAME = :PDL
and updatetime BETWEEN TO_DATE ('01/04/2015', 'dd/mm/yyyy')
  AND TO_DATE ('31/05/2015', 'dd/mm/yyyy');

I would like to get data from a .txt file and put the output in a .txt with the same name, in order do have different spool for each query.

I've searched the net for suggestions but so far no luck. Do you have any ideas?

Alex Poole
  • 183,384
  • 11
  • 179
  • 318
  • You want to get *what* data from a .txt file? And write to the *same* .txt file, overwriting it? And a file on the client machine, or on the server machine? – Alex Poole Jun 15 '15 at 09:09
  • In the SOURCE .txt there are server names that currently i pass to the query with the variable **"PDL"**. Running the script, i would like to spool the output to a different .txt every time naming the .txt with the server name. – Francesco Cicciuzz Jun 15 '15 at 11:05
  • forgot to mention the file can be saved locally – Francesco Cicciuzz Jun 15 '15 at 11:15
  • Can you write a batch script to read your input file and then run SQL\*Plus, passing each name in turn as the positional parameter? – Alex Poole Jun 15 '15 at 16:23
  • Unfortunately I don't know how to do it. I can do scripting in powershell but don't know how to do in sql*plus – Francesco Cicciuzz Jun 16 '15 at 14:59

0 Answers0