Re: Spool Command

From: Martin Farber <farber_at_computer.net>
Date: 1996/08/28
Message-ID: <32237FF1.14_at_computer.net>#1/1


This can also be done using sqlplus:

SQL> col today noprint new_value datestamp SQL> select to_char(sysdate,'YYYYMMDD') today from dual;

SQL> def
DEFINE _O_VERSION = "Oracle7 Server Release 7.2.2.4.0 - Production Release
With the distributed, replication and parallel query options PL/SQL Release 2.2.2.3.1 - Production" (CHAR)

DEFINE _O_RELEASE      = "702020400" (CHAR)
DEFINE DATESTAMP       = "19960828" (CHAR)
SQL> spool myfilename.&datestamp
SQL> select * from dual;

D
-
X

SQL> spool off

This created a file called: myfilename.19960828 on my NT system.

Good luck!

Martin Farber
Independent Oracle Consultant


"A Jack of all trades and a slave to one."

Lance.Humpert_at_mail.tju.edu wrote:
>
> Robert J. McCallister writes:
>
> > Is their a way to concatenate the sysdate with a file name using the
> > spool command?
> >
> > What I am hoping to do have is something like:
> >
> > filename.081696
>
> Could you pass the filename to SQL*Plus as a command line argument?
> If you can execute syntax like:
>
> $FILENAME=filename.`date +%m%d%y`
> sqlplus userid/password _at_my_program.sql $FILENAME
>
> ...and in your sql program code:
>
> spool &1;
>
> This spools the output from 'my_program.sql' to the file name specified
> by $FILENAME. This assumes a unix-like platform and that you're invoking
> your program from a command line rather than from inside SQL*Plus.
>
> - Lance (sorry to be presumptuous...)
Received on Wed Aug 28 1996 - 00:00:00 CEST

Original text of this message