Home » SQL & PL/SQL » SQL & PL/SQL » specifying path for output from spooled file
specifying path for output from spooled file [message #222838] Tue, 06 March 2007 11:06 Go to next message
moody1
Messages: 15
Registered: March 2007
Junior Member
How do I specify where my sql*plus script puts its output? I am running a shell script that calls the sql, does some spooling, then runs the spooled file. My problem comes in when the spool file runs - it is putting the output in the wrong file. Can someone tell me how to correct that? I have the path where the spooled file is located but the output is going somewhere else. I've included my script:

#!/bin/sh
export ORACLE_SID=aname
export ORACLE_HOME=/oracle/app/oracle/product/9.2.0
export PATH=$ORACLE_HOME/bin:$PATH:.
export SQLDBA="sqlplus /nolog"
$SQLDBA $args <<EOF
connect username/password

set serveroutput on size 1000000
set termout off echo off verify off feedback off trimspool on pages 0 lines 512

spool /oracle/rdbms/dba/dbahold/psid.sql

declare
cursor cur1
is
select distinct ds.owner,ds.name,ds.type,
ds.name || decode(ds.type, 'PACKAGE', '.PKG',
'PACKAGE BODY', '.PGB',
'.SQL') output_file
from dba_source ds
where owner = upper('ANAME')
order by ds.name, ds.type;
begin

for cur1row in cur1
loop
dbms_output.put_line('spool '|| cur1row.owner ||'_'||cur1row.output_file);
dbms_output.put_line('@extract_plsql_source '||cur1row.name|| ' "'|| cur1row.ty
pe||'" '||cur1row.owner);
dbms_output.put_line('spool off');
end loop;

end;
/
spool off
chmod 777 /oracle/rdbms/dba/dbahold/psid.sql
host cd /oracle/rdbms/dba/dbahold/
@/oracle/rdbms/dba/dbahold/psid.sql

Re: specifying path for output from spooled file [message #222843 is a reply to message #222838] Tue, 06 March 2007 12:05 Go to previous message
moody1
Messages: 15
Registered: March 2007
Junior Member
I figured it out. Embarassed
Previous Topic: Counting the most recent record
Next Topic: PL/SQL analyzer/migrator
Goto Forum:
  


Current Time: Sat Dec 10 01:28:59 CST 2016

Total time taken to generate the page: 0.08868 seconds